*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --green-100: #dcfce7;
    --green-700: #15803d;
    --amber-100: #fef3c7;
    --amber-700: #b45309;
    --red-100: #fee2e2;
    --red-700: #b91c1c;
    --purple-100: #f3e8ff;
    --purple-700: #7e22ce;
    --sidebar-width: 272px;
    --toc-width: 220px;
    --header-height: 68px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background: #fff;
    color: var(--slate-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue-600);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============ HEADER ============ */
.docs-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.docs-header .logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--slate-900);
    letter-spacing: -0.05em;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.docs-header .logo:hover {
    text-decoration: none;
}

.docs-header .logo span {
    color: var(--blue-600);
}

.docs-header nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.docs-header nav a.nav-link {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: color 0.15s;
}

.docs-header nav a.nav-link:hover {
    color: var(--blue-600);
    text-decoration: none;
}

.docs-header .btn-primary {
    background: var(--blue-600);
    color: #fff;
    padding: 0.625rem 1.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: background 0.15s;
    box-shadow: 0 10px 15px -3px rgba(191, 219, 254, 0.5);
    white-space: nowrap;
}

.docs-header .btn-primary:hover {
    background: var(--blue-700);
    text-decoration: none;
}

/* ============ LAYOUT ============ */
.docs-layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* ============ LEFT SIDEBAR ============ */
.docs-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    border-right: 1px solid var(--slate-200);
    background: var(--slate-50);
    padding: 1.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--slate-300) transparent;
}

.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 4px;
}

.nav-section {
    margin-bottom: 0.25rem;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--slate-400);
    cursor: pointer;
    user-select: none;
}

.nav-section-header .chevron {
    transition: transform 0.2s;
    font-size: 0.6rem;
}

.nav-section.open .chevron {
    transform: rotate(90deg);
}

.nav-items {
    display: none;
}

.nav-section.open .nav-items {
    display: block;
}

.nav-item {
    display: block;
    padding: 0.375rem 1.5rem 0.375rem 2rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--slate-600);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: color 0.15s, background 0.15s;
    line-height: 1.4;
}

.nav-item:hover {
    color: var(--blue-600);
    background: var(--blue-50);
    text-decoration: none;
}

.nav-item.active {
    color: var(--blue-700);
    font-weight: 700;
    border-left-color: var(--blue-600);
    background: var(--blue-50);
}

/* ============ MAIN CONTENT ============ */
.docs-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-right: var(--toc-width);
    min-width: 0;
    padding: 3rem 3.5rem;
    max-width: 900px;
}

/* ============ RIGHT TOC ============ */
.docs-toc {
    width: var(--toc-width);
    flex-shrink: 0;
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 2rem 1rem 2rem 1rem;
    border-left: 1px solid var(--slate-200);
}

.docs-toc h4 {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--slate-400);
    margin-bottom: 0.75rem;
}

.toc-link {
    display: block;
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--slate-500);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.toc-link:hover {
    color: var(--blue-600);
    text-decoration: none;
}

.toc-link.active {
    color: var(--blue-700);
    font-weight: 600;
    border-left-color: var(--blue-500);
}

.toc-link.sub {
    padding-left: 1.25rem;
    font-size: 0.74rem;
}

/* ============ CONTENT STYLES ============ */
.content h1 {
    font-size: 2.1rem;
    font-weight: 900;
    color: var(--slate-900);
    letter-spacing: -0.04em;
    margin-bottom: 0.75rem;
    line-height: 1.15;
}

.content .lead {
    font-size: 1.05rem;
    color: var(--slate-500);
    margin-bottom: 2.5rem;
    line-height: 1.7;
    max-width: 680px;
}

.content h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: -0.03em;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--slate-200);
}

.content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--slate-800);
    letter-spacing: -0.02em;
    margin-top: 2rem;
    margin-bottom: 0.6rem;
}

.content h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--slate-700);
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.78rem;
}

.content p {
    color: var(--slate-600);
    margin-bottom: 1rem;
    line-height: 1.75;
}

.content ul,
.content ol {
    color: var(--slate-600);
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    line-height: 1.75;
}

.content li {
    margin-bottom: 0.4rem;
}

.content li strong {
    color: var(--slate-800);
}

.content code {
    font-family: 'Fira Code', monospace;
    font-size: 0.82em;
    background: var(--slate-100);
    color: var(--blue-700);
    padding: 0.15em 0.45em;
    border-radius: 4px;
    border: 1px solid var(--slate-200);
}

.content pre {
    background: var(--slate-900);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.85rem;
    line-height: 1.65;
    font-family: 'Fira Code', monospace;
}

.content pre code {
    background: none;
    border: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* ============ CARDS GRID ============ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.card {
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card:hover {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px var(--blue-100);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.card .card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    display: block;
}

.card .card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--slate-900);
}

.card .card-desc {
    font-size: 0.8rem;
    color: var(--slate-500);
    line-height: 1.5;
}

/* ============ ALERTS ============ */
.alert {
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    display: flex;
    gap: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.alert-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.alert strong {
    display: block;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.alert-info {
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--blue-700);
}

.alert-tip {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-warn {
    background: var(--amber-100);
    border: 1px solid #fcd34d;
    color: var(--amber-700);
}

.alert-danger {
    background: var(--red-100);
    border: 1px solid #fca5a5;
    color: var(--red-700);
}

/* ============ STEPS ============ */
.steps {
    counter-reset: step;
    margin: 1.5rem 0;
}

.step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    counter-increment: step;
}

.step::before {
    content: counter(step);
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    background: var(--blue-600);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
}

.step-body {
    flex: 1;
}

.step-body strong {
    display: block;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 0.25rem;
}

.step-body p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--slate-500);
}

/* ============ TABLE ============ */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.875rem;
}

.content th {
    background: var(--slate-50);
    text-align: left;
    padding: 0.65rem 1rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-500);
    border-bottom: 2px solid var(--slate-200);
}

.content td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-600);
    vertical-align: top;
}

.content tr:hover td {
    background: var(--slate-50);
}

/* ============ BADGE ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.65em;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-blue {
    background: var(--blue-100);
    color: var(--blue-700);
}

.badge-green {
    background: var(--green-100);
    color: var(--green-700);
}

.badge-amber {
    background: var(--amber-100);
    color: var(--amber-700);
}

.badge-purple {
    background: var(--purple-100);
    color: var(--purple-700);
}

/* ============ PAGE NAV ============ */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--slate-200);
}

.page-nav-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    color: inherit;
    max-width: 48%;
}

.page-nav-item:hover {
    text-decoration: none;
}

.page-nav-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-400);
}

.page-nav-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--blue-600);
}

.page-nav-item.next {
    text-align: right;
}

/* ============ HOME HERO ============ */
.hero {
    background: linear-gradient(135deg, var(--slate-900) 0%, #1e3a8a 100%);
    border-radius: 16px;
    padding: 2.5rem;
    color: #fff;
    margin-bottom: 2.5rem;
}

.hero h1 {
    color: #fff;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    border: none;
}

.hero p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    margin: 0;
}

.hero .badge-hero {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.3em 0.8em;
    border-radius: 99px;
    display: inline-block;
    margin-bottom: 1rem;
}

/* ============ NAV ICONS ============ */
.nav-icon {
    display: none;
}

.nav-text {
    display: inline;
}



/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
    .docs-toc {
        display: none;
    }

    .docs-main {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    .docs-sidebar {
        display: none;
    }

    .docs-main {
        margin-left: 0;
        padding: 2rem 1.25rem;
    }

    .nav-icon {
        display: inline-block;
        font-size: 1.125rem;
    }

    .nav-text {
        display: none;
    }

    .docs-header nav {
        gap: 1rem;
    }

    .docs-header nav a.nav-link {
        font-size: 0;
        padding: 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .docs-header .btn-primary {
        padding: 0.625rem 1rem;
        border-radius: 9999px;
        width: auto;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .docs-header .btn-primary .nav-icon {
        font-size: 0.875rem;
        margin: 0;
    }
}