/* ═══════════════════════════════════════════════════════════
   MATERIAL DESIGN 3 - NIMBUS DOCS THEME
   ═══════════════════════════════════════════════════════════ */

:root {
    /* LIGHT MODE TOKENS */
    --md-sys-color-primary: #006492;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #cae6ff;
    --md-sys-color-on-primary-container: #001e30;
    
    --md-sys-color-background: #fdfcff;
    --md-sys-color-on-background: #1a1c1e;
    
    --md-sys-color-surface: #fdfcff;
    --md-sys-color-surface-container: #f0f4f8; /* Sidebar/Card BG */
    --md-sys-color-on-surface: #1a1c1e;
    --md-sys-color-on-surface-variant: #42474e;
    
    --md-sys-color-outline: #72777f;
    --md-sys-color-outline-variant: #c2c7cf;

    /* Code Blocks */
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
    
    /* Dimensions */
    --sidebar-width: 280px;
    --top-bar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

[data-theme="dark"] {
    /* DARK MODE TOKENS */
    --md-sys-color-primary: #8aceff;
    --md-sys-color-on-primary: #00344f;
    --md-sys-color-primary-container: #004b6f;
    --md-sys-color-on-primary-container: #cae6ff;
    
    --md-sys-color-background: #1a1c1e;
    --md-sys-color-on-background: #e2e2e6;
    
    --md-sys-color-surface: #1a1c1e;
    --md-sys-color-surface-container: #202429; /* Darker Surface */
    --md-sys-color-on-surface: #e2e2e6;
    --md-sys-color-on-surface-variant: #c2c7cf;
    
    --md-sys-color-outline: #8c9199;
    --md-sys-color-outline-variant: #42474e;

    --code-bg: #0d0d0d;
}

/* RESET & BASE */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* LAYOUT */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--md-sys-color-surface-container);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    z-index: 100;
}

.sidebar-header {
    height: var(--top-bar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
}

.logo-icon { font-size: 28px; }

.version-control {
    padding: 0 16px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.version-control label {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-left: 8px;
    display: block;
    margin-bottom: 4px;
}

.select-wrapper {
    position: relative;
    background: var(--md-sys-color-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.select-wrapper select {
    width: 100%;
    padding: 10px 16px;
    appearance: none;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--md-sys-color-on-surface-variant);
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.nav-group { margin-bottom: 24px; }

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    padding: 0 16px;
    margin-bottom: 8px;
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 100px; /* Full pill shape */
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--md-sys-color-on-surface);
}

[data-theme="dark"] .nav-link:hover { background-color: rgba(255, 255, 255, 0.05); }

.nav-link.active {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* MAIN CONTENT WRAPPER */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* TOP BAR */
.top-bar {
    height: var(--top-bar-height);
    background-color: var(--md-sys-color-background);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.top-bar-left, .top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title {
    font-size: 18px;
    font-weight: 500;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

.menu-btn, .close-sidebar-btn { display: none; }

/* CONTENT AREA */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
    scroll-behavior: smooth;
}

.content-container {
    max-width: 860px;
    margin: 0 auto;
}

/* TYPOGRAPHY & ELEMENTS */
h1 {
    font-size: 44px;
    font-weight: 400;
    margin-bottom: 16px;
    color: var(--md-sys-color-on-background);
}

h2 {
    font-size: 28px;
    font-weight: 400;
    margin: 48px 0 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

p { margin-bottom: 16px; font-size: 16px; color: var(--md-sys-color-on-surface-variant); }

.lead {
    font-size: 20px;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 32px;
}

.badge {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.5em;
    vertical-align: middle;
    font-weight: 700;
}

.divider {
    border: none;
    height: 1px;
    background: var(--md-sys-color-outline-variant);
    margin: 40px 0;
}

/* CARDS */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.card {
    background: var(--md-sys-color-surface-container);
    padding: 24px;
    border-radius: var(--radius-md);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: var(--md-sys-color-outline-variant);
}

.card-icon { font-size: 32px; margin-bottom: 16px; }
.card h3 { font-size: 18px; margin-bottom: 8px; }
.card p { font-size: 14px; margin: 0; }

/* CALLOUTS */
.callout {
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 16px;
    margin: 24px 0;
}

.callout-info {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* CODE BLOCKS */
.code-block {
    background: var(--code-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 24px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-lang {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

.copy-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.copy-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

pre {
    padding: 20px;
    overflow-x: auto;
    margin: 0;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--code-text);
}

/* NAVIGATION FOOTER */
.navigation-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 64px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--md-sys-color-surface-container);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.nav-text { display: flex; flex-direction: column; text-align: right; }
.nav-subtitle { font-size: 12px; opacity: 0.7; }
.nav-title { font-weight: 700; font-size: 16px; }

/* DARK/LIGHT TOGGLE ICONS */
[data-theme="dark"] .theme-icon-light { display: block; }
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: block; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100%;
        width: 100%; /* Fullscreen on mobile */
        max-width: 300px;
        box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    }

    .sidebar.open { left: 0; }
    .menu-btn, .close-sidebar-btn { display: flex; }
    .top-bar { padding: 0 16px; }
    
    h1 { font-size: 32px; }
    .content { padding: 24px 16px; }
}
