/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-xl: 0 24px 60px rgba(0,0,0,0.16);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1400px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-code: #1e293b;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-code: #e2e8f0;
    --accent-1: #6366f1;
    --accent-1-light: #eef2ff;
    --accent-2: #8b5cf6;
    --accent-3: #06b6d4;
    --accent-4: #10b981;
    --accent-5: #f59e0b;
    --accent-6: #ef4444;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-card: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --gradient-accent: linear-gradient(135deg, #6366f1, #8b5cf6, #06b6d4);
    --nav-bg: rgba(255,255,255,0.85);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #162032;
    --bg-card: #1e293b;
    --bg-code: #0d1525;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-code: #e2e8f0;
    --accent-1: #818cf8;
    --accent-1-light: #1e1b4b;
    --accent-2: #a78bfa;
    --accent-3: #22d3ee;
    --accent-4: #34d399;
    --accent-5: #fbbf24;
    --accent-6: #f87171;
    --border: #334155;
    --border-light: #1e293b;
    --gradient-hero: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    --gradient-card: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --gradient-accent: linear-gradient(135deg, #818cf8, #a78bfa, #22d3ee);
    --nav-bg: rgba(15,23,42,0.9);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
    --shadow-xl: 0 24px 60px rgba(0,0,0,0.5);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-1); border-radius: 4px; }

/* ===== TOP NAVIGATION ===== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}
.top-nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.2rem;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}
.nav-brand svg { width: 32px; height: 32px; }
.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ===== TOP TABS ===== */
.top-tabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 1rem;
}
.top-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xs);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
.top-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.top-tab.active {
    background: var(--accent-1-light);
    color: var(--accent-1);
    font-weight: 600;
}
.top-tab-icon { font-size: 1rem; }

/* Theme Toggle */
.theme-toggle {
    position: relative;
    width: 56px;
    height: 30px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    padding: 0 4px;
    flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent-1); }
.theme-toggle-knob {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gradient-accent);
    transition: transform var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
[data-theme="dark"] .theme-toggle-knob { transform: translateX(24px); }
.theme-toggle-knob svg { width: 14px; height: 14px; fill: none; stroke: white; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sun-icon { display: block; }
.moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }

/* ===== SIDEBAR NAV ===== */
.layout {
    display: flex;
    max-width: var(--max-width);
    margin: 0 auto;
    padding-top: 64px;
}
.sidebar {
    position: fixed;
    top: 64px;
    left: max(0px, calc((100vw - var(--max-width)) / 2));
    width: 260px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 1.5rem 1rem;
    border-right: 1px solid var(--border);
    background: var(--bg-secondary);
    transition: all var(--transition);
    z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    padding: 0 0.75rem;
    margin-bottom: 0.75rem;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
}
.sidebar-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.sidebar-link.active {
    background: var(--accent-1-light);
    color: var(--accent-1);
    font-weight: 600;
}
.sidebar-link .step-num {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-tertiary);
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: all var(--transition);
}
.sidebar-link.active .step-num {
    background: var(--accent-1);
    color: white;
    font-size: 0.85rem;
}
.sidebar-link .step-label { line-height: 1.3; }

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: calc(100vh - 64px);
    max-width: calc(100% - 260px);
}

/* ===== HERO SECTION ===== */
.hero {
    position: relative;
    background: var(--gradient-hero);
    padding: 4rem 3rem 3rem;
    overflow: hidden;
    color: white;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content {
    position: relative;
    max-width: 900px;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255,255,255,0.2);
}
.hero-badge .pulse {
    width: 8px; height: 8px;
    background: #34d399;
    border-radius: 50%;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}
.hero h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}
.hero p {
    font-size: 1.1rem;
    line-height: 1.8;
    opacity: 0.9;
    max-width: 640px;
}
/* Floating icons */
.hero-float {
    position: absolute;
    opacity: 0.12;
    animation: float 6s ease-in-out infinite;
}
.hero-float:nth-child(1) { top: 10%; right: 5%; animation-delay: -1s; font-size: 4rem; }
.hero-float:nth-child(2) { top: 50%; right: 15%; animation-delay: -3s; font-size: 3rem; }
.hero-float:nth-child(3) { bottom: 10%; right: 25%; animation-delay: -2s; font-size: 3.5rem; }
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* ===== SECTION STYLES ===== */
.section {
    padding: 3rem;
    scroll-margin-top: 140px;
    transition: all var(--transition);
}
.section h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.section h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* ===== FEATURE GRID ===== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-1);
}
.feature-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    color: white;
    box-shadow: var(--shadow-sm);
}
.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.feature-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0;
}

/* ===== INFO CARDS ===== */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1rem;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.info-card:hover {
    border-color: var(--accent-1);
    box-shadow: var(--shadow-md);
}
.info-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.info-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* ===== STEPS LIST ===== */
.steps-list {
    margin: 2rem 0;
}
.step-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
}
.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 23px;
    top: 50px;
    bottom: -16px;
    width: 2px;
    background: var(--border);
}
.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}
.step-content {
    flex: 1;
    padding-top: 0.5rem;
}
.step-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.step-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== CODE BLOCKS ===== */
.code-block {
    background: var(--bg-code);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}
.code-block code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-code);
    line-height: 1.8;
}
code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-xs);
    font-size: 0.85em;
    color: var(--accent-1);
}

/* ===== TIMELINE ===== */
.timeline {
    margin: 2rem 0;
    padding-left: 2rem;
    border-left: 2px solid var(--border);
}
.timeline-item {
    position: relative;
    padding-bottom: 2rem;
    padding-left: 1.5rem;
}
.timeline-marker {
    position: absolute;
    left: -2.6rem;
    top: 0.25rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-1);
    border: 3px solid var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent-1);
}
.timeline-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}
.timeline-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}
.badge-accent {
    background: var(--accent-1-light);
    color: var(--accent-1);
}

/* ===== ACCORDION ===== */
.accordion {
    margin: 1.5rem 0;
}
.accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    overflow: hidden;
    background: var(--bg-card);
}
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}
.accordion-header:hover {
    background: var(--bg-tertiary);
}
.accordion-icon {
    font-size: 1.2rem;
    color: var(--accent-1);
    transition: transform var(--transition);
}
.accordion-item.open .accordion-icon {
    transform: rotate(45deg);
}
.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}
.accordion-item.open .accordion-body {
    max-height: 500px;
    padding: 0 1.5rem 1rem;
}

/* ===== BUTTONS ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-accent);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .top-tabs {
        display: none;
    }
    .sidebar-toggle {
        display: flex;
    }
    .sidebar {
        transform: translateX(-100%);
        left: 0;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 3rem 1.5rem 2rem;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .section {
        padding: 2rem 1.5rem;
    }
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .top-nav-inner {
        padding: 0 1rem;
    }
}

/* Mobile top-tabs: show as dropdown-like in sidebar when sidebar is open */
@media (max-width: 1024px) {
    .sidebar.open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: -1;
    }
}
