/* ============================================
    CSS VARIABLES & RESET
    ============================================ */
:root {
    --primary: #42b883;
    --primary-dark: #369870;
    --text: #2c3e50;
    --text-light: #476582;
    --bg: #ffffff;
    --bg-sidebar: #f6f6f7;
    --bg-code: #f8f8f8;
    --border: #e2e2e3;
    --shadow: rgba(0, 0, 0, 0.04);
    --search-highlight: #ffff00;
    --sidebar-width: 280px;
    --header-height: 70px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", Consolas, Monaco, "Andale Mono", monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
    LAYOUT STRUCTURE
    ============================================ */
.page-wrapper {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
}

/* Main Global Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px var(--shadow);
    transition: transform 0.3s ease-in-out;
}

.main-header.header-hidden {
    transform: translateY(-100%);
}

.header-nav {
    display: flex;
    gap: 1.5rem;
}

.header-nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.header-nav-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.header-nav-link.active {
    color: var(--primary);
    font-weight: 700;
}

.header-nav-link.active::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: var(--primary);
    margin-top: 2px;
}

/* Header (Mobile Only Toggle) */
.header {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1001;
    padding: 0 1.5rem;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Mobile Menu Toggle */
.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    transition: 0.3s;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 1rem 0;
    z-index: 50;
    transition: top 0.3s ease-in-out, height 0.3s ease-in-out;
}

.header-hidden~.page-wrapper .sidebar {
    top: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar .logo {
    margin-bottom: 1rem;
    display: flex;
}

.search-container {
    position: relative;
    margin-top: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(66, 184, 131, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.9rem;
}

.clear-search {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: none;
    font-size: 1.1rem;
    padding: 0.2rem;
}

.clear-search.visible {
    display: block;
}

/* Navigation */
.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    padding: 0.6rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-top: 1rem;
}

.nav-link {
    display: block;
    padding: 0.1rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(66, 184, 131, 0.05);
}

.nav-link.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: rgba(66, 184, 131, 0.08);
    font-weight: 600;
}

.nav-link.hidden {
    display: none;
}

.nav-link.highlight {
    background: rgba(255, 255, 0, 0.2);
}

/* Nested Navigation */
.nav-children {
    margin-left: 0.5rem;
    border-left: 1px solid var(--border);
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
}

.nav-children .nav-link {
    padding-left: 1.5rem;
    font-size: 0.8rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem 4rem;
    max-width: 900px;
    width: 100%;
}

/* Content Typography */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    scroll-margin-top: 2rem;
}

h1 {
    font-size: 2.2rem;
    margin-top: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

h2 {
    font-size: 1.65rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-top: 3rem;
}

h3 {
    font-size: 1.35rem;
    margin-top: 2rem;
}

.content-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
    color: var(--text-light);
    font-size: 0.9rem;
}

p {
    margin-bottom: 1.2rem;
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
}

header a:hover {
    text-decoration: none;
}

/* Lists */
ul,
ol {
    margin-bottom: 1.2rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Code Blocks */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-code);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #d63200;
}

pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.2rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
    position: relative;
}

pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
    border-radius: 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 1rem;
    background: #2d2d2d;
    border-radius: 8px 8px 0 0;
    font-size: 0.8rem;
    color: #858585;
    margin-bottom: 0rem;
    font-family: var(--font-sans);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #858585;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
    outline: none;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.copy-btn.copied {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.code-header+pre {
    border-radius: 0 0 8px 8px;
    margin-top: 0;
}

/* Syntax Highlighting Classes */
.keyword {
    color: #569cd6;
}

.string {
    color: #ce9178;
}

.function {
    color: #dcdcaa;
}

.comment {
    color: #6a9955;
}

.number {
    color: #b5cea8;
}

.operator {
    color: #d4d4d4;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

th,
td {
    text-align: left;
    padding: 0.8rem;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-sidebar);
    font-weight: 600;
}

tr:hover {
    background: var(--bg-sidebar);
}

/* Blockquote */
blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-light);
    font-style: italic;
}

/* Info Boxes */
.tip,
.warning {
    padding: 1rem 1.2rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.tip {
    background: rgba(66, 184, 131, 0.1);
    border-left: 4px solid var(--primary);
}

.warning {
    background: rgba(255, 197, 23, 0.1);
    border-left: 4px solid #ffc517;
}

.tip-title,
.warning-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Results Overlay */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 200;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-sidebar);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.2rem;
}

.search-result-preview {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-light);
}

/* Overlay for mobile */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.overlay.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-header .header-nav {
        display: none;
    }

    .header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        background: var(--bg);
        padding-top: 1rem;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 5rem 1.5rem 2rem;
        max-width: 100%;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    pre {
        font-size: 0.85rem;
        padding: 1rem;
    }
}

/* Buttons and Utilities */
.flx {
    display: flex;
}

.aic {
    align-items: center;
}

.jcc {
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.mt-5 {
    margin-top: 3rem;
}

.w-100 {
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-family: var(--font-sans);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 184, 131, 0.2);
}

/* Print styles */
@media print {

    .sidebar,
    .main-header,
    .header {
        display: none;
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
    }
}

/* Changelog Styles */
.version-item {
    margin-bottom: 3rem;
}

.version-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.version-number {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.version-date {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 400;
}

.changelog-category {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1.5rem 0 0.5rem;
    display: block;
}

.category-added {
    color: var(--primary);
}

.category-notes {
    color: #6e7781;
}

/* Roadmap Styles */
.roadmap-section {
    margin-bottom: 2.5rem;
}

.roadmap-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 2rem;
}

.secondary-roadmap {
    opacity: 0.8;
}

.out-of-scope {
    background: #fdf2f2;
    border-color: #f8d7da;
    color: #842029;
}

/* FAQ Styles */
.faq-section {
    margin-bottom: 3rem;
}

.faq-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.8rem;
    display: block;
}

.faq-answer {
    color: var(--text-light);
    line-height: 1.6;
}

/* Smooth transitions */
.nav-link,
.search-result-item,
.menu-toggle,
.btn {
    transition: all 0.2s ease;
}