/*
 * Test2Go — GitHub-style deep dark theme override.
 * Loaded after Maxton's dark-theme.css to win the cascade.
 * Activated only when <html data-bs-theme="dark">.
 */
[data-bs-theme="dark"] {
    /* GitHub dark canvas palette */
    --bs-body-bg:               #0d1117;   /* canvas-default */
    --bs-body-bg-2:             #010409;   /* canvas-inset (deeper) */
    --bs-body-bg-rgb:           13, 17, 23;
    --bs-body-color:            #c9d1d9;   /* fg-default */
    --bs-body-color-rgb:        201, 209, 217;
    --bs-emphasis-color:        #f0f6fc;
    --bs-emphasis-color-rgb:    240, 246, 252;

    --bs-secondary-color:       #8b949e;
    --bs-secondary-color-rgb:   139, 148, 158;
    --bs-secondary-bg:          #161b22;   /* canvas-subtle */
    --bs-secondary-bg-rgb:      22, 27, 34;

    --bs-tertiary-color:        #6e7681;
    --bs-tertiary-color-rgb:    110, 118, 129;
    --bs-tertiary-bg:           #21262d;   /* canvas-overlay */
    --bs-tertiary-bg-rgb:       33, 38, 45;

    --bs-border-color:          #30363d;   /* border-default */
    --bs-border-color-translucent: rgba(240, 246, 252, 0.1);

    --bs-link-color:            #58a6ff;
    --bs-link-color-rgb:        88, 166, 255;
    --bs-link-hover-color:      #79c0ff;
    --bs-link-hover-color-rgb:  121, 192, 255;

    --bs-heading-color:         #f0f6fc;
    --bs-code-color:            #ff7b72;
    --bs-highlight-bg:          rgba(187, 128, 9, 0.4);
    color-scheme: dark;
}

/* ---------- Page chrome ---------- */
/* Body matches sidebar for a deep, unified canvas. */
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] .wrapper,
[data-bs-theme="dark"] .page-wrapper,
[data-bs-theme="dark"] .main-wrapper,
[data-bs-theme="dark"] .main-content {
    background-color: #010409 !important;
    color: #c9d1d9;
}

[data-bs-theme="dark"] .page-content {
    background-color: #010409 !important;
}

/* Topbar */
[data-bs-theme="dark"] .top-header .navbar,
[data-bs-theme="dark"] .top-header,
[data-bs-theme="dark"] .header-wrapper {
    background-color: #161b22 !important;
    border-bottom: 1px solid #30363d !important;
    box-shadow: none !important;
}

/* Sidebar */
[data-bs-theme="dark"] .sidebar-wrapper,
[data-bs-theme="dark"] .sidebar-header,
[data-bs-theme="dark"] .simplebar-content-wrapper,
[data-bs-theme="dark"] .metismenu {
    background-color: #010409 !important;
    border-right: 1px solid #30363d !important;
}
[data-bs-theme="dark"] .sidebar-header {
    border-bottom: 1px solid #30363d !important;
}
[data-bs-theme="dark"] .metismenu a {
    color: #c9d1d9 !important;
}
[data-bs-theme="dark"] .metismenu a:hover,
[data-bs-theme="dark"] .metismenu a:focus,
[data-bs-theme="dark"] .metismenu a.mm-active {
    background-color: rgba(56, 139, 253, 0.15) !important;
    color: #58a6ff !important;
}
[data-bs-theme="dark"] .menu-title {
    color: #6e7681 !important;
}

/* Footer */
[data-bs-theme="dark"] .page-footer {
    background-color: #161b22 !important;
    border-top: 1px solid #30363d !important;
    color: #8b949e !important;
}

/* ---------- Cards / surfaces ---------- */
[data-bs-theme="dark"] .card {
    background-color: #161b22 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9;
}
[data-bs-theme="dark"] .card .card-header,
[data-bs-theme="dark"] .card .card-footer {
    background-color: transparent !important;
    border-color: #30363d !important;
}
[data-bs-theme="dark"] .list-group {
    background-color: transparent;
}
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .list-group-flush > .list-group-item {
    background-color: transparent !important;
    border-color: #30363d !important;
    color: #c9d1d9;
}
[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-end,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start {
    border-color: #30363d !important;
}

/* ---------- Tables ---------- */
[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #c9d1d9;
    --bs-table-border-color: #30363d;
    --bs-table-striped-bg: rgba(177, 186, 196, 0.05);
    --bs-table-hover-bg: rgba(177, 186, 196, 0.08);
    color: #c9d1d9;
}

/* ---------- Forms ---------- */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    background-color: #0d1117 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #0d1117 !important;
    border-color: #58a6ff !important;
    box-shadow: 0 0 0 0.2rem rgba(56, 139, 253, 0.25) !important;
    color: #c9d1d9 !important;
}
[data-bs-theme="dark"] .form-control::placeholder { color: #6e7681 !important; }
[data-bs-theme="dark"] .form-check-input {
    background-color: #0d1117;
    border-color: #30363d;
}
[data-bs-theme="dark"] .form-check-input:checked {
    background-color: #1f6feb;
    border-color: #1f6feb;
}

/* ---------- Buttons ---------- */
[data-bs-theme="dark"] .btn-light {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}
[data-bs-theme="dark"] .btn-light:hover {
    background-color: #30363d !important;
    color: #f0f6fc !important;
}
[data-bs-theme="dark"] .btn-outline-secondary {
    color: #c9d1d9 !important;
    border-color: #30363d !important;
}
[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #21262d !important;
    color: #f0f6fc !important;
}
[data-bs-theme="dark"] .btn-primary {
    background-color: #238636 !important;  /* GitHub primary green */
    border-color: #238636 !important;
}
[data-bs-theme="dark"] .btn-primary:hover {
    background-color: #2ea043 !important;
    border-color: #2ea043 !important;
}

/* ---------- Misc ---------- */
[data-bs-theme="dark"] .text-muted { color: #8b949e !important; }
[data-bs-theme="dark"] .text-secondary { color: #8b949e !important; }
[data-bs-theme="dark"] .bg-light { background-color: #21262d !important; color: #c9d1d9 !important; }
[data-bs-theme="dark"] .bg-white { background-color: #161b22 !important; color: #c9d1d9 !important; }
[data-bs-theme="dark"] code:not(pre code) {
    background-color: rgba(110, 118, 129, 0.4);
    color: #c9d1d9;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}
[data-bs-theme="dark"] hr { border-color: #30363d; opacity: 1; }
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #161b22;
    border: 1px solid #30363d;
}
[data-bs-theme="dark"] .dropdown-item {
    color: #c9d1d9;
}
[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(56, 139, 253, 0.15);
    color: #58a6ff;
}
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .offcanvas {
    background-color: #161b22;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

/* Auth cover (login) */
[data-bs-theme="dark"] .section-authentication-cover,
[data-bs-theme="dark"] .auth-cover-left,
[data-bs-theme="dark"] .auth-cover-right {
    background-color: #0d1117 !important;
}

/* Markdown content blocks */
[data-bs-theme="dark"] .md-content pre,
[data-bs-theme="dark"] .md-content code {
    background-color: #161b22;
    color: #c9d1d9;
    border-color: #30363d;
}
[data-bs-theme="dark"] .md-content blockquote {
    border-left-color: #30363d;
    color: #8b949e;
}
[data-bs-theme="dark"] .md-content table th,
[data-bs-theme="dark"] .md-content table td {
    border-color: #30363d;
}

/* Mermaid */
[data-bs-theme="dark"] .mermaid {
    background-color: #161b22;
    border-radius: 6px;
    padding: 0.5rem;
}
