/* Willow Documentation  -  Dark Sidebar Theme */

:root {
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active: #0f3460;
    --sidebar-text: #c8c8d0;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 280px;
    --accent: #4fc3f7;
    --accent-dim: #2a8ab8;
    --content-bg: #fafafa;
    --content-text: #1a1a1a;
    --code-bg: #f0f0f0;
    --border: #e0e0e0;
    --header-height: 60px;
}

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

/* ── Shell (index.html) ── */

body.shell {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--sidebar-bg);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-header .tagline {
    font-size: 12px;
    color: var(--accent);
    margin-top: 4px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.sidebar-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-tab {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(200,200,208,0.55);
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.sidebar-tab:hover {
    color: rgba(200,200,208,0.9);
    border-color: rgba(255,255,255,0.15);
}

.sidebar-tab.active {
    color: var(--accent);
    background: rgba(79,195,247,0.1);
    border-color: rgba(79,195,247,0.25);
}

.sidebar-footer {
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer-link {
    font-size: 12px;
    color: rgba(200,200,208,0.55);
    text-decoration: none;
    transition: color 0.15s ease;
}

.sidebar-footer-link:hover {
    color: var(--accent);
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(200,200,208,0.5);
    padding: 12px 20px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.nav-section-title:hover {
    color: rgba(200,200,208,0.8);
}

.nav-section-title .chevron {
    font-size: 10px;
    transition: transform 0.2s ease;
}

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

.nav-section.collapsed .nav-items {
    display: none;
}

.nav-items {
    list-style: none;
}

.nav-item a {
    display: block;
    padding: 7px 20px 7px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item a.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Hamburger (mobile) */
.hamburger {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1000;
    background: var(--sidebar-bg);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    align-items: center;
    justify-content: center;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* Content frame */
.content-frame {
    flex: 1;
    border: none;
    background: var(--content-bg);
}

/* ── Viewer (viewer.html) ── */

body.viewer {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--content-bg);
    color: var(--content-text);
    line-height: 1.7;
    padding: 40px 48px 80px;
    max-width: 900px;
    margin: 0 auto;
}

body.viewer h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #111;
    border-bottom: 2px solid var(--border);
    padding-bottom: 12px;
}

body.viewer h2 {
    font-size: 24px;
    font-weight: 600;
    margin-top: 40px;
    margin-bottom: 12px;
    color: #222;
}

body.viewer h3 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 8px;
    color: #333;
}

body.viewer p {
    margin-bottom: 16px;
}

body.viewer a {
    color: var(--accent-dim);
    text-decoration: none;
}

body.viewer a:hover {
    text-decoration: underline;
}

body.viewer ul, body.viewer ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

body.viewer li {
    margin-bottom: 6px;
}

body.viewer code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: #c7254e;
}

body.viewer pre {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border);
}

body.viewer pre code {
    display: block;
    padding: 16px 20px;
    background: #282c34;
    color: #abb2bf;
    font-size: 13.5px;
    line-height: 1.6;
    border-radius: 8px;
}

body.viewer blockquote {
    border-left: 4px solid var(--accent);
    padding: 12px 16px;
    margin-bottom: 16px;
    background: rgba(79, 195, 247, 0.06);
    border-radius: 0 6px 6px 0;
    color: #444;
}

body.viewer table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}

body.viewer th {
    background: var(--code-bg);
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

body.viewer td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
}

body.viewer tr:hover td {
    background: rgba(0,0,0,0.02);
}

body.viewer hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

/* Example tables with thumbnails */
body.viewer table img {
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

body.viewer td {
    vertical-align: top;
}

body.viewer td code {
    font-size: 0.85em;
    white-space: nowrap;
}

/* highlight.js overrides for one-dark style consistency */
.hljs {
    background: #282c34 !important;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .sidebar.open {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .overlay.visible {
        display: block;
    }

    body.viewer {
        padding: 24px 20px 60px;
    }

    body.viewer h1 {
        font-size: 26px;
    }
}
