/* mq Theme - Matching docs/index.html styling */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    /* mq brand colors from index.html */
    --mq-bg-primary: #2a3444;
    --mq-bg-secondary: #2a3444;
    --mq-bg-tertiary: #3d4a5c;
    --mq-text-primary: #e2e8f0;
    --mq-text-secondary: #cbd5e1;
    --mq-text-muted: #94a3b8;
    --mq-accent-primary: #67b8e3;
    --mq-accent-secondary: #4fc3f7;
    --mq-border-default: #4a5568;
    --mq-border-muted: #374151;
    --mq-code-bg: #1e293b;
    --mq-code-bg-inline: #374151;

    /* Light theme - keeping a lighter version for accessibility */
    --bg: #ffffff;
    --fg: #333333;
    --sidebar-bg: #f8fafc;
    --sidebar-fg: #364149;
    --sidebar-non-existent: #aaaaaa;
    --sidebar-active: var(--mq-accent-primary);
    --sidebar-spacer: #e2e8f0;
    --scrollbar: #cccccc;
    --icons: #747474;
    --icons-hover: var(--mq-accent-primary);
    --links: var(--mq-accent-primary);
    --inline-code-color: #2a3444;
    --theme-popup-bg: #fafafa;
    --theme-popup-border: #cccccc;
    --theme-hover: #e6e6e6;
    --quote-bg: #f1f5f9;
    --quote-border: var(--mq-accent-primary);
    --table-border-color: #cbd5e1;
    --table-header-bg: #e2e8f0;
    --table-alternate-bg: #f8fafc;
    --searchbar-border-color: #cccccc;
    --searchbar-bg: #ffffff;
    --searchbar-fg: #333333;
    --searchbar-shadow-color: rgba(0, 0, 0, 0.1);
    --searchresults-header-fg: #666666;
    --searchresults-border-color: #cccccc;
    --searchresults-li-bg: #ffffff;
    --search-mark-bg: var(--mq-accent-secondary);
    --color-scheme: light;
    --content-max-width: 1024px;
}

.navy {
    /* Dark theme - matching index.html */
    --bg: var(--mq-bg-primary);
    --fg: var(--mq-text-primary);
    --sidebar-bg: var(--mq-bg-primary);
    --sidebar-fg: var(--mq-text-secondary);
    --sidebar-non-existent: var(--mq-text-muted);
    --sidebar-active: var(--mq-accent-primary);
    --sidebar-spacer: var(--mq-border-muted);
    --scrollbar: var(--mq-border-default);
    --icons: var(--mq-text-muted);
    --icons-hover: var(--mq-accent-primary);
    --links: var(--mq-accent-primary);
    --inline-code-color: var(--mq-accent-primary);
    --theme-popup-bg: var(--mq-code-bg);
    --theme-popup-border: var(--mq-border-default);
    --theme-hover: var(--mq-bg-tertiary);
    --quote-bg: var(--mq-code-bg);
    --quote-border: var(--mq-accent-primary);
    --table-border-color: var(--mq-border-default);
    --table-header-bg: var(--mq-bg-tertiary);
    --table-alternate-bg: var(--mq-code-bg);
    --searchbar-border-color: var(--mq-border-default);
    --searchbar-bg: var(--mq-code-bg);
    --searchbar-fg: var(--mq-text-primary);
    --searchbar-shadow-color: rgba(0, 0, 0, 0.3);
    --searchresults-header-fg: var(--mq-text-muted);
    --searchresults-border-color: var(--mq-border-default);
    --searchresults-li-bg: var(--mq-code-bg);
    --search-mark-bg: var(--mq-accent-primary);
    --color-scheme: dark;
}

/* Global font family */
html {
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans", Helvetica, Arial, sans-serif;
}

body {
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans", Helvetica, Arial, sans-serif;
}

/* Header styling */
#menu-bar {
    background-color: var(--bg);
    border-bottom: 1px solid var(--mq-border-default);
}

.menu-title {
    color: var(--fg) !important;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans", Helvetica, Arial, sans-serif;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.02em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: inline-block;
}

.menu-title:hover {
    color: var(--mq-accent-primary) !important;
    transform: translateY(-1px);
    text-shadow: 0 2px 8px rgba(103, 184, 227, 0.2);
}

.menu-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--mq-accent-primary), var(--mq-accent-secondary));
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-title:hover::after {
    width: 100%;
}

/* Subtle fade-in animation on page load */
@keyframes titleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-title {
    animation: titleFadeIn 0.6s ease-out;
}

/* Sidebar enhancements */
.sidebar {
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--mq-border-default);
}

.sidebar .sidebar-scrollbox {
    padding-top: 0px;
}

.chapter-item {
    padding: 5px 15px;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans", Helvetica, Arial, sans-serif;
}

.chapter-item.expanded>.toggle {
    color: var(--mq-accent-primary);
}

.chapter-item>a.active {
    color: var(--mq-accent-primary);
}

.chapter-item>a:hover {
    background-color: var(--theme-hover);
    border-radius: 4px;
}

/* Content styling */
.page {
    background-color: var(--bg);
    color: var(--fg);
}

.content {
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans", Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--mq-accent-primary);
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans", Helvetica, Arial, sans-serif;
    font-weight: 700;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 2.4rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Links */
a {
    color: var(--links);
    transition: color 0.2s;
}

a:hover {
    color: var(--mq-accent-secondary);
    text-decoration: underline;
}

/* Code blocks */
pre {
    background-color: var(--quote-bg);
    border: 1px solid var(--mq-border-default);
    border-radius: 8px;
    padding: 1rem;
}

code {
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    background-color: var(--quote-bg);
    color: var(--inline-code-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.9em;
}

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

/* Blockquotes */
blockquote {
    background-color: var(--quote-bg);
    border-left: 4px solid var(--quote-border);
    margin: 20px 0;
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
}

/* Tables */
table {
    border-collapse: collapse;
    margin: 20px 0;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

table th {
    background-color: var(--table-header-bg);
    border: 1px solid var(--table-border-color);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
}

table td {
    border: 1px solid var(--table-border-color);
    padding: 10px 14px;
}

table tbody tr:nth-child(even) {
    background-color: var(--table-alternate-bg);
}

table tbody tr:hover {
    background-color: var(--theme-hover);
}

/* Search styling */
#searchbar {
    border: 1px solid var(--searchbar-border-color);
    background-color: var(--searchbar-bg);
    color: var(--searchbar-fg);
    border-radius: 8px;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans", Helvetica, Arial, sans-serif;
}

#searchbar:focus {
    border-color: var(--mq-accent-primary);
    box-shadow: 0 0 0 2px rgba(103, 184, 227, 0.2);
}

/* Navigation buttons */
.nav-chapters {
    background-color: var(--bg);
}

.nav-chapters a {
    color: var(--mq-accent-primary);
    background-color: var(--theme-hover);
    border-radius: 8px;
    padding: 10px 14px;
    transition: all 0.3s;
}

.nav-chapters a:hover {
    background-color: var(--mq-accent-primary);
    color: var(--mq-code-bg);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(103, 184, 227, 0.35);
    transform: translateY(-2px);
}

/* Custom logo styling in sidebar */
.sidebar .sidebar-scrollbox::before {
    content: "";
    display: block;
    width: 60px;
    height: 60px;
    margin: 10px auto 20px;
    background-image: url("../images/logo.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Icon buttons */
.icon-button {
    transition: all 0.2s;
}

.icon-button:hover {
    color: var(--mq-accent-primary) !important;
}

/* Theme toggle popup */
#theme-list {
    border-radius: 8px;
    border: 1px solid var(--mq-border-default);
}

#theme-list li:hover {
    background-color: var(--theme-hover);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar .sidebar-scrollbox::before {
        width: 40px;
        height: 40px;
        margin: 5px auto 10px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }
}

/* Print styles */
@media print {
    .sidebar .sidebar-scrollbox::before {
        display: none;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--mq-accent-primary);
}

/* Selection color */
::selection {
    background-color: var(--mq-border-default);
    color: var(--mq-text-primary);
}

/* ===========================================
   Syntax Highlighting - Matching index.html
   =========================================== */

/* Code block base styles */
.hljs {
    display: block;
    overflow-x: auto;
    background: var(--mq-code-bg) !important;
    color: var(--mq-text-primary);
    padding: 1rem;
    border-radius: 8px;
}

/* Light theme overrides */
:root .hljs {
    background: #f1f5f9 !important;
    color: #333333;
}

/* Dark theme (navy) - matching index.html */
.navy .hljs {
    background: var(--mq-code-bg) !important;
    color: var(--mq-text-primary);
}

/* Comment */
.navy .hljs-comment,
.navy .hljs-quote {
    color: var(--mq-text-muted);
    font-style: italic;
}

/* Keywords - accent blue */
.navy .hljs-keyword,
.navy .hljs-selector-tag,
.navy .hljs-addition {
    color: #67b8e3;
}

/* Strings - green */
.navy .hljs-string,
.navy .hljs-value,
.navy .hljs-symbol,
.navy .hljs-bullet,
.navy .hljs-inheritance,
.navy .hljs-name,
.navy .ruby .hljs-symbol,
.navy .xml .hljs-cdata {
    color: #34d399;
}

/* Numbers - accent blue */
.navy .hljs-number,
.navy .hljs-literal,
.navy .hljs-constant {
    color: #67b8e3;
}

/* Functions - purple */
.navy .hljs-title,
.navy .hljs-section,
.navy .hljs-function,
.navy .python .hljs-decorator,
.navy .python .hljs-title,
.navy .ruby .hljs-function .hljs-title,
.navy .javascript .hljs-title,
.navy .coffeescript .hljs-title {
    color: #a78bfa;
}

/* Variables - orange */
.navy .hljs-variable,
.navy .hljs-template-variable,
.navy .hljs-attribute,
.navy .hljs-attr,
.navy .hljs-tag,
.navy .hljs-regexp,
.navy .hljs-link,
.navy .hljs-selector-id,
.navy .hljs-selector-class {
    color: #fb923c;
}

/* Types & Built-ins */
.navy .hljs-type,
.navy .hljs-built_in,
.navy .hljs-builtin-name,
.navy .hljs-params {
    color: #4fc3f7;
}

/* Meta & Preprocessor */
.navy .hljs-meta,
.navy .hljs-preprocessor,
.navy .hljs-pragma {
    color: var(--mq-text-muted);
}

/* Deletion */
.navy .hljs-deletion {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

/* Addition */
.navy .hljs-addition {
    color: #34d399;
    background-color: rgba(52, 211, 153, 0.1);
}

/* Emphasis */
.navy .hljs-emphasis {
    font-style: italic;
}

.navy .hljs-strong {
    font-weight: bold;
}

/* Light theme syntax highlighting */
:root .hljs-comment,
:root .hljs-quote {
    color: #6b7280;
    font-style: italic;
}

:root .hljs-keyword,
:root .hljs-selector-tag {
    color: #2563eb;
}

:root .hljs-string,
:root .hljs-value,
:root .hljs-symbol,
:root .hljs-bullet,
:root .hljs-name {
    color: #059669;
}

:root .hljs-number,
:root .hljs-literal,
:root .hljs-constant {
    color: #2563eb;
}

:root .hljs-title,
:root .hljs-section,
:root .hljs-function {
    color: #7c3aed;
}

:root .hljs-variable,
:root .hljs-template-variable,
:root .hljs-attribute,
:root .hljs-attr,
:root .hljs-tag {
    color: #ea580c;
}

:root .hljs-type,
:root .hljs-built_in,
:root .hljs-builtin-name,
:root .hljs-params {
    color: #0891b2;
}

/* Code block container adjustments */
.navy pre {
    background-color: var(--mq-code-bg) !important;
    border: 1px solid var(--mq-border-default);
}

.navy code {
    background-color: var(--mq-code-bg-inline);
    color: var(--mq-accent-primary);
}

.navy pre code {
    background-color: transparent;
    color: inherit;
}
