/**
 * Questmo FAQ - Custom Sphinx Theme
 * Matching the Questmo Landing Page Design System
 *
 * Color Palette from Flutter AppColors
 * Typography: Fredoka One (headings) + Nunito (body)
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */

:root {
    /* Primary Colors */
    --primary-blue: #2196F3;
    --primary-blue-dark: #1976D2;
    --primary-light: #64B5F6;
    --primary-dark: #0D47A1;

    /* Secondary Colors */
    --secondary-orange: #FF9800;
    --secondary-variant: #FFA726;
    --secondary-light: #FFB74D;
    --secondary-dark: #FF6D00;

    /* Gaming & Achievement Colors */
    --success-green: #4CAF50;
    --quest-green: #00E676;
    --error-red: #B00020;
    --warning-orange: #FFC107;
    --xp-purple: #9C27B0;
    --level-up-pink: #E91E63;
    --highlight-pink: #FF4081;
    --gold-color: #FFD700;
    --epic-purple: #7C4DFF;
    --energy-yellow: #FFEB3B;

    /* Light Mode Colors */
    --background-light: #FAFAFA;
    --surface-light: #FFFFFF;
    --text-light: #000000;
    --text-muted-light: rgba(0, 0, 0, 0.60);
    --border-light: rgba(0, 0, 0, 0.12);

    /* Dark Mode Colors */
    --background-dark: #121212;
    --surface-dark: #1E1E1E;
    --text-dark: #FFFFFF;
    --text-muted-dark: rgba(255, 255, 255, 0.60);
    --border-dark: rgba(255, 255, 255, 0.12);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2196F3, #0D47A1, #7C4DFF);
    --gradient-secondary: linear-gradient(135deg, #FF9800, #FFA726);
    --gradient-quest: linear-gradient(135deg, #2196F3, #00E676);
    --gradient-reward: linear-gradient(135deg, #FFD700, #FF6D00);
    --gradient-xp: linear-gradient(135deg, #9C27B0, #7C4DFF);
    --gradient-level-up: linear-gradient(135deg, #E91E63, #FF6D00, #FFD700);
    --gradient-gold: linear-gradient(135deg, #FFD700, #FFA000, #FF8F00);
    --gradient-silver: linear-gradient(135deg, #E8EAF6, #9FA8DA, #5C6BC0);
    --gradient-bronze: linear-gradient(135deg, #FFCC80, #FF8A65, #FF5722);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Typography */
    --font-display: 'Fredoka One', cursive;
    --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'Fira Code', 'JetBrains Mono', Consolas, monospace;
}

/* Light Theme (Default) */
[data-theme="light"],
:root {
    --bg-color: var(--background-light);
    --surface-color: var(--surface-light);
    --text-color: var(--text-light);
    --text-muted: var(--text-muted-light);
    --border-color: var(--border-light);
    --sidebar-bg: var(--surface-light);
    --code-bg: #f5f7f9;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-color: var(--background-dark);
    --surface-color: var(--surface-dark);
    --text-color: var(--text-dark);
    --text-muted: var(--text-muted-dark);
    --border-color: var(--border-dark);
    --sidebar-bg: #1a1a1a;
    --code-bg: #2d2d2d;
}

/* ============================================
   Custom Scrollbar (matching landing page)
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 5px;
}

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

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-blue) var(--bg-color);
}

/* ============================================
   Base Styles & Typography
   ============================================ */

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body) !important;
    font-size: 16px;
    line-height: 1.7;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Headings - Fredoka One */
h1, h2, h3,
.rst-content h1,
.rst-content h2,
.rst-content h3 {
    /* font-family: var(--font-display) !important; */
    font-weight: 400 !important;
    color: var(--primary-blue);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
}

h4, h5, h6,
.rst-content h4,
.rst-content h5,
.rst-content h6 {
    font-family: var(--font-body) !important;
    font-weight: 700 !important;
    color: var(--text-color);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

h1, .rst-content h1 { font-size: 2.5rem; }
h2, .rst-content h2 { font-size: 2rem; }
h3, .rst-content h3 { font-size: 1.5rem; }
h4, .rst-content h4 { font-size: 1.25rem; }
h5, .rst-content h5 { font-size: 1.1rem; }
h6, .rst-content h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-blue-dark);
    text-decoration: underline;
}

/* ============================================
   RTD Theme Overrides - Navigation
   ============================================ */

/* Sidebar */
.wy-side-nav-search {
    background: var(--gradient-primary) !important;
    padding: var(--spacing-lg);
}

.wy-side-nav-search .wy-dropdown > a,
.wy-side-nav-search > a {
    color: white !important;
    /* font-family: var(--font-display) !important; */
    font-size: 1.5rem;
    padding: 0 !important;
}

.wy-side-nav-search > a:hover {
    background: transparent !important;
}

/* Questmo site name link - positioned at the top */
.questmo-site-name-link {
    display: block !important;
    text-align: center;
    padding: 0 !important;
    margin-bottom: 20px !important;
    transition: transform var(--transition-fast);
}

.questmo-site-name-link:hover {
    background: transparent !important;
    transform: scale(1.05);
}

.questmo-site-name-img {
    max-width: 180px !important;
    width: auto !important;  /* Override theme.css width: 45px */
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    background-color: transparent !important;  /* Override theme.css background-color */
}

/* Sidebar FAQ link with logo and text */
.wy-side-nav-search a.icon.icon-home {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-decoration: none !important;
}

/* Remove the default icon that RTD theme adds */
.wy-side-nav-search a.icon.icon-home::before {
    content: none !important;
    display: none !important;
}

/* Sidebar logo container - circular with yellow background */
.wy-side-nav-search a.icon.icon-home img {
    width: 100px !important;
    height: 100px !important;
    border-radius: 50% !important;
    padding: 10px !important;
    background: var(--secondary-light) !important;
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.3) !important;
    border: 3px solid var(--primary-blue) !important;
    display: block !important;
    margin: 0 auto 10px !important;  /* Reduced bottom margin since text comes after */
}

/* Container for home icon and text - inline */
.wy-side-nav-search a.icon.icon-home .faq-text-container {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

/* Home icon styling */
.wy-side-nav-search a.icon.icon-home .faq-text-container i.fa-home {
    font-size: 1.2rem !important;
    color: white !important;
}

.wy-side-nav-search input[type="text"] {
    border-radius: var(--radius-lg) !important;
    border: none !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    font-family: var(--font-body) !important;
}

.wy-nav-side {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid var(--border-color);
}

.wy-menu-vertical {
    font-family: var(--font-body) !important;
}

.wy-menu-vertical a {
    color: var(--text-color) !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    border-radius: var(--radius-sm);
    margin: 2px var(--spacing-sm);
    transition: all var(--transition-fast);
}

/* Fix main parent menu indentation (level 1) - non-active state */
.wy-menu-vertical li.toctree-l1 > a {
    padding-left: 24px !important;
}

.wy-menu-vertical a:hover {
    background: rgba(33, 150, 243, 0.1) !important;
    color: var(--primary-blue) !important;
}

/* Fix hover state indentation for level 2 and level 3 menu items */
.wy-menu-vertical li.toctree-l2 > a:hover,
.wy-menu-vertical li.toctree-l2 > a:focus {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 2rem !important;
    background: rgba(33, 150, 243, 0.1) !important;
    color: var(--primary-blue) !important;
}

.wy-menu-vertical li.toctree-l3 > a:hover,
.wy-menu-vertical li.toctree-l3 > a:focus {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 3rem !important;
    background: rgba(33, 150, 243, 0.1) !important;
    color: var(--primary-blue) !important;
}

.wy-menu-vertical li.current > a,
.wy-menu-vertical li.current a:hover {
    background: var(--primary-blue) !important;
    color: white !important;
    border-right: 4px solid var(--secondary-orange);
    padding-left: 24px !important;
    padding-right: 40px !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
    border-radius: var(--radius-sm) !important;
}

.wy-menu-vertical li.toctree-l1.current > a {
    background: var(--primary-blue) !important;
    color: white !important;
    padding-left: 24px !important;
    padding-right: 40px !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
    border-radius: var(--radius-sm) !important;
}

.wy-menu-vertical li.toctree-l2.current > a {
    background: rgba(33, 150, 243, 0.2) !important;
    color: var(--primary-blue) !important;
    padding-left: 2rem !important;
    padding-right: 40px !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
    border-radius: var(--radius-sm) !important;
}

.wy-menu-vertical li.toctree-l3.current > a {
    background: rgba(33, 150, 243, 0.2) !important;
    color: var(--primary-blue) !important;
    padding-left: 3rem !important;
    padding-right: 40px !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
    border-radius: var(--radius-sm) !important;
}

/* Submenu Indentation for Visual Hierarchy */
.wy-menu-vertical li.toctree-l2 > a {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 2rem !important;
}
.wy-menu-vertical li.toctree-l2 > a:hover {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 2rem !important;
}

.wy-menu-vertical li.toctree-l3 > a {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 3rem !important;
}
.wy-menu-vertical li.toctree-l3 > a:hover {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 3rem !important;
}

.wy-menu-vertical li.toctree-l4 > a {
    padding-left: 4rem !important;
    font-weight: normal !important;
}

.wy-menu-vertical li.toctree-l4 > a strong {
    font-weight: normal !important;
}

.wy-menu-vertical li.toctree-l4 > a:hover {
    padding-left: 4rem !important;
}

/* Expand/Collapse Icons - Theme-Aware Styling */
.wy-menu-vertical li.toctree-l1 > a .toctree-expand,
.wy-menu-vertical li.toctree-l2 > a .toctree-expand {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

/* Light mode expand/collapse icons */
[data-theme="light"] .wy-menu-vertical .toctree-expand {
    color: rgba(0, 0, 0, 0.5) !important;
}

[data-theme="light"] .wy-menu-vertical li.current > a .toctree-expand {
    color: white !important;
}

/* Dark mode expand/collapse icons */
[data-theme="dark"] .wy-menu-vertical .toctree-expand {
    color: rgba(255, 255, 255, 0.6) !important;
}

[data-theme="dark"] .wy-menu-vertical li.current > a .toctree-expand {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Hover state for expand/collapse icons */
.wy-menu-vertical a:hover .toctree-expand {
    color: var(--primary-blue) !important;
}

/* ============================================
   Main Content Area
   ============================================ */

.wy-nav-content {
    background: var(--bg-color) !important;
    max-width: 900px;
}

.wy-nav-content-wrap {
    background: var(--bg-color) !important;
}

.rst-content {
    color: var(--text-color);
}

/* ============================================
   Breadcrumbs
   ============================================ */

.wy-breadcrumbs {
    font-family: var(--font-body) !important;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
}

.wy-breadcrumbs li {
    display: inline-flex;
    align-items: center;
}

.wy-breadcrumbs a {
    color: var(--text-muted);
}

.wy-breadcrumbs a:hover {
    color: var(--primary-blue);
}

/* ============================================
   Code Blocks - Gaming Style
   ============================================ */

code,
.rst-content code,
.rst-content tt {
    font-family: var(--font-mono) !important;
    background: var(--code-bg);
    color: var(--epic-purple);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

pre,
.rst-content pre {
    background: var(--code-bg) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) !important;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.highlight {
    background: var(--code-bg) !important;
    border-radius: var(--radius-md);
}

/* Syntax Highlighting Colors */
.highlight .k { color: var(--epic-purple); }    /* Keyword */
.highlight .kd { color: var(--epic-purple); }   /* Keyword Declaration */
.highlight .kn { color: var(--epic-purple); }   /* Keyword Namespace */
.highlight .s { color: var(--success-green); }  /* String */
.highlight .s1 { color: var(--success-green); } /* String Single */
.highlight .s2 { color: var(--success-green); } /* String Double */
.highlight .c { color: var(--text-muted); }     /* Comment */
.highlight .c1 { color: var(--text-muted); }    /* Comment Single */
.highlight .cm { color: var(--text-muted); }    /* Comment Multiline */
.highlight .n { color: var(--text-color); }     /* Name */
.highlight .nf { color: var(--primary-blue); }  /* Function Name */
.highlight .nb { color: var(--secondary-orange); } /* Builtin */
.highlight .mi { color: var(--xp-purple); }     /* Number Integer */
.highlight .mf { color: var(--xp-purple); }     /* Number Float */
.highlight .o { color: var(--text-muted); }     /* Operator */

/* Copy Button Styling */
.copybtn {
    background: var(--primary-blue) !important;
    border-radius: var(--radius-sm) !important;
    transition: all var(--transition-fast);
}

.copybtn:hover {
    background: var(--primary-blue-dark) !important;
    transform: scale(1.1);
}

/* ============================================
   Admonitions - Gaming Themed
   ============================================ */

.admonition {
    box-shadow: var(--shadow-sm);
    margin: var(--spacing-lg) 0 !important;
    padding: var(--spacing-md) !important;
    border-left: 4px solid !important;
    background: var(--surface-color) !important;
    border-radius: var(--radius-lg);
}

.admonition-title {
    /* font-family: var(--font-display) !important; */
    font-weight: 400 !important;
    font-size: 1.1rem !important;
    margin-bottom: var(--spacing-sm) !important;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    /* Extend title background to left border */
    margin-left: calc(-1 * var(--spacing-md)) !important;
    margin-right: calc(-1 * var(--spacing-md)) !important;
    margin-top: calc(-1 * var(--spacing-md)) !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.admonition-title::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.2rem;
}

/* Note - Quest Note (Blue) */
.admonition.note {
    border-color: var(--primary-blue) !important;
    background: rgba(33, 150, 243, 0.05) !important;
}

.admonition.note .admonition-title {
    color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.15) !important;
}

.admonition.note .admonition-title::before {
    content: "\f059"; /* fa-circle-question */
    color: var(--primary-blue);
}

/* Tip - Power-Up (Green) */
.admonition.tip,
.admonition.hint {
    border-color: var(--success-green) !important;
    background: rgba(76, 175, 80, 0.05) !important;
}

.admonition.tip .admonition-title,
.admonition.hint .admonition-title {
    color: var(--success-green);
    background: rgba(76, 175, 80, 0.15) !important;
}

.admonition.tip .admonition-title::before,
.admonition.hint .admonition-title::before {
    content: "\f0e7"; /* fa-bolt */
    color: var(--success-green);
}

/* Warning - Caution Scroll (Orange) */
.admonition.warning,
.admonition.caution {
    border-color: var(--warning-orange) !important;
    background: rgba(255, 193, 7, 0.08) !important;
}

.admonition.warning .admonition-title,
.admonition.caution .admonition-title {
    color: var(--secondary-dark);
    background: rgba(255, 193, 7, 0.2) !important;
}

.admonition.warning .admonition-title::before,
.admonition.caution .admonition-title::before {
    content: "\f071"; /* fa-triangle-exclamation */
    color: var(--warning-orange);
}

/* Danger - Danger Zone (Red) */
.admonition.danger,
.admonition.error {
    border-color: var(--error-red) !important;
    background: rgba(176, 0, 32, 0.05) !important;
}

.admonition.danger .admonition-title,
.admonition.error .admonition-title {
    color: var(--error-red);
    background: rgba(176, 0, 32, 0.12) !important;
}

.admonition.danger .admonition-title::before,
.admonition.error .admonition-title::before {
    content: "\f06a"; /* fa-circle-exclamation */
    color: var(--error-red);
}

/* Important - Achievement (Orange) */
.admonition.important {
    border-color: var(--secondary-orange) !important;
    background: rgba(255, 152, 0, 0.08) !important;
}

.admonition.important .admonition-title {
    color: #5C3500; /* Dark orange for contrast */
    background: var(--secondary-orange) !important;
}

.admonition.important .admonition-title::before {
    content: "\f091"; /* fa-trophy */
    color: #5C3500; /* Dark orange for visibility */
}

/* See Also - XP Boost (Purple) */
.admonition.seealso {
    border-color: var(--epic-purple) !important;
    background: rgba(124, 77, 255, 0.05) !important;
}

.admonition.seealso .admonition-title {
    color: var(--epic-purple);
    background: rgba(124, 77, 255, 0.15) !important;
}

.admonition.seealso .admonition-title::before {
    content: "\f005"; /* fa-star */
    color: var(--epic-purple);
}

/* Light mode admonition title text color fix - use text-color for better readability */
[data-theme="light"] .admonition.note .admonition-title {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.tip .admonition-title,
[data-theme="light"] .admonition.hint .admonition-title {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.warning .admonition-title,
[data-theme="light"] .admonition.caution .admonition-title {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.danger .admonition-title,
[data-theme="light"] .admonition.error .admonition-title {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.important .admonition-title {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.seealso .admonition-title {
    color: var(--text-color) !important;
}

/* Light mode admonition icons - use text-color for consistency */
[data-theme="light"] .admonition.note .admonition-title::before {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.tip .admonition-title::before,
[data-theme="light"] .admonition.hint .admonition-title::before {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.warning .admonition-title::before,
[data-theme="light"] .admonition.caution .admonition-title::before {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.danger .admonition-title::before,
[data-theme="light"] .admonition.error .admonition-title::before {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.important .admonition-title::before {
    color: var(--text-color) !important;
}

[data-theme="light"] .admonition.seealso .admonition-title::before {
    color: var(--text-color) !important;
}

/* Disable image links - prevent images from being clickable */
.rst-content a.image-reference {
    pointer-events: none !important;
    cursor: default !important;
}

/* ============================================
   Tables
   ============================================ */

table,
.rst-content table.docutils {
    border-collapse: collapse;
    width: 100%;
    margin: var(--spacing-lg) 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th,
.rst-content table.docutils th {
    background: var(--gradient-primary) !important;
    color: white !important;
    font-family: var(--font-display) !important;
    font-weight: 400 !important;
    padding: var(--spacing-md) !important;
    text-align: left;
}

td,
.rst-content table.docutils td {
    padding: var(--spacing-md) !important;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
}

tr:hover td,
.rst-content table.docutils tr:hover td {
    background: rgba(33, 150, 243, 0.05);
}

/* ============================================
   Buttons
   ============================================ */

.btn,
.rst-content .btn {
    font-family: var(--font-body) !important;
    font-weight: 600;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white !important;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--primary-blue) !important;
    border: 2px solid var(--primary-blue);
}

.btn-secondary:hover {
    background: var(--primary-blue);
    color: white !important;
}

/* ============================================
   Cards (Sphinx Design)
   ============================================ */

.sd-card {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
    border: none !important;
    background: var(--surface-color) !important;
    transition: all var(--transition-normal);
    overflow: hidden;
    margin-bottom: var(--spacing-lg) !important;
}

/* Card grid spacing */
.sd-row {
    margin-top: var(--spacing-md) !important;
}

.sd-col {
    margin-bottom: var(--spacing-md) !important;
}

.sd-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg) !important;
}

.sd-card-header {
    background: var(--gradient-primary) !important;
    color: white !important;
    font-family: var(--font-display) !important;
    padding: var(--spacing-md) !important;
}

.sd-card-body {
    padding: var(--spacing-lg) !important;
}

/* ============================================
   Tabs (sphinx-tabs)
   ============================================ */

.sphinx-tabs {
    margin: var(--spacing-lg) 0;
}

.sphinx-tabs-tab {
    font-family: var(--font-body) !important;
    font-weight: 600;
    padding: var(--spacing-sm) var(--spacing-lg) !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    border: none !important;
    background: var(--surface-color) !important;
    color: var(--text-muted) !important;
    transition: all var(--transition-fast);
}

.sphinx-tabs-tab:hover {
    color: var(--primary-blue) !important;
}

.sphinx-tabs-tab[aria-selected="true"] {
    background: var(--primary-blue) !important;
    color: white !important;
}

.sphinx-tabs-panel {
    border: 1px solid var(--border-color) !important;
    border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md) !important;
    padding: var(--spacing-lg) !important;
    background: var(--surface-color) !important;
}

/* ============================================
   Footer
   ============================================ */

footer {
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-xxl);
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-blue);
}

/* ============================================
   Theme Toggle Button
   ============================================ */

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--surface-color);
    border: 2px solid var(--primary-blue);
    border-radius: var(--radius-full);
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.theme-toggle i {
    font-size: 1.25rem;
    color: var(--primary-blue);
    line-height: 1;
}

/* Ensure Font Awesome icons are properly loaded and visible */
.theme-toggle .fa-moon,
.theme-toggle .fa-sun {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome !important;
    font-weight: 900 !important;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Theme-based icon visibility - CSS as fallback, JS sets inline styles */
[data-theme="dark"] .theme-toggle .fa-moon,
[data-theme="light"] .theme-toggle .fa-sun {
    display: none !important;
}

[data-theme="dark"] .theme-toggle .fa-sun,
[data-theme="light"] .theme-toggle .fa-moon {
    display: flex !important;
}

/* ============================================
   Language Switcher
   ============================================ */

.language-switcher {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
}

.language-switcher select {
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: 2px solid var(--primary-blue);
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.language-switcher select:hover {
    box-shadow: var(--shadow-md);
}

/* ============================================
   External Link Icons - Scoped to Content Only
   ============================================ */

/* Hide external link icons from header, navigation, and breadcrumbs */
.wy-nav-top .fa-external-link-alt,
.wy-side-nav-search .fa-external-link-alt,
.wy-breadcrumbs .fa-external-link-alt,
.mobile-controls .fa-external-link-alt,
.wy-menu-vertical .fa-external-link-alt {
    display: none !important;
}

/* Only show external link icons in main content */
.rst-content a .fa-external-link-alt,
.document a .fa-external-link-alt {
    display: inline !important;
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: var(--radius-lg);
}

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

/* ============================================
   RTL Support (Arabic)
   ============================================ */

/* Base RTL direction */
[dir="rtl"],
html[lang="ar"] {
    text-align: right;
    direction: rtl;
}

/* Sidebar positioning - move to RIGHT side for RTL */
[dir="rtl"] .wy-nav-side,
html[lang="ar"] .wy-nav-side {
    right: 0;
    left: auto;
    border-right: none;
    border-left: 1px solid var(--border-color);
    z-index: 100 !important; /* Ensure sidebar stays above content */
}

/* Main content - add margin on RIGHT side for sidebar */
[dir="rtl"] .wy-nav-content-wrap,
html[lang="ar"] .wy-nav-content-wrap {
    margin-right: 300px;
    margin-left: 0;
}

/* Mobile: Content full width when sidebar is hidden */
@media screen and (max-width: 768px) {
    /* Fix body and grid background for RTL dark mode */
    [dir="rtl"] body.wy-body-for-nav,
    html[lang="ar"] body.wy-body-for-nav {
        background: var(--sidebar-bg, #343131) !important;
    }

    [dir="rtl"] .wy-grid-for-nav,
    html[lang="ar"] .wy-grid-for-nav {
        background: var(--sidebar-bg, #343131) !important;
    }

    /* Mobile RTL adjustments - hide sidebar by default on mobile */
    [dir="rtl"] .wy-nav-side,
    html[lang="ar"] .wy-nav-side {
        left: auto !important;
        right: -300px !important;  /* Hide off-screen to the right */
        transition: right 0.3s ease;
        top: 0 !important;  /* Start from top */
        height: 100vh !important;
    }

    /* Show sidebar when shifted class is active */
    [dir="rtl"] .wy-nav-side.shift,
    html[lang="ar"] .wy-nav-side.shift {
        right: 0 !important;
        z-index: 100 !important;  /* Below header (z-index: 200) */
        top: 0 !important;
        padding-top: 56px !important;  /* Account for fixed header */
    }

    /* Ensure RTL mobile header stays above sidebar */
    [dir="rtl"] .wy-nav-top,
    html[lang="ar"] .wy-nav-top {
        z-index: 250 !important;  /* Higher than sidebar (100) */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: #2196F3 !important;
        isolation: isolate;  /* Create stacking context */
    }

    /* Add padding to content to account for fixed header */
    [dir="rtl"] .wy-nav-content-wrap,
    html[lang="ar"] .wy-nav-content-wrap {
        padding-top: 56px !important;
        margin-right: 0 !important;
        background: var(--sidebar-bg, #343131) !important;
    }

    /* Ensure hamburger icon is always visible and clickable */
    [dir="rtl"] .wy-nav-top i.fa-bars,
    html[lang="ar"] .wy-nav-top i.fa-bars {
        color: white !important;
        opacity: 1 !important;
        visibility: visible !important;
        cursor: pointer !important;
    }
}

/* Menu items - flip borders for RTL (border on LEFT instead of RIGHT) */
[dir="rtl"] .wy-menu-vertical li.current > a,
html[lang="ar"] .wy-menu-vertical li.current > a {
    border-right: none !important;
    border-left: 4px solid var(--secondary-orange) !important;
    text-align: right !important;
}

/* Current items inherit padding from toctree-l* rules above - no margin needed */

/* Menu expand/collapse icons - position on RIGHT side in RTL */
/* Base styles for all levels */
[dir="rtl"] .wy-menu-vertical .toctree-expand,
html[lang="ar"] .wy-menu-vertical .toctree-expand {
    float: none !important;
    position: absolute !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
}

/* Level-specific icon positioning - icons indent with text */
/* Icon positioned ~2em before text start point for consistent spacing */
[dir="rtl"] .wy-menu-vertical li.toctree-l1 > a .toctree-expand,
html[lang="ar"] .wy-menu-vertical li.toctree-l1 > a .toctree-expand {
    right: 0.5em !important;  /* L1: text at 2.5em, icon at 0.5em */
}

[dir="rtl"] .wy-menu-vertical li.toctree-l2 > a .toctree-expand,
html[lang="ar"] .wy-menu-vertical li.toctree-l2 > a .toctree-expand {
    right: 2em !important;  /* L2: text at 4em, icon at 2em */
}

[dir="rtl"] .wy-menu-vertical li.toctree-l3 > a .toctree-expand,
html[lang="ar"] .wy-menu-vertical li.toctree-l3 > a .toctree-expand {
    right: 3.5em !important;  /* L3: text at 5.5em, icon at 3.5em */
}

[dir="rtl"] .wy-menu-vertical li.toctree-l4 > a .toctree-expand,
html[lang="ar"] .wy-menu-vertical li.toctree-l4 > a .toctree-expand {
    right: 5.5em !important;  /* L4: text at 7.5em, icon at 5.5em */
}

/* RTL Menu Indentation - CORRECT APPROACH */
/* Use padding-right to indent text while keeping border at edge (unlike margin). */
/* Padding format: top RIGHT bottom left - increasing right padding = indent from right */
/* Match LTR progression: L2=2rem, L3=3rem, L4=4rem from base */

[dir="rtl"] .wy-menu-vertical li.toctree-l1 > a,
html[lang="ar"] .wy-menu-vertical li.toctree-l1 > a {
    position: relative !important;
    padding: var(--spacing-sm) 2.5em var(--spacing-sm) var(--spacing-sm) !important;  /* L1: base with icon space */
    text-align: right !important;
}

[dir="rtl"] .wy-menu-vertical li.toctree-l2 > a,
html[lang="ar"] .wy-menu-vertical li.toctree-l2 > a {
    position: relative !important;
    padding: var(--spacing-sm) 4em var(--spacing-sm) var(--spacing-sm) !important;  /* L2: +1.5em indent */
    text-align: right !important;
}

[dir="rtl"] .wy-menu-vertical li.toctree-l3 > a,
html[lang="ar"] .wy-menu-vertical li.toctree-l3 > a {
    position: relative !important;
    padding: var(--spacing-sm) 5.5em var(--spacing-sm) var(--spacing-sm) !important;  /* L3: +3em indent */
    text-align: right !important;
}

[dir="rtl"] .wy-menu-vertical li.toctree-l4 > a,
html[lang="ar"] .wy-menu-vertical li.toctree-l4 > a {
    position: relative !important;
    padding: var(--spacing-sm) 7.5em var(--spacing-sm) var(--spacing-sm) !important;  /* L4: +5em indent - more visible */
    font-weight: normal !important;
    text-align: right !important;
}

/* Hover states for RTL menu items - maintain padding */
[dir="rtl"] .wy-menu-vertical li.toctree-l2 > a:hover,
[dir="rtl"] .wy-menu-vertical li.toctree-l2 > a:focus,
html[lang="ar"] .wy-menu-vertical li.toctree-l2 > a:hover,
html[lang="ar"] .wy-menu-vertical li.toctree-l2 > a:focus {
    padding: var(--spacing-sm) 4em var(--spacing-sm) var(--spacing-sm) !important;
}

[dir="rtl"] .wy-menu-vertical li.toctree-l3 > a:hover,
[dir="rtl"] .wy-menu-vertical li.toctree-l3 > a:focus,
html[lang="ar"] .wy-menu-vertical li.toctree-l3 > a:hover,
html[lang="ar"] .wy-menu-vertical li.toctree-l3 > a:focus {
    padding: var(--spacing-sm) 5.5em var(--spacing-sm) var(--spacing-sm) !important;
}

[dir="rtl"] .wy-menu-vertical li.toctree-l4 > a:hover,
html[lang="ar"] .wy-menu-vertical li.toctree-l4 > a:hover {
    padding: var(--spacing-sm) 7.5em var(--spacing-sm) var(--spacing-sm) !important;
}

/* Dark mode RTL menu items */
[data-theme="dark"][dir="rtl"] .wy-menu-vertical li.current > a,
[data-theme="dark"][dir="rtl"] .wy-menu-vertical li.toctree-l1.current > a,
[data-theme="dark"][dir="rtl"] .wy-menu-vertical li.toctree-l2.current > a,
[data-theme="dark"][dir="rtl"] .wy-menu-vertical li.toctree-l3.current > a,
[data-theme="dark"] html[lang="ar"] .wy-menu-vertical li.current > a,
[data-theme="dark"] html[lang="ar"] .wy-menu-vertical li.toctree-l1.current > a,
[data-theme="dark"] html[lang="ar"] .wy-menu-vertical li.toctree-l2.current > a,
[data-theme="dark"] html[lang="ar"] .wy-menu-vertical li.toctree-l3.current > a {
    border-right: none;
    border-left: 3px solid var(--primary-blue);
}

/* ============================================
   RTL Admonitions - Complete Override
   ============================================ */

/* Base admonition - flip border from LEFT to RIGHT */
/* Using high specificity selectors to override base styles */
[dir="rtl"] .admonition,
[dir="rtl"] .rst-content .admonition,
[dir="rtl"] .admonition.note,
[dir="rtl"] .admonition.tip,
[dir="rtl"] .admonition.hint,
[dir="rtl"] .admonition.warning,
[dir="rtl"] .admonition.caution,
[dir="rtl"] .admonition.danger,
[dir="rtl"] .admonition.error,
[dir="rtl"] .admonition.important,
[dir="rtl"] .admonition.seealso,
html[lang="ar"] .admonition,
html[lang="ar"] .rst-content .admonition,
html[lang="ar"] .admonition.note,
html[lang="ar"] .admonition.tip,
html[lang="ar"] .admonition.hint,
html[lang="ar"] .admonition.warning,
html[lang="ar"] .admonition.caution,
html[lang="ar"] .admonition.danger,
html[lang="ar"] .admonition.error,
html[lang="ar"] .admonition.important,
html[lang="ar"] .admonition.seealso {
    border-left: none !important;
    border-left-width: 0 !important;
    border-right-width: 4px !important;
    border-right-style: solid !important;
}

/* Admonition title icons - flip margins */
[dir="rtl"] .admonition-title::before,
html[lang="ar"] .admonition-title::before {
    margin-right: 0;
    margin-left: var(--spacing-sm);
}

/* Breadcrumbs - reverse direction */
[dir="rtl"] .wy-breadcrumbs li,
html[lang="ar"] .wy-breadcrumbs li {
    float: right;
}

[dir="rtl"] .wy-breadcrumbs li + li::before,
html[lang="ar"] .wy-breadcrumbs li + li::before {
    content: "←" !important;
    padding: 0 0.5em;
}

/* Table headers - align right */
[dir="rtl"] th,
[dir="rtl"] .rst-content table.docutils th,
html[lang="ar"] th,
html[lang="ar"] .rst-content table.docutils th {
    text-align: right;
}

/* Theme toggle button - move to LEFT side */
[dir="rtl"] .theme-toggle,
html[lang="ar"] .theme-toggle {
    right: auto;
    left: 20px;
}

/* Language switcher - move to LEFT side */
[dir="rtl"] .language-switcher,
html[lang="ar"] .language-switcher {
    right: auto;
    left: 20px;
}

/* Back to top button - move to LEFT side */
[dir="rtl"] .back-to-top,
html[lang="ar"] .back-to-top {
    right: auto !important;
    left: 20px !important;
}

/* Search box - align right */
[dir="rtl"] .wy-side-nav-search input[type="text"],
html[lang="ar"] .wy-side-nav-search input[type="text"] {
    text-align: right;
}

/* Code blocks - maintain LTR for code */
[dir="rtl"] code,
[dir="rtl"] pre,
[dir="rtl"] .highlight,
html[lang="ar"] code,
html[lang="ar"] pre,
html[lang="ar"] .highlight {
    direction: ltr;
    text-align: left;
}

/* Footer - align right */
[dir="rtl"] footer,
html[lang="ar"] footer {
    text-align: right;
}

/* Previous/Next navigation buttons - flip positions */
[dir="rtl"] .rst-footer-buttons .btn-neutral,
html[lang="ar"] .rst-footer-buttons .btn-neutral {
    float: left !important;
}

[dir="rtl"] .rst-footer-buttons .btn-neutral.float-left,
html[lang="ar"] .rst-footer-buttons .btn-neutral.float-left {
    float: right !important;
}

[dir="rtl"] .rst-footer-buttons .btn-neutral.float-right,
html[lang="ar"] .rst-footer-buttons .btn-neutral.float-right {
    float: left !important;
}

/* Navigation arrows - flip direction */
[dir="rtl"] .fa-arrow-circle-left::before,
html[lang="ar"] .fa-arrow-circle-left::before {
    content: "\f0a9" !important; /* arrow-circle-right */
}

[dir="rtl"] .fa-arrow-circle-right::before,
html[lang="ar"] .fa-arrow-circle-right::before {
    content: "\f0a8" !important; /* arrow-circle-left */
}

/* Lists - align bullets to right */
[dir="rtl"] .rst-content ul,
[dir="rtl"] .rst-content ol,
html[lang="ar"] .rst-content ul,
html[lang="ar"] .rst-content ol {
    margin-right: 0;
    margin-left: 0;
    padding-right: 1.5em;
    padding-left: 0;
}

/* Mobile RTL adjustments */
@media screen and (max-width: 768px) {
    /* Content wrap - ensure no gap on left side in RTL */
    [dir="rtl"] .wy-nav-content-wrap,
    html[lang="ar"] .wy-nav-content-wrap {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    /* When sidebar is open, ensure content wrap doesn't shift left */
    [dir="rtl"] .wy-nav-content-wrap.shift,
    html[lang="ar"] .wy-nav-content-wrap.shift {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    /* Mobile header for RTL - keep hamburger on LEFT side (not where sidebar opens) */
    /* Don't use direction: rtl on header - use flex order instead for explicit control */
    [dir="rtl"] .wy-nav-top,
    html[lang="ar"] .wy-nav-top {
        direction: ltr !important;  /* Keep LTR direction on header */
        flex-direction: row !important;  /* Explicit row direction */
        position: fixed !important;  /* Ensure header is fixed */
        z-index: 250 !important;  /* Higher z-index to be above sidebar */
        isolation: isolate;  /* Create new stacking context */
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;  /* Full viewport width */
        max-width: 100% !important;
        background: #2196F3 !important;  /* Solid blue background */
        background-color: #2196F3 !important;  /* Fallback */
        display: flex !important;
        align-items: center !important;
        padding: 10px 15px !important;
        min-height: 56px !important;
        box-sizing: border-box !important;
        margin: 0 !important;  /* No margin */
    }

    /* Hamburger icon stays on LEFT in RTL (order: 1 = first) */
    [dir="rtl"] .wy-nav-top i.fa-bars,
    html[lang="ar"] .wy-nav-top i.fa-bars {
        order: 1 !important;
        margin-right: 12px;
        margin-left: 0;
        z-index: 251 !important;  /* Ensure hamburger is clickable */
        position: relative;
        color: white !important;
    }

    /* Logo/title stays in middle (order: 2) */
    [dir="rtl"] .wy-nav-top > a,
    html[lang="ar"] .wy-nav-top > a {
        order: 2 !important;
        margin-right: 12px;
        text-align: right;  /* Right-align text for RTL */
        direction: rtl;  /* RTL text direction for Arabic text */
        color: white !important;
    }

    /* Mobile controls go to the RIGHT side (order: 3) */
    [dir="rtl"] .mobile-controls,
    html[lang="ar"] .mobile-controls {
        order: 3 !important;
        margin-left: auto;
        margin-right: 0;
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media screen and (max-width: 768px) {
    h1, .rst-content h1 { font-size: 2rem; }
    h2, .rst-content h2 { font-size: 1.5rem; }
    h3, .rst-content h3 { font-size: 1.25rem; }

    /* Mobile header improvements */
    .wy-nav-top {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding: 10px 15px;
        min-height: 56px;
        flex-wrap: nowrap;
        z-index: 200 !important;  /* Keep mobile header above sidebar */
        background: var(--primary-blue) !important;  /* Ensure header has background */
    }

    /* Mobile menu hamburger icon - fixed position */
    .wy-nav-top i.fa-bars {
        margin-right: 12px;
        font-size: 1.2rem;
        flex-shrink: 0;
    }

    /* Logo/title container - flexible width */
    .wy-nav-top a {
        font-size: 1rem;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-right: 12px;
        display: block;
    }

    /* Mobile controls container - placed at end of header */
    .mobile-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: auto;
    }

    /* Theme toggle in mobile header */
    .mobile-controls .theme-toggle {
        position: static !important;
        width: 36px;
        height: 36px;
        min-width: 36px;
        background: rgba(255, 255, 255, 0.15);
        border: 1.5px solid rgba(255, 255, 255, 0.5);
        box-shadow: none;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .mobile-controls .theme-toggle i {
        font-size: 1rem;
        color: white;
        line-height: 1;
        margin: 0;
    }

    .mobile-controls .theme-toggle:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.7);
        transform: none;
        box-shadow: none;
    }

    /* Language switcher in mobile header */
    .mobile-controls .language-switcher {
        position: static !important;
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .mobile-controls .language-switcher select {
        padding: 6px 26px 6px 10px;
        font-size: 0.8rem;
        background: rgba(255, 255, 255, 0.15);
        border: 1.5px solid rgba(255, 255, 255, 0.5);
        color: white;
        border-radius: 6px;
        min-width: 70px;
        max-width: 90px;
        height: 36px;
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='white' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-size: 10px;
        font-weight: 600;
    }

    .mobile-controls .language-switcher select:hover {
        background-color: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.7);
    }

    .mobile-controls .language-switcher select:focus {
        outline: 2px solid rgba(255, 255, 255, 0.8);
        outline-offset: 2px;
    }

    .mobile-controls .language-switcher select option {
        background: var(--background-dark);
        color: var(--text-dark);
        padding: 8px;
    }

    /* Hide fixed position controls on mobile */
    body > .theme-toggle,
    body > .language-switcher {
        display: none !important;
    }

    /* Ensure proper spacing in mobile header for logo images */
    .wy-nav-top .wy-nav-top-img {
        max-height: 32px;
        width: auto;
        vertical-align: middle;
    }

    /* Adjust Questmo site name image for mobile */
    .questmo-site-name-img {
        max-width: 140px !important;
    }

    /* Content padding */
    .wy-nav-content {
        padding: var(--spacing-md);
    }

    /* Prevent header text selection on mobile */
    .wy-nav-top {
        user-select: none;
        -webkit-user-select: none;
    }
}

/* ============================================
   Floating Animation (Optional Decoration)
   ============================================ */

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.floating {
    animation: float 3s ease-in-out infinite;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .theme-toggle,
    .language-switcher,
    .wy-nav-side {
        display: none !important;
    }

    .wy-nav-content-wrap {
        margin-left: 0 !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    a {
        color: var(--primary-blue) !important;
    }
}

/* ============================================
   Dark Mode Specific Fixes (Jan 2026)
   ============================================ */

/* Fix #1: Sidebar nested menu backgrounds in dark mode */
[data-theme="dark"] .wy-menu-vertical li.toctree-l2,
[data-theme="dark"] .wy-menu-vertical li.toctree-l3 {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .wy-menu-vertical li.toctree-l2 > a,
[data-theme="dark"] .wy-menu-vertical li.toctree-l3 > a {
    color: rgba(255, 255, 255, 0.87) !important;
}

[data-theme="dark"] .wy-menu-vertical li.toctree-l2.current > a {
    background: rgba(33, 150, 243, 0.25) !important;
    color: #64B5F6 !important;
}

[data-theme="dark"] .wy-menu-vertical li.toctree-l3.current > a {
    background: rgba(33, 150, 243, 0.20) !important;
    color: #64B5F6 !important;
}

/* Fix #2: Previous/Next navigation buttons */
.rst-footer-buttons {
    margin-top: var(--spacing-xl) !important;
    padding-top: var(--spacing-lg) !important;
    border-top: 1px solid var(--border-color);
}

.rst-footer-buttons a.btn {
    background: var(--surface-color) !important;
    border: 2px solid var(--primary-blue) !important;
    color: var(--primary-blue) !important;
    border-radius: var(--radius-lg) !important;
    padding: var(--spacing-sm) var(--spacing-lg) !important;
    font-family: var(--font-body) !important;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.rst-footer-buttons a.btn:hover {
    background: var(--primary-blue) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Dark mode overrides for Previous/Next buttons */
[data-theme="dark"] .rst-footer-buttons {
    border-top: 1px solid var(--border-dark);
}

[data-theme="dark"] .rst-footer-buttons a.btn {
    background: var(--surface-dark) !important;
    border: 2px solid var(--primary-blue) !important;
    color: var(--primary-blue) !important;
}

[data-theme="dark"] .rst-footer-buttons a.btn:hover {
    background: var(--primary-blue) !important;
    color: white !important;
}

/* Fix #3: Footer extra links visibility in dark mode */
[data-theme="dark"] .questmo-footer-extra,
[data-theme="dark"] .questmo-footer-extra a,
[data-theme="dark"] footer a {
    color: var(--text-dark) !important;
}

[data-theme="dark"] .questmo-footer-extra a:hover,
[data-theme="dark"] footer a:hover {
    color: var(--primary-light) !important;
}

/* Fix #4: Theme toggle icon visibility in dark mode */
[data-theme="dark"] .theme-toggle {
    background: var(--surface-dark);
    border-color: var(--primary-light);
}

[data-theme="dark"] .theme-toggle i {
    color: var(--primary-light);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(33, 150, 243, 0.15);
}

/* Font Awesome icon base styling - visibility controlled by theme rules above */
.theme-toggle .fa-sun,
.theme-toggle .fa-moon {
    line-height: 1;
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
    font-weight: 900;
}

/* Additional dark mode contrast improvements */
[data-theme="dark"] .wy-menu-vertical a:hover {
    background: rgba(33, 150, 243, 0.15) !important;
    color: var(--primary-light) !important;
}

[data-theme="dark"] .wy-menu-vertical li.current > a,
[data-theme="dark"] .wy-menu-vertical li.current a:hover {
    background: var(--primary-blue) !important;
    color: white !important;
}

/* Dark mode breadcrumbs visibility */
[data-theme="dark"] .wy-breadcrumbs {
    border-bottom-color: var(--border-dark);
}

[data-theme="dark"] .wy-breadcrumbs a {
    color: var(--text-muted-dark);
}

[data-theme="dark"] .wy-breadcrumbs a:hover {
    color: var(--primary-light);
}

/* Dark mode code inline visibility */
[data-theme="dark"] code,
[data-theme="dark"] .rst-content code,
[data-theme="dark"] .rst-content tt {
    color: var(--primary-light);
    background: var(--code-bg);
}

/* ============================================
   Dark Mode Sidebar Fix - Complete Override
   ============================================ */

/* Force dark backgrounds on ALL sidebar menu items */
[data-theme="dark"] .wy-menu-vertical,
[data-theme="dark"] .wy-menu-vertical li,
[data-theme="dark"] .wy-menu-vertical li ul,
[data-theme="dark"] .wy-menu-vertical li.toctree-l1,
[data-theme="dark"] .wy-menu-vertical li.toctree-l2,
[data-theme="dark"] .wy-menu-vertical li.toctree-l3,
[data-theme="dark"] .wy-menu-vertical li.toctree-l4 {
    background: transparent !important;
    background-color: transparent !important;
}

/* Override RTD theme's nested list backgrounds */
[data-theme="dark"] .wy-menu-vertical li.toctree-l1 > ul,
[data-theme="dark"] .wy-menu-vertical li.toctree-l2 > ul,
[data-theme="dark"] .wy-menu-vertical li.toctree-l3 > ul {
    background: rgba(0, 0, 0, 0.15) !important;
}

/* Force dark text colors on all menu links */
[data-theme="dark"] .wy-menu-vertical a,
[data-theme="dark"] .wy-menu-vertical li a,
[data-theme="dark"] .wy-menu-vertical li.toctree-l1 a,
[data-theme="dark"] .wy-menu-vertical li.toctree-l2 a,
[data-theme="dark"] .wy-menu-vertical li.toctree-l3 a,
[data-theme="dark"] .wy-menu-vertical li.toctree-l4 a {
    color: rgba(255, 255, 255, 0.85) !important;
    background: transparent !important;
}

/* Hover state for menu items */
[data-theme="dark"] .wy-menu-vertical a:hover,
[data-theme="dark"] .wy-menu-vertical li a:hover {
    background: rgba(33, 150, 243, 0.2) !important;
    color: #64B5F6 !important;
}

/* Current/Active menu item styling */
[data-theme="dark"] .wy-menu-vertical li.current > a,
[data-theme="dark"] .wy-menu-vertical li.toctree-l1.current > a,
[data-theme="dark"] .wy-menu-vertical li.toctree-l2.current > a,
[data-theme="dark"] .wy-menu-vertical li.toctree-l3.current > a {
    background: rgba(33, 150, 243, 0.3) !important;
    color: #64B5F6 !important;
    border-left: 3px solid var(--primary-blue);
}

/* Expanded parent menu items */
[data-theme="dark"] .wy-menu-vertical li.current,
[data-theme="dark"] .wy-menu-vertical li.toctree-l1.current,
[data-theme="dark"] .wy-menu-vertical li.toctree-l2.current {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Remove RTD theme's white/light backgrounds completely */
[data-theme="dark"] .wy-menu-vertical li.on a,
[data-theme="dark"] .wy-menu-vertical li.current > a.current {
    background: rgba(33, 150, 243, 0.35) !important;
    color: white !important;
}

/* Sidebar navigation panel background */
[data-theme="dark"] .wy-side-nav-search,
[data-theme="dark"] .wy-nav-side {
    background: var(--background-dark) !important;
}

/* ============================================
   Admonition Header Text Color Fixes
   ============================================ */

/* Make ALL admonition titles white for visibility */
.admonition-title,
.rst-content .admonition-title,
.rst-content .note .admonition-title,
.rst-content .tip .admonition-title,
.rst-content .warning .admonition-title,
.rst-content .danger .admonition-title,
.rst-content .important .admonition-title,
.rst-content .hint .admonition-title,
.rst-content .attention .admonition-title,
.rst-content .caution .admonition-title,
.rst-content .seealso .admonition-title {
    color: white !important;
}

/* Dark mode specific - ensure titles stay white */
[data-theme="dark"] .admonition-title,
[data-theme="dark"] .rst-content .admonition-title,
[data-theme="dark"] .rst-content .note .admonition-title,
[data-theme="dark"] .rst-content .tip .admonition-title,
[data-theme="dark"] .rst-content .warning .admonition-title,
[data-theme="dark"] .rst-content .danger .admonition-title,
[data-theme="dark"] .rst-content .important .admonition-title,
[data-theme="dark"] .rst-content .hint .admonition-title,
[data-theme="dark"] .rst-content .attention .admonition-title,
[data-theme="dark"] .rst-content .caution .admonition-title,
[data-theme="dark"] .rst-content .seealso .admonition-title {
    color: white !important;
}

/* Admonition header icon color (Font Awesome icons) */
.admonition-title::before,
.rst-content .admonition-title::before {
    color: white !important;
}

/* Light mode admonition body text - ensure readability */
.rst-content .admonition p,
.rst-content .note p,
.rst-content .tip p,
.rst-content .warning p,
.rst-content .important p {
    color: var(--text-secondary);
}

/* Dark mode admonition body text */
[data-theme="dark"] .rst-content .admonition p,
[data-theme="dark"] .rst-content .note p,
[data-theme="dark"] .rst-content .tip p,
[data-theme="dark"] .rst-content .warning p,
[data-theme="dark"] .rst-content .important p {
    color: rgba(255, 255, 255, 0.87);
}
