/* ELONIQ Handbook — Custom Styles */

:root {
    --sidebar-width: 272px;
    --navbar-height: 56px;
    --sidebar-bg: #0f1117;
    --sidebar-border: #1e2130;
    --sidebar-text: #8b92a5;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-active-bg: rgba(59, 130, 246, 0.12);
    --sidebar-active-text: #60a5fa;
    --sidebar-cat-text: #4b5568;
    --content-bg: #ffffff;
    --header-bg: #ffffff;
    --header-border: #e5e7eb;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --text-primary: #111827;
    --text-muted: #6b7280;
    --card-border: #e5e7eb;
    --card-hover-shadow: 0 4px 12px rgba(0,0,0,0.08);
    --toc-border: #e5e7eb;
    --badge-config-bg: #fef3c7;
    --badge-config-text: #92400e;
}

/* ── Base ─────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    background: #f9fafb;
    margin: 0;
}

/* ── Top Navbar ───────────────────────────────────────────────────────── */

.handbook-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--navbar-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.navbar-brand .brand-icon {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.navbar-brand .brand-label {
    color: var(--text-primary);
}

.navbar-brand .brand-sub {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.875rem;
}

.navbar-spacer { flex: 1; }

.lang-switcher {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.lang-btn {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.lang-btn:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ── Layout ───────────────────────────────────────────────────────────── */

.handbook-layout {
    display: flex;
    min-height: calc(100vh - var(--navbar-height));
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */

.handbook-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #2d3748 transparent;
}

.handbook-sidebar::-webkit-scrollbar { width: 4px; }
.handbook-sidebar::-webkit-scrollbar-track { background: transparent; }
.handbook-sidebar::-webkit-scrollbar-thumb { background: #2d3748; border-radius: 2px; }

.sidebar-inner { padding: 1rem 0 2rem; }

.sidebar-home {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    margin: 0 0.5rem 0.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.15s;
}

.sidebar-home:hover, .sidebar-home.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.sidebar-section {
    margin-top: 1rem;
}

.sidebar-cat-label {
    padding: 0.25rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-cat-text);
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    margin: 0 0.5rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.05);
    color: var(--sidebar-text-hover);
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.sidebar-link i {
    font-size: 0.875rem;
    width: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active i { opacity: 1; }

/* ── Content ──────────────────────────────────────────────────────────── */

.handbook-content {
    flex: 1;
    min-width: 0;
    background: var(--content-bg);
}

.content-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────── */

.handbook-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.handbook-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.handbook-breadcrumb a:hover { color: var(--accent); }

.handbook-breadcrumb .sep { opacity: 0.4; }

/* ── Hero (Index) ─────────────────────────────────────────────────────── */

.hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    border-radius: 12px;
    padding: 3rem 2.5rem;
    margin-bottom: 2.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(59,130,246,0.2);
    border: 1px solid rgba(59,130,246,0.3);
    color: #93c5fd;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
    line-height: 1.2;
}

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

/* ── Section heading ──────────────────────────────────────────────────── */

.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

/* ── Category Cards ───────────────────────────────────────────────────── */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.category-card {
    display: block;
    text-decoration: none;
    background: white;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1.25rem;
    transition: all 0.15s;
    color: var(--text-primary);
}

.category-card:hover {
    border-color: #bfdbfe;
    box-shadow: var(--card-hover-shadow);
    color: var(--text-primary);
}

.category-card-icon {
    width: 40px;
    height: 40px;
    background: #eff6ff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.category-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
}

.category-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.category-card .module-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: #f3f4f6;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
}

/* ── Module Cards ─────────────────────────────────────────────────────── */

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.module-card {
    display: block;
    text-decoration: none;
    background: white;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.15s;
    color: var(--text-primary);
}

.module-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    color: var(--text-primary);
}

.module-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.module-card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.module-card p {
    font-size: 0.775rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

.mod-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 100px;
    background: #eff6ff;
    color: #1d4ed8;
    white-space: nowrap;
}

/* ── Module Detail ────────────────────────────────────────────────────── */

.module-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.module-icon-lg {
    width: 52px;
    height: 52px;
    background: #eff6ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
    flex-shrink: 0;
}

.module-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    line-height: 1.2;
}

.module-header .subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.module-intro {
    font-size: 1rem;
    color: #374151;
    line-height: 1.7;
    margin-bottom: 2rem;
}

/* ── Detail Layout (content + TOC) ───────────────────────────────────── */

.detail-layout {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
}

.detail-body { flex: 1; min-width: 0; }

.detail-toc {
    width: 180px;
    min-width: 180px;
    position: sticky;
    top: calc(var(--navbar-height) + 1.5rem);
}

.toc-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.toc-nav a {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.2rem 0 0.2rem 0.75rem;
    border-left: 2px solid var(--toc-border);
    line-height: 1.4;
    transition: all 0.15s;
}

.toc-nav a:hover {
    color: var(--accent);
    border-left-color: var(--accent);
}

/* ── Section ──────────────────────────────────────────────────────────── */

.handbook-section {
    margin-bottom: 2.5rem;
}

.handbook-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--card-border);
}

.handbook-section h2 i {
    color: var(--accent);
    font-size: 1rem;
}

.handbook-section .section-body {
    font-size: 0.9rem;
    line-height: 1.75;
    color: #374151;
}

.handbook-section .section-body ul,
.handbook-section .section-body ol {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.handbook-section .section-body li { margin-bottom: 0.35rem; }

.handbook-section .section-body code {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: "Fira Code", "Cascadia Code", monospace;
}

.handbook-section .section-body pre {
    background: #0f1117;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.6;
}

.handbook-section .section-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

/* ── Quickstart cards ─────────────────────────────────────────────────── */

.quickstart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.qs-card {
    background: #f9fafb;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
}

.qs-step {
    display: inline-flex;
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.qs-card h4 { font-size: 0.85rem; font-weight: 600; margin: 0 0 0.3rem; }
.qs-card p  { font-size: 0.78rem; color: var(--text-muted); margin: 0; line-height: 1.5; }

/* ── Footer ───────────────────────────────────────────────────────────── */

.handbook-footer {
    background: var(--sidebar-bg);
    border-top: 1px solid var(--sidebar-border);
    padding: 1.25rem 2rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--sidebar-cat-text);
    margin-top: auto;
}

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

@media (max-width: 1024px) {
    .detail-toc { display: none; }
}

@media (max-width: 768px) {
    .handbook-sidebar { display: none; }
    .content-inner { padding: 1.5rem 1rem; }
    .hero { padding: 2rem 1.5rem; }
    .hero h1 { font-size: 1.5rem; }
    .cards-grid { grid-template-columns: 1fr 1fr; }
    .quickstart-grid { grid-template-columns: 1fr; }
}

/* ── Print ────────────────────────────────────────────────────────────── */

@media print {
    .handbook-sidebar, .handbook-navbar, .lang-switcher, .detail-toc { display: none !important; }
    .hero { background: none; color: #000; }
}
