/* Theme System for Aepto Documentation */

[data-bs-theme="dark"] {
    --aepto-border-color: rgba(255, 255, 255, 0.3) !important;
    --aepto-text-primary: rgba(255, 255, 255, 0.9) !important;
    --aepto-text-secondary: rgba(255, 255, 255, 0.7) !important;
    --aepto-bg-primary: #1a1d29 !important;
    --aepto-bg-secondary: #212529 !important;
    --aepto-bg-card: #212529 !important;
    --aepto-bg-light: #1a1d29 !important;
    --aepto-bg-light-alt: #212529 !important;
    --aepto-borders: rgba(255, 255, 255, 0.2) !important;
}


/* Sidebar dark mode */
[data-bs-theme="dark"] .docs-sidebar {
    background: var(--aepto-bg-secondary, #212529) !important;
    border-right: 1px solid var(--aepto-borders, rgba(255, 255, 255, 0.2)) !important;
}

[data-bs-theme="dark"] .sidebar-header {
    border-bottom: 1px solid var(--aepto-borders, rgba(255, 255, 255, 0.2)) !important;
}

[data-bs-theme="dark"] .nav-link {
    color: var(--aepto-text-primary, rgba(255, 255, 255, 0.9)) !important;
}

[data-bs-theme="dark"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .nav-link.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%) !important;
    border-left-color: var(--aepto-primary-start) !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
}

[data-bs-theme="dark"] .nav-link.active:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}


[data-bs-theme="dark"] .docs-search {
    background: var(--aepto-bg-primary, #1a1d29) !important;
    border: 1px solid var(--aepto-borders, rgba(255, 255, 255, 0.2)) !important;
}

[data-bs-theme="dark"] .search-input {
    background: transparent !important;
    border: none !important;
    color: var(--aepto-text-primary, rgba(255, 255, 255, 0.9)) !important;
}

[data-bs-theme="dark"] .search-input::placeholder {
    color: var(--aepto-text-secondary, rgba(255, 255, 255, 0.7)) !important;
}


/* Body background override */
[data-bs-theme="dark"] body {
    background-color: var(--aepto-bg-primary, #1a1d29) !important;
}

/* Main content area */
[data-bs-theme="dark"] .docs-main {
    background: var(--aepto-bg-primary, #1a1d29) !important;
}

[data-bs-theme="dark"] .docs-content {
    background: var(--aepto-bg-primary, #1a1d29) !important;
}

/* Card styles */
[data-bs-theme="dark"] .doc-card,
[data-bs-theme="dark"] .feature-card {
    background: var(--aepto-bg-secondary, #212529) !important;
    border: 1px solid var(--aepto-borders, rgba(255, 255, 255, 0.2)) !important;
}

/* Override all hardcoded backgrounds and borders */
[data-bs-theme="dark"] [style*="background: #f8f9fa"],
[data-bs-theme="dark"] [style*="background:#f8f9fa"],
[data-bs-theme="dark"] [style*="background-color: #f8f9fa"],
[data-bs-theme="dark"] [style*="background-color:#f8f9fa"] {
    background: var(--aepto-bg-primary) !important;
    background-color: var(--aepto-bg-primary) !important;
    border-color: var(--aepto-borders) !important;
}

/* Override hardcoded white backgrounds */
[data-bs-theme="dark"] [style*="background: #fff"],
[data-bs-theme="dark"] [style*="background:#fff"],
[data-bs-theme="dark"] [style*="background: white"],
[data-bs-theme="dark"] [style*="background:white"],
[data-bs-theme="dark"] [style*="background-color: #fff"],
[data-bs-theme="dark"] [style*="background-color:#fff"],
[data-bs-theme="dark"] [style*="background-color: white"],
[data-bs-theme="dark"] [style*="background-color:white"],
[data-bs-theme="dark"] div[style*="background: white"],
[data-bs-theme="dark"] section[style*="background: white"] {
    background: var(--aepto-bg-primary) !important;
    background-color: var(--aepto-bg-primary) !important;
    border-color: var(--aepto-borders) !important;
}

/* Override gradient backgrounds that are invisible in dark mode */
[data-bs-theme="dark"] section[style*="background: linear-gradient"],
[data-bs-theme="dark"] div[style*="background: linear-gradient"],
[data-bs-theme="dark"] [style*="background: linear-gradient"] {
    background: var(--aepto-bg-primary) !important;
    border-color: var(--aepto-borders) !important;
}

/* Override hero section gradient background for dark mode */
[data-bs-theme="dark"] .docs-hero {
    background: linear-gradient(135deg, #1a1d29 0%, #212529 100%) !important;
}

/* Also override the SVG pattern overlay for better dark mode appearance */
[data-bs-theme="dark"] .docs-hero div[style*="background: url('data:image/svg+xml"] {
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48ZGVmcz48cGF0dGVybiBpZD0iZ3JhaW4iIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBwYXR0ZXJuVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48Y2lyY2xlIGN4PSIyNSIgY3k9IjI1IiByPSIxIiBmaWxsPSJyZ2JhKDI1NSwyNTUsMjU1LDAuMDUpIi8+PGNpcmNsZSBjeD0iNzUiIGN5PSI3NSIgcj0iMSIgZmlsbD0icmdiYSgyNTUsMjU1LDI1NSwwLjA1KSIvPjxjaXJjbGUgY3g9IjUwIiBjeT0iMTAiIHI9IjAuNSIgZmlsbD0icmdiYSgyNTUsMjU1LDI1NSwwLjA3KSIvPjwvcGF0dGVybj48L2RlZnM+PHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9InVybCgjZ3JhaW4pIi8+PC9zdmc+') !important;
    opacity: 0.2 !important;
}

/* Remove gradient background from hero description paragraph */
.docs-hero p[style*="font-size: 1.3rem"] {
    background: transparent !important;
    backdrop-filter: none !important;
}

/* Ensure the paragraph text remains readable */
.docs-hero p[style*="font-size: 1.3rem"] {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Override rgba backgrounds with low opacity */
[data-bs-theme="dark"] [style*="background: rgba"],
[data-bs-theme="dark"] [style*="rgba("] {
    background: var(--aepto-bg-primary) !important;
}

/* Override specific Aepto brand gradient backgrounds */
[data-bs-theme="dark"] [style*="linear-gradient(135deg, rgba(102, 126, 234, 0.05)"],
[data-bs-theme="dark"] [style*="rgba(102, 126, 234, 0.05)"],
[data-bs-theme="dark"] [style*="rgba(118, 75, 162, 0.05)"] {
    background: var(--aepto-bg-primary) !important;
    border: 1px solid var(--aepto-borders) !important;
}

/* Override Aepto brand color accents */
[data-bs-theme="dark"] [style*="rgba(102, 126, 234, 0.1)"],
[data-bs-theme="dark"] [style*="rgba(102, 126, 234, 0.2)"],
[data-bs-theme="dark"] [style*="rgba(102, 126, 234, 0.3)"] {
    background: var(--aepto-bg-secondary) !important;
}

/* Override specific hex color backgrounds used in gradients and icons */
[data-bs-theme="dark"] [style*="background: #667eea"],
[data-bs-theme="dark"] [style*="background:#667eea"],
[data-bs-theme="dark"] [style*="background: #00b09b"],
[data-bs-theme="dark"] [style*="background:#00b09b"],
[data-bs-theme="dark"] [style*="background: #ffc107"],
[data-bs-theme="dark"] [style*="background:#ffc107"],
[data-bs-theme="dark"] [style*="background: #dc3545"],
[data-bs-theme="dark"] [style*="background:#dc3545"],
[data-bs-theme="dark"] [style*="background: #fd7e14"],
[data-bs-theme="dark"] [style*="background:#fd7e14"],
[data-bs-theme="dark"] [style*="background: #764ba2"],
[data-bs-theme="dark"] [style*="background:#764ba2"],
[data-bs-theme="dark"] [style*="background: #96c93d"],
[data-bs-theme="dark"] [style*="background:#96c93d"],
[data-bs-theme="dark"] [style*="background: #ff9800"],
[data-bs-theme="dark"] [style*="background:#ff9800"] {
    background: var(--aepto-bg-secondary) !important;
}

/* Override gradient backgrounds with these colors */
[data-bs-theme="dark"] [style*="linear-gradient(135deg, #667eea"],
[data-bs-theme="dark"] [style*="linear-gradient(90deg, #667eea"],
[data-bs-theme="dark"] [style*="linear-gradient(135deg, #00b09b"],
[data-bs-theme="dark"] [style*="linear-gradient(90deg, #00b09b"],
[data-bs-theme="dark"] [style*="linear-gradient(135deg, #dc3545"],
[data-bs-theme="dark"] [style*="linear-gradient(90deg, #dc3545"],
[data-bs-theme="dark"] [style*="linear-gradient(135deg, #ffc107"],
[data-bs-theme="dark"] [style*="linear-gradient(90deg, #ffc107"] {
    background: var(--aepto-bg-secondary) !important;
}

/* Override hardcoded text colors */
[data-bs-theme="dark"] [style*="color: #2d3748"],
[data-bs-theme="dark"] [style*="color:#2d3748"],
[data-bs-theme="dark"] [style*="color: #495057"],
[data-bs-theme="dark"] [style*="color:#495057"],
[data-bs-theme="dark"] [style*="color: #6c757d"],
[data-bs-theme="dark"] [style*="color:#6c757d"] {
    color: var(--aepto-text-primary) !important;
}

/* Override hardcoded border colors */
[data-bs-theme="dark"] [style*="border-color: #dee2e6"],
[data-bs-theme="dark"] [style*="border-color:#dee2e6"] {
    border-color: var(--aepto-borders) !important;
}

/* Code blocks and inline code */
[data-bs-theme="dark"] pre,
[data-bs-theme="dark"] code,
[data-bs-theme="dark"] .code-block,
[data-bs-theme="dark"] .code-block code {
    background: var(--aepto-bg-secondary, #212529) !important;
    border: 1px solid var(--aepto-borders, rgba(255, 255, 255, 0.2)) !important;
    color: var(--aepto-text-primary) !important;
}

/* Override hardcoded code block backgrounds */
[data-bs-theme="dark"] [style*="background: #f6f8fa"],
[data-bs-theme="dark"] [style*="background:#f6f8fa"],
[data-bs-theme="dark"] [style*="background: #f8f9fa"],
[data-bs-theme="dark"] [style*="background:#f8f9fa"],
[data-bs-theme="dark"] pre[style*="background"],
[data-bs-theme="dark"] code[style*="background"],
[data-bs-theme="dark"] .code-block[style*="background"] {
    background: var(--aepto-bg-secondary) !important;
    border-color: var(--aepto-borders) !important;
}

/* Keyboard shortcuts and other UI elements */
[data-bs-theme="dark"] kbd,
[data-bs-theme="dark"] .search-shortcut {
    background: var(--aepto-bg-secondary) !important;
    border: 1px solid var(--aepto-borders) !important;
    color: var(--aepto-text-primary) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* Blockquotes and other content elements */
[data-bs-theme="dark"] blockquote,
[data-bs-theme="dark"] .blockquote {
    border-left: 4px solid var(--aepto-borders) !important;
    color: var(--aepto-text-secondary) !important;
}

/* Tables */
[data-bs-theme="dark"] table,
[data-bs-theme="dark"] th,
[data-bs-theme="dark"] td {
    border-color: var(--aepto-borders) !important;
}

[data-bs-theme="dark"] th {
    background: var(--aepto-bg-secondary) !important;
    color: var(--aepto-text-primary) !important;
}

[data-bs-theme="dark"] td {
    background: var(--aepto-bg-primary) !important;
    color: var(--aepto-text-primary) !important;
}

/* Any remaining hardcoded gray backgrounds */
[data-bs-theme="dark"] [style*="background: #f1f3f4"],
[data-bs-theme="dark"] [style*="background:#f1f3f4"],
[data-bs-theme="dark"] [style*="background: #e9ecef"],
[data-bs-theme="dark"] [style*="background:#e9ecef"],
[data-bs-theme="dark"] [style*="background: #dee2e6"],
[data-bs-theme="dark"] [style*="background:#dee2e6"],
[data-bs-theme="dark"] [style*="background: #6c757d"],
[data-bs-theme="dark"] [style*="background:#6c757d"] {
    background: var(--aepto-bg-secondary) !important;
    border-color: var(--aepto-borders) !important;
}

/* Override any hardcoded text colors that might be too light in dark mode */
[data-bs-theme="dark"] [style*="color: #6c757d"],
[data-bs-theme="dark"] [style*="color:#6c757d"],
[data-bs-theme="dark"] [style*="color: #495057"],
[data-bs-theme="dark"] [style*="color:#495057"] {
    color: var(--aepto-text-secondary) !important;
}

/* HR elements and separators */
[data-bs-theme="dark"] hr,
[data-bs-theme="dark"] .hr {
    border-color: var(--aepto-borders) !important;
}

/* Details/summary elements */
[data-bs-theme="dark"] details,
[data-bs-theme="dark"] summary {
    background: var(--aepto-bg-primary) !important;
    border: 1px solid var(--aepto-borders) !important;
    color: var(--aepto-text-primary) !important;
}

/* Fieldset and form elements */
[data-bs-theme="dark"] fieldset,
[data-bs-theme="dark"] legend {
    border-color: var(--aepto-borders) !important;
    color: var(--aepto-text-primary) !important;
}

/* Any remaining elements with background colors */
[data-bs-theme="dark"] *[style*="background-color"],
[data-bs-theme="dark"] *[style*="background:"] {
    border-color: var(--aepto-borders) !important;
}

/* Popular badges alignment - ensure proper visibility */
div[style*="background: #ffc107"],
div[style*="background: #00b09b"] {
    z-index: 10 !important;
}

/* Popular badge styling for dark mode */
[data-bs-theme="dark"] div[style*="background: #ffc107"] {
    background: #ffc107 !important;
    color: #000 !important;
}

[data-bs-theme="dark"] div[style*="background: #00b09b"] {
    background: #00b09b !important;
    color: white !important;
}

/* Buttons */
[data-bs-theme="dark"] .btn-outline-primary {
    border-color: var(--aepto-accent, #4dabf7) !important;
    color: var(--aepto-accent, #4dabf7) !important;
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    background: var(--aepto-accent, #4dabf7) !important;
    color: white !important;
}


/* Theme switcher */
.theme-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Mobile: Theme switcher is moved into mobile header by JavaScript */
@media (max-width: 1024px) {
    .mobile-header .theme-switcher {
        position: static;
        background: transparent !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        padding: 0;
        border-radius: 0;
    }

    /* Override dark mode background for mobile header */
    [data-bs-theme="dark"] .mobile-header .theme-switcher,
    [data-bs-theme="brand"] .mobile-header .theme-switcher {
        background: transparent !important;
        border: none !important;
    }

    /* Better alignment for mobile header */
    .mobile-header .theme-switcher {
        margin-top: 2px;
        transform: scale(0.85);
        gap: 6px; /* Slightly larger gap */
    }

    .mobile-header .theme-switcher .btn {
        width: 34px; /* Larger button width */
        height: 34px; /* Larger button height */
        border-radius: 50% !important; /* Ensure perfect circles */
    }
}

.theme-switcher .btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.theme-switcher .btn.active {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.theme-switcher .btn-light {
    background: white;
    color: #495057;
    border: 1px solid #dee2e6;
}

.theme-switcher .btn-dark {
    background: #212529;
    color: white;
    border: 1px solid #495057;
}


[data-bs-theme="dark"] .theme-switcher {
    background: rgba(33, 37, 41, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .theme-switcher .btn-light {
    background: #343a40;
    color: #adb5bd;
    border: 1px solid #495057;
}

[data-bs-theme="dark"] .theme-switcher .btn-dark {
    background: #495057;
    color: white;
    border: 1px solid #6c757d;
}

