/* ── Multi-Channel Listing Generator ── */
/* Global Reset & Variables */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --amazon-color: #ff9900;
    --ebay-color: #e53238;
    --shopify-color: #96bf48;
    --etsy-color: #f1641e;
    --google-color: #4285f4;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.navbar-brand i { font-size: 1.5rem; }

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ── Main Content ── */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Cards ── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.stat-icon.products { background: var(--primary); }
.stat-icon.listings { background: var(--secondary); }
.stat-icon.quality { background: var(--success); }
.stat-icon.channels { background: var(--warning); }

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ── Channel badges ── */
.channel-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 0.35rem;
}

.channel-badge.amazon { background: #fff3e0; color: #e65100; }
.channel-badge.ebay { background: #fce4ec; color: #c62828; }
.channel-badge.shopify { background: #e8f5e9; color: #2e7d32; }
.channel-badge.etsy { background: #fff3e0; color: #bf360c; }
.channel-badge.google_shopping { background: #e3f2fd; color: #1565c0; }

/* ── Forms ── */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: var(--transition);
    background: white;
    color: var(--gray-800);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

textarea.form-control { min-height: 100px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover { background: var(--gray-300); }

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover { background: #059669; }

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover { background: #dc2626; }

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Tables ── */
.table-container { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gray-50);
}

tr:hover { background: var(--gray-50); }

/* ── Channel selector ── */
.channel-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.channel-option {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.channel-option:hover {
    border-color: var(--primary-light);
    background: rgba(79,70,229,0.03);
}

.channel-option.selected {
    border-color: var(--primary);
    background: rgba(79,70,229,0.06);
}

.channel-option .channel-name {
    font-weight: 600;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.channel-option .channel-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ── Preview panels ── */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.preview-panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.preview-panel-header {
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-panel-header.amazon { background: var(--amazon-color); }
.preview-panel-header.ebay { background: var(--ebay-color); }
.preview-panel-header.shopify { background: var(--shopify-color); }
.preview-panel-header.etsy { background: var(--etsy-color); }
.preview-panel-header.google_shopping { background: var(--google-color); }

.preview-panel-body {
    padding: 1.5rem;
}

.preview-field {
    margin-bottom: 1rem;
}

.preview-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.preview-field-value {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.char-count {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.125rem;
}

.char-count.over-limit { color: var(--danger); font-weight: 600; }
.char-count.near-limit { color: var(--warning); }

/* ── Quality score ── */
.quality-score {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.85rem;
}

.quality-score.high { background: #d1fae5; color: #065f46; }
.quality-score.medium { background: #fef3c7; color: #92400e; }
.quality-score.low { background: #fee2e2; color: #991b1b; }

/* ── Warnings ── */
.warning-list {
    list-style: none;
    padding: 0;
}

.warning-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--warning);
}

.warning-item i { margin-top: 0.15rem; }

/* ── Tags ── */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tag {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ── Loading ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
    font-size: 1.1rem;
}

.loading-overlay.hidden { display: none; }

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--secondary); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ── Bullet list ── */
.bullet-list {
    list-style: none;
    padding: 0;
}

.bullet-list li {
    padding: 0.375rem 0;
    padding-left: 1.25rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.bullet-list li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 0.75rem;
    }
    .navbar-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    .main-content { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .preview-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
