:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-accent: #2d3a58;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-dim: #94a3b8;
    --accent-color: #60a5fa;
    --accent-hover: #3b82f6;
    --code-bg: #293548;
    --border-color: #475569;
    --danger-color: #f43f5e;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-accent: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-dim: #64748b;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --code-bg: #e2e8f0;
    --border-color: #cbd5e1;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 40px;
    transition: transform 0.3s ease, background-color 0.3s, border-color 0.3s;
    z-index: 40;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 6px;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-secondary);
    z-index: 10;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    background-color: var(--accent-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    transition: background-color 0.3s;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar-version {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.nav-group {
    margin-top: 1.5rem;
}

.nav-group-title {
    padding: 0.4rem 1.5rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-links {
    list-style-type: none;
}

.nav-link {
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    background-color: var(--bg-accent);
}

.nav-link.active {
    border-left-color: var(--accent-color);
    background-color: var(--bg-accent);
    font-weight: 500;
}

.content {
    margin-left: 280px;
    width: calc(100% - 280px);
    padding: 2rem 2.5rem;
    min-height: 100vh;
    transition: margin-left 0.3s, width 0.3s, background-color 0.3s;
}

.breadcrumb {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--accent-color);
    text-decoration: none;
    white-space: nowrap;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

h1 {
    font-size: 2.25rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    scroll-margin-top: 2rem;
}

h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
    font-weight: 600;
    scroll-margin-top: 2rem;
}

h4 {
    font-size: 1.1rem;
    margin: 1.25rem 0 0.5rem;
    font-weight: 600;
    scroll-margin-top: 2rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    text-decoration: underline;
}

code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    transition: background-color 0.3s;
}

pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    transition: background-color 0.3s;
    position: relative;
}

pre code {
    background-color: transparent;
    padding: 0;
    display: block;
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}

pre:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background-color: var(--accent-color);
    color: white;
}

.illustration {
    width: 100%;
    margin: 1.5rem 0;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: box-shadow 0.3s;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 0.5rem;
    overflow: hidden;
}

thead {
    background-color: var(--bg-accent);
    transition: background-color 0.3s;
}

th, td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    transition: border-color 0.3s;
}

th {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    background-color: var(--bg-secondary);
    transition: background-color 0.3s;
}

tbody tr:hover {
    background-color: var(--bg-accent);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
    transition: background-color 0.3s, color 0.3s;
}

.badge-blue {
    background-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.badge-green {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.badge-red {
    background-color: rgba(244, 63, 94, 0.2);
    color: #fda4af;
}

.badge-yellow {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

[data-theme="light"] .badge-blue {
    background-color: rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

[data-theme="light"] .badge-green {
    background-color: rgba(16, 185, 129, 0.2);
    color: #047857;
}

[data-theme="light"] .badge-red {
    background-color: rgba(244, 63, 94, 0.2);
    color: #be123c;
}

[data-theme="light"] .badge-yellow {
    background-color: rgba(245, 158, 11, 0.2);
    color: #b45309;
}

.pros-cons {
    margin: 1.5rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.pros, .cons {
    padding: 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.pros {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.cons {
    background-color: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.pros h4, .cons h4 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

ul, ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

.tip-box {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--accent-color);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 0.5rem 0.5rem 0;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.tip-box-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.decision-chart {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.mobile-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    width: 3rem;
    height: 3rem;
    justify-content: center;
    align-items: center;
    z-index: 100;
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, background-color 0.3s, border-color 0.3s;
    box-shadow: 0 2px 4px var(--shadow-color);
    z-index: 30;
}

@media (max-width: 1024px) {
    .content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 50;
        box-shadow: 0 0 20px var(--shadow-color);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: flex;
    }

    .pros-cons {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 600px) {
    .content {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .table-container {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.5rem 0.75rem;
    }
}

.toc {
    position: fixed;
    right: 1rem;
    top: 6rem;
    width: 16rem;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.9rem;
    display: none;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: background-color 0.3s, box-shadow 0.3s;
    z-index: 20;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
}

.toc::-webkit-scrollbar {
    width: 5px;
}

.toc::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.toc::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 6px;
}

.toc-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    background-color: var(--bg-secondary);
    padding: 0.25rem 0;
    z-index: 10;
}

.toc-links {
    list-style: none;
    margin: 0;
}

.toc-link {
    padding: 0.3rem 0;
    border-left: 2px solid var(--border-color);
    padding-left: 0.75rem;
    margin-left: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.3;
    margin-bottom: 0.3rem;
}

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

.toc-link.active {
    border-left-color: var(--accent-color);
    color: var(--accent-color);
}

@media (min-width: 1400px) {
    .toc {
        display: block;
    }

    .content {
        margin-right: 18rem;
        width: calc(100% - 280px - 18rem);
    }
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background-color: var(--bg-accent);
    cursor: pointer;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    transition: background-color 0.3s;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.search-bar {
    margin-top: 1rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-accent);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: 0 4px 6px var(--shadow-color);
    display: none;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: var(--bg-accent);
}

.search-result-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.search-result-snippet {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.metric-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.metric-card {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

.metric-title {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.metric-chart {
    flex-grow: 1;
    min-height: 80px;
}

/* New sections */
.db-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.db-example {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.db-example:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

.db-logo {
    height: 40px;
    width: auto;
    margin-bottom: 1rem;
    filter: brightness(0) invert(1);
    opacity: 0.9;
    transition: opacity 0.3s;
}

[data-theme="light"] .db-logo {
    filter: none;
    opacity: 1;
}

.db-example h4 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted var(--text-dim);
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 240px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
    border-radius: 6px;
    padding: 0.75rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 4px 6px var(--shadow-color);
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid var(--border-color);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.faq-section {
    margin: 2rem 0;
}

.faq-item {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.faq-item:hover {
    box-shadow: 0 4px 6px var(--shadow-color);
}

.faq-question {
    padding: 1rem 1.5rem;
    background-color: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: background-color 0.3s;
}

.faq-question:hover {
    background-color: var(--bg-accent);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background-color: var(--bg-secondary);
}

.faq-answer.active {
    padding: 1rem 1.5rem;
    max-height: 500px;
}

.chevron {
    transition: transform 0.3s;
}

.faq-question.active .chevron {
    transform: rotate(180deg);
}

.decision-helper {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.decision-step {
    margin-bottom: 1.5rem;
}

.decision-step-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.decision-step-title .step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
}

.decision-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.decision-option {
    padding: 0.5rem 1rem;
    background-color: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.decision-option:hover, .decision-option.selected {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.decision-result {
    padding: 1rem;
    background-color: var(--bg-accent);
    border-radius: 0.5rem;
    margin-top: 1rem;
    display: none;
}

.print-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-bottom: 1.5rem;
}

.print-button:hover {
    background-color: var(--bg-accent);
}

.summary-section {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.summary-section h2 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.summary-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.summary-card {
    background-color: var(--bg-accent);
    border-radius: 0.5rem;
    padding: 1.25rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

.summary-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media print {
    .sidebar, .mobile-toggle, .to-top, .toc, .theme-toggle, .print-button {
        display: none !important;
    }

    .content {
        margin: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    body {
        background-color: white;
        color: black;
    }

    h1, h2, h3, h4, .text-primary {
        color: black;
    }

    .illustration, .decision-chart, .pros, .cons, .tip-box, .metric-card,
    .db-example, .summary-section, .summary-card, .faq-item, table, thead, tbody tr {
        background-color: white !important;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    .badge-blue, .badge-green, .badge-red, .badge-yellow {
        background-color: white !important;
        color: black !important;
        border: 1px solid #ddd !important;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    @page {
        margin: 2cm;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}