/* ═══════════════════════════════════════════════════════════════════════════
   YouTube Automation Platform — Design System
   Premium dark-mode with glassmorphism, gradients, and micro-animations
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ─── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
    /* Background */
    --bg-primary: #06060f;
    --bg-secondary: #0c0c1d;
    --bg-card: rgba(15, 15, 35, 0.7);
    --bg-card-hover: rgba(25, 25, 55, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-sidebar: rgba(8, 8, 20, 0.95);

    /* Text */
    --text-primary: #f0f0f5;
    --text-secondary: rgba(240, 240, 245, 0.65);
    --text-muted: rgba(240, 240, 245, 0.4);

    /* Accents */
    --accent-violet: #8b5cf6;
    --accent-violet-light: #a78bfa;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;
    --accent-blue: #3b82f6;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #8b5cf6, #06b6d4);
    --gradient-glow: linear-gradient(135deg, #8b5cf680, #06b6d480);
    --gradient-hero: linear-gradient(135deg, #8b5cf6, #ec4899, #06b6d4);
    --gradient-card: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(6,182,212,0.05));
    --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-danger: linear-gradient(135deg, #f43f5e, #e11d48);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(139, 92, 246, 0.3);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15);
    --shadow-glow-cyan: 0 0 30px rgba(6, 182, 212, 0.15);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --content-max: 1280px;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

a { color: var(--accent-violet-light); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-cyan); }

img { max-width: 100%; display: block; }

/* ─── Utility Classes ───────────────────────────────────────────────────── */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 24px; }
.text-gradient { background: var(--gradient-hero); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.grid { display: grid; }
.hidden { display: none !important; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(10px);
}
.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--accent-violet);
}

.btn-danger {
    background: var(--gradient-danger);
    color: #fff;
}

.btn-success {
    background: var(--gradient-success);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass); }

.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.btn-lg { padding: 16px 32px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
}

/* ─── Glass Card ────────────────────────────────────────────────────────── */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    transition: all var(--transition-base);
}
.glass-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
}

.card-glow {
    position: relative;
}
.card-glow::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: -1;
    filter: blur(8px);
}
.card-glow:hover::before { opacity: 0.15; }

/* ─── Form Controls ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    outline: none;
}
.form-input:focus {
    border-color: var(--accent-violet);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    background: rgba(255, 255, 255, 0.07);
}
.form-input::placeholder { color: var(--text-muted); }

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}
.auth-divider span {
    padding: 0 16px;
}

.form-input-icon {
    position: relative;
}
.form-input-icon .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}
.form-input-icon .form-input { padding-left: 42px; }

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='rgba(240,240,245,0.4)' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 5.8 3.5 4.4 3.5-4.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-violet);
    cursor: pointer;
}

/* ─── Badge ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-free { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.badge-pro { background: rgba(139, 92, 246, 0.2); color: var(--accent-violet-light); }
.badge-enterprise { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--accent-emerald); }
.badge-danger { background: rgba(244, 63, 94, 0.2); color: var(--accent-rose); }
.badge-info { background: rgba(6, 182, 212, 0.2); color: var(--accent-cyan); }

/* ─── Toast Notifications ───────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastIn 0.35s ease-out;
    max-width: 380px;
    font-size: 0.88rem;
}
.toast.toast-success { border-left: 3px solid var(--accent-emerald); }
.toast.toast-error { border-left: 3px solid var(--accent-rose); }
.toast.toast-info { border-left: 3px solid var(--accent-cyan); }
.toast.removing { animation: toastOut 0.3s ease-in forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(60px); }
}

/* ─── Landing Page Navbar ───────────────────────────────────────────────── */
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    background: transparent;
    transition: all var(--transition-base);
}
.landing-nav.scrolled {
    background: rgba(6, 6, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 0;
}
.landing-nav .nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 24px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}
.nav-logo-img {
    height: 38px;
    width: auto;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transition: transform var(--transition-base);
}
.nav-logo:hover .nav-logo-img {
    transform: scale(1.05);
}
.nav-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}
.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}
.nav-links a:hover { color: var(--text-primary); }
.nav-actions { display: flex; gap: 12px; }
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}
.mobile-nav-action {
    display: none;
}

/* ─── Hero Section ──────────────────────────────────────────────────────── */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 24px 80px;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 50%, rgba(236, 72, 153, 0.05) 0%, transparent 40%);
}
.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-violet);
    border-radius: 50%;
    opacity: 0.3;
    animation: float-particle linear infinite;
}
@keyframes float-particle {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.4; }
    90% { opacity: 0.4; }
    100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}
.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent-violet-light);
    margin-bottom: 24px;
    animation: badgePulse 3s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0); }
}
.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.2rem);
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.1;
}
.hero p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 580px;
    margin: 0 auto 36px;
    line-height: 1.7;
}
.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border-subtle);
}
.hero-stat { text-align: center; }
.hero-stat .number {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-stat .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── Feature Cards ─────────────────────────────────────────────────────── */
.section { padding: 100px 0; position: relative; }
.section-header {
    text-align: center;
    margin-bottom: 56px;
}
.section-header h2 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 16px;
}
.section-header p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}
.feature-card {
    padding: 32px;
    position: relative;
    overflow: hidden;
}
.feature-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}
.feature-card:hover::after { opacity: 1; }
.feature-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.4rem;
    margin-bottom: 20px;
}
.feature-icon.violet { background: rgba(139, 92, 246, 0.15); color: var(--accent-violet); }
.feature-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.feature-icon.emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.feature-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.feature-icon.rose { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.feature-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}
.feature-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ─── How It Works ──────────────────────────────────────────────────────── */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px;
    position: relative;
}
.step-card {
    text-align: center;
    padding: 32px 24px;
}
.step-number {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--gradient-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
}
.step-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}
.step-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* ─── Pricing Cards ─────────────────────────────────────────────────────── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}
.pricing-card {
    padding: 36px;
    position: relative;
    display: flex;
    flex-direction: column;
}
.pricing-card.popular {
    border-color: var(--accent-violet);
    background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(6,182,212,0.04));
    box-shadow: var(--shadow-glow);
}
.popular-badge {
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 20px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
}
.pricing-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.pricing-price {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 4px;
}
.pricing-period {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.pricing-features {
    list-style: none;
    flex: 1;
    margin-bottom: 28px;
}
.pricing-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.pricing-features li::before {
    content: '✓';
    color: var(--accent-emerald);
    font-weight: 700;
    font-size: 0.85rem;
}

/* ─── Token Packs ───────────────────────────────────────────────────────── */
.packs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    max-width: 700px;
    margin: 40px auto 0;
}
.pack-card {
    padding: 24px;
    text-align: center;
    cursor: pointer;
}
.pack-card:hover { border-color: var(--accent-cyan); }
.pack-tokens {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-cyan);
}
.pack-price {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 4px 0;
}
.pack-savings {
    font-size: 0.78rem;
    color: var(--accent-emerald);
    font-weight: 600;
}

/* ─── CTA Section ───────────────────────────────────────────────────────── */
.cta-section {
    text-align: center;
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}
.cta-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(139,92,246,0.1), transparent 70%);
}
.cta-section h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 16px;
    position: relative;
}
.cta-section p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    position: relative;
}

/* ─── Footer ────────────────────────────────────────────────────────────── */
.landing-footer {
    padding: 40px 0;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}
.landing-footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ═══ APP LAYOUT (Dashboard, Upload, Settings) ═══════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-base);
}
.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}
.sidebar-nav-group {
    margin-bottom: 16px;
}
.sidebar-nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 12px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}
.sidebar-link:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}
.sidebar-link.active {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-violet-light);
}
.sidebar-link .link-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}
.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-username {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-plan {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* ─── Main Content ──────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(6, 6, 15, 0.8);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.mobile-sidebar-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
}

.token-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
}
.token-widget .token-icon {
    font-size: 1rem;
}
.token-widget .token-count {
    color: var(--accent-violet-light);
}

.page-content {
    padding: 28px;
}

/* ─── Stats Cards ───────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    padding: 24px;
}
.stat-card .stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}
.stat-card .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.stat-card .stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
}
.stat-card .stat-change {
    font-size: 0.78rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-change.up { color: var(--accent-emerald); }
.stat-change.down { color: var(--accent-rose); }

/* ─── Chart Area ────────────────────────────────────────────────────────── */
.chart-container {
    padding: 24px;
    margin-bottom: 28px;
}
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.chart-header h3 { font-size: 1rem; }
.chart-canvas-wrapper {
    width: 100%;
    height: 200px;
    position: relative;
}
.chart-canvas-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ─── Recent Uploads Table ──────────────────────────────────────────────── */
.uploads-list {
    padding: 24px;
}
.uploads-list h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}
.upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.upload-item:last-child { border-bottom: none; }
.upload-icon {
    width: 40px;
    height: 40px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.upload-info { flex: 1; min-width: 0; }
.upload-title {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.upload-status {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

/* ─── Upload Page ───────────────────────────────────────────────────────── */
.upload-area {
    max-width: 720px;
    margin: 0 auto;
}
.source-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}
.source-option {
    padding: 24px;
    text-align: center;
    cursor: pointer;
    border: 2px solid var(--border-subtle) !important;
    transition: all var(--transition-base);
}
.source-option:hover { border-color: var(--accent-violet) !important; }
.source-option.active { border-color: var(--accent-violet) !important; background: rgba(139,92,246,0.08); }
.source-option .source-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}
.source-option h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
}
.source-option p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dropzone {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-violet);
    background: rgba(139, 92, 246, 0.05);
}
.dropzone .drop-icon { font-size: 2.5rem; margin-bottom: 12px; }
.dropzone h4 { font-size: 1rem; margin-bottom: 4px; }
.dropzone p { font-size: 0.85rem; color: var(--text-muted); }

.editing-panel {
    padding: 24px;
    margin-top: 20px;
}
.editing-panel h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.cost-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    margin: 20px 0;
}
.cost-preview .cost-label { font-size: 0.9rem; color: var(--text-secondary); }
.cost-preview .cost-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-violet-light);
}

/* ─── Progress Steps ────────────────────────────────────────────────────── */
.progress-area {
    margin-top: 28px;
}
.progress-bar-track {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 16px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    width: 0%;
}
.progress-status {
    text-align: center;
}
.progress-message {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 4px;
}
.progress-percent {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.result-card {
    padding: 32px;
    text-align: center;
    margin-top: 20px;
}
.result-card .result-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}
.result-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}
.result-card a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-cyan);
    font-weight: 600;
}

/* ─── Settings Page ─────────────────────────────────────────────────────── */
.settings-section {
    max-width: 640px;
}
.settings-card {
    padding: 28px;
    margin-bottom: 20px;
}
.settings-card h3 {
    font-size: 1.05rem;
    margin-bottom: 4px;
}
.settings-card .settings-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.yt-connection {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
}
.yt-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
.yt-info { flex: 1; }
.yt-name {
    font-size: 0.95rem;
    font-weight: 600;
}
.yt-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ─── Auth Pages ────────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.auth-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 30%, rgba(139, 92, 246, 0.12) 0%, transparent 55%),
                radial-gradient(ellipse at 80% 70%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    position: relative;
    z-index: 1;
}
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}
.auth-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}
.auth-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}
.flash-messages {
    margin-bottom: 16px;
}
.flash-message {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 8px;
}
.flash-message.error {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: var(--accent-rose);
}
.flash-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
}

/* ─── Error Pages ───────────────────────────────────────────────────────── */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}
.error-code {
    font-family: 'Outfit', sans-serif;
    font-size: 8rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    line-height: 1;
    margin-bottom: 16px;
}
.error-page h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}
.error-page p {
    color: var(--text-secondary);
    margin-bottom: 28px;
}

/* ─── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px;
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}
.empty-state h4 {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-in {
    animation: fadeInUp 0.5s ease-out both;
}
.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }
.animate-in-delay-4 { animation-delay: 0.4s; }

/* ─── Dashboard 2-col grid ──────────────────────────────────────────────── */
.dashboard-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */

/* ── Tablet (≤1024px) ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .hero-stats { gap: 32px; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .steps-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile (≤768px) ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* ── Landing Nav ─────────────────────────────────────────────────── */
    .mobile-menu-btn {
        display: block;
    }
    .nav-links {
        display: none;
    }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(6, 6, 15, 0.97);
        backdrop-filter: blur(20px);
        padding: 20px 24px;
        gap: 8px;
        border-bottom: 1px solid var(--border-subtle);
        z-index: 999;
    }
    .nav-links.open a {
        display: block;
        padding: 10px 0;
        font-size: 1rem;
    }
    .nav-actions {
        display: none;
    }
    .nav-links.open ~ .nav-actions,
    .nav-inner .nav-links.open + .nav-actions {
        display: none;
    }
    /* Show actions inside the mobile menu */
    .nav-links.open::after {
        content: '';
        display: block;
        height: 1px;
        background: var(--border-subtle);
        margin: 8px 0;
    }
    .nav-links.open .mobile-nav-action {
        display: block;
        list-style: none;
    }
    .nav-links.open .mobile-nav-action a {
        padding: 10px 16px;
        border-radius: var(--radius-sm);
    }

    /* ── Hero ─────────────────────────────────────────────────────── */
    .hero {
        padding: 100px 20px 60px;
        min-height: auto;
    }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 0.95rem; }
    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    .hero-actions .btn {
        width: 100%;
        max-width: 300px;
    }
    .hero-stats {
        flex-direction: column;
        gap: 20px;
        margin-top: 40px;
    }
    .hero-stat .number { font-size: 1.8rem; }

    /* ── Sections ─────────────────────────────────────────────────── */
    .section { padding: 60px 0; }
    .section-header { margin-bottom: 36px; }
    .section-header h2 { font-size: 1.5rem; }
    .section-header p { font-size: 0.9rem; }
    .features-grid { grid-template-columns: 1fr; gap: 16px; }
    .feature-card { padding: 24px; }
    .steps-grid { grid-template-columns: 1fr; gap: 20px; }
    .step-card { padding: 24px 20px; }

    /* ── Pricing ──────────────────────────────────────────────────── */
    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
    .pricing-card { padding: 28px; }
    .pricing-price { font-size: 2.4rem; }
    .packs-grid { grid-template-columns: 1fr 1fr; }

    /* ── CTA ──────────────────────────────────────────────────────── */
    .cta-section { padding: 50px 0; }
    .cta-section h2 { font-size: 1.5rem; }

    /* ── Footer ─────────────────────────────────────────────────── */
    .landing-footer { padding: 28px 0; }

    /* ── Sidebar ──────────────────────────────────────────────────── */
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-sidebar-btn {
        display: block;
    }

    /* ── Topbar ─────────────────────────────────────────────────── */
    .topbar { padding: 0 16px; }
    .topbar-title { font-size: 1rem; }
    .token-widget { padding: 6px 10px; font-size: 0.75rem; }

    /* ── Page Content ─────────────────────────────────────────────── */
    .page-content { padding: 20px 16px; }

    /* ── Stats Grid ─────────────────────────────────────────────── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .stat-card { padding: 18px; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .stat-card .stat-icon { width: 32px; height: 32px; font-size: 0.9rem; }

    /* ── Dashboard 2-col → 1-col ──────────────────────────────────── */
    .dashboard-grid-2col {
        grid-template-columns: 1fr;
    }

    /* ── Upload page ──────────────────────────────────────────────── */
    .source-picker {
        grid-template-columns: 1fr;
    }
    .upload-area { padding: 0; }
    .dropzone { padding: 32px 20px; }
    .editing-panel { padding: 18px; }
    .cost-preview { flex-direction: column; gap: 8px; text-align: center; }

    /* ── Settings ─────────────────────────────────────────────────── */
    .settings-card { padding: 20px; }
    .yt-connection { flex-direction: column; text-align: center; gap: 12px; }

    /* ── Upload list ──────────────────────────────────────────────── */
    .uploads-list { padding: 18px; }
    .upload-item { gap: 10px; }
    .upload-title { font-size: 0.82rem; }
    .upload-meta { font-size: 0.72rem; }

    /* ── Chart ────────────────────────────────────────────────────── */
    .chart-container { padding: 18px; }
    .chart-canvas-wrapper { height: 160px; }

    /* ── Auth pages ───────────────────────────────────────────────── */
    .auth-card { padding: 28px 20px; }
    .auth-header h1 { font-size: 1.5rem; }
}

/* ── Small phones (≤480px) ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .hero { padding: 90px 16px 50px; }
    .hero h1 { font-size: 1.7rem; }
    .hero-badge { font-size: 0.75rem; padding: 6px 12px; }
    .container { padding: 0 16px; }

    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stat-card .stat-value { font-size: 1.3rem; }

    .hero-actions .btn {
        padding: 14px 20px;
        font-size: 0.9rem;
    }

    .packs-grid { grid-template-columns: 1fr; }

    .topbar-left { gap: 10px; }
    .topbar-title { font-size: 0.9rem; }

    /* Better touch targets */
    .sidebar-link { padding: 12px; font-size: 0.92rem; }
    .btn-sm { padding: 10px 14px; }
}

/* ─── Sidebar overlay on mobile ─────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.sidebar-overlay.active {
    display: block;
}

/* ─── Pulse animation for token widget ──────────────────────────────────── */
.token-low {
    animation: tokenPulse 2s ease-in-out infinite;
}
@keyframes tokenPulse {
    0%, 100% { border-color: rgba(244, 63, 94, 0.3); }
    50% { border-color: rgba(244, 63, 94, 0.7); }
}

/* ─── Loading spinner ───────────────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-violet);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn .spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
    border-color: rgba(255,255,255,0.3);
    border-top-color: #fff;
}
