/* =========================================================================
   PythonClassroom — Global Styles
   ========================================================================= */

/* ── Design Tokens ── */
:root {
    --primary-color: #306998;
    --secondary-color: #53b2ff;
    --tertiary-color: #ffbe1f;
}

/* ── Base Layout ── */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Skip-to-Content Link ── */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100000;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 0 0 0.375rem 0.375rem;
    font-weight: 600;
}
.skip-to-content:focus {
    left: 0;
}

/* ── Public Navbar Brand ── */
.navbar-brand {
    font-weight: 700;
    color: var(--primary-color) !important;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand img {
    height: 32px;
    width: auto;
}

/* ── Cards ── */
.card {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
}

/* ── Buttons ── */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* ── Status Badges ── */
.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* ── Code Editor ── */
.code-editor {
    height: 400px;
    border: 1px solid #ddd;
    border-radius: 0.375rem;
}

.CodeMirror {
    height: 100%;
    font-size: 14px;
}

.CodeMirror-lines {
    padding-bottom: 10px !important;
}
.CodeMirror-scroll {
    padding-bottom: 10px;
}

/* ── Output Panel ── */
.output-panel {
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', monospace;
    padding: 1rem;
    border-radius: 0.375rem;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
}

/* ── Test Case Cards ── */
.test-case-card {
    border-left: 4px solid #ddd;
}

.test-case-card.passed {
    border-left-color: #22c55e;
}

.test-case-card.failed {
    border-left-color: #ef4444;
}

/* ── Enhanced Breadcrumb Styles ── */
.breadcrumb-wrapper {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.breadcrumb-wrapper .breadcrumb {
    margin-bottom: 0;
    background: transparent;
    padding: 0;
}

.breadcrumb-wrapper .breadcrumb-item {
    font-size: 0.9rem;
}

.breadcrumb-wrapper .breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.breadcrumb-wrapper .breadcrumb-item a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.breadcrumb-wrapper .breadcrumb-item.active {
    color: #495057;
    font-weight: 600;
}

.breadcrumb-wrapper .breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    color: #6c757d;
    font-weight: 400;
    padding-right: 0.5rem;
}

.breadcrumb-wrapper .breadcrumb-icon {
    margin-right: 0.35rem;
    opacity: 0.7;
}

/* ── Rich Text Content Styles ── */
.problem-description, .rich-text-content {
    line-height: 1.7;
}

.problem-description h1,
.problem-description h2,
.problem-description h3,
.problem-description h4,
.problem-description h5,
.problem-description h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.problem-description pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
}

.problem-description code {
    background-color: #f8f9fa;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.problem-description pre code {
    background-color: transparent;
    padding: 0;
}

.problem-description table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.problem-description table th,
.problem-description table td {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
}

.problem-description table th {
    background-color: #f8f9fa;
}

.problem-description img {
    max-width: 100%;
    height: auto;
}

.problem-description blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin-left: 0;
    color: #6c757d;
}

/* ── Theme Toggle Button ── */
.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 0.375rem;
    color: #858796;
    transition: color 0.2s;
}

.theme-toggle-btn:hover {
    color: var(--primary-color);
}

[data-bs-theme="light"] .theme-toggle-btn .bi-sun-fill { display: none; }
[data-bs-theme="dark"] .theme-toggle-btn .bi-moon-fill { display: none; }

/* ── Sidebar Badge ── */
.sidebar .nav-item .nav-link .badge {
    font-size: 0.6rem;
    vertical-align: middle;
}

/* ===== Mobile Responsive Enhancements ===== */

@media (max-width: 767.98px) {
    /* Headings scale down */
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }

    /* Button groups wrap instead of overflow */
    .btn-group {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .btn-group > .btn,
    .btn-group > form > .btn {
        border-radius: 0.375rem !important;
    }

    /* d-flex rows wrap on mobile */
    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Cards get less padding on mobile */
    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.5rem 0.75rem;
    }

    /* Footer smaller text */
    footer small {
        font-size: 0.75rem;
    }

    /* Breadcrumb compact styling */
    .breadcrumb-wrapper {
        padding: 0.5rem 0.75rem;
        margin-bottom: 1rem;
    }

    .breadcrumb-wrapper .breadcrumb-item {
        font-size: 0.8rem;
    }

    /* Tables always scrollable on mobile */
    .table {
        font-size: 0.85rem;
    }

    /* Input groups don't overflow */
    .input-group {
        max-width: 100% !important;
    }

    /* Selects with inline min-width don't overflow */
    select.form-select {
        max-width: 100% !important;
    }

    /* Stack form rows on mobile */
    .row > [class*="col-md-"],
    .row > [class*="col-lg-"] {
        margin-bottom: 0.5rem;
    }

    /* Make code blocks scrollable */
    pre, .output-panel {
        font-size: 12px;
        max-width: 100vw;
    }

    /* Code editor: auto height on mobile */
    .code-editor {
        height: auto;
        min-height: 200px;
        max-height: 350px;
    }

    .CodeMirror {
        border-radius: 0.25rem;
    }

    /* Navbar brand smaller */
    .navbar-brand {
        font-size: 1rem;
    }

    /* Badge sizing */
    .badge {
        font-size: 0.7rem;
    }

    .form-text {
        font-size: 0.75rem;
    }
}

/* Tablet tweaks */
@media (min-width: 768px) and (max-width: 991.98px) {
    h2 { font-size: 1.5rem; }

    .btn-group {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
}

/* Utility: force wrap on mobile */
.mobile-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ── Dark Mode Overrides ── */
[data-bs-theme="dark"] .breadcrumb-wrapper {
    background: linear-gradient(135deg, #2b3035 0%, #343a40 100%);
}

[data-bs-theme="dark"] .breadcrumb-wrapper .breadcrumb-item.active {
    color: #d1d3e2;
}

[data-bs-theme="dark"] .output-panel {
    background-color: #0d1117;
}

[data-bs-theme="dark"] .problem-description pre {
    background-color: #2b3035;
}

[data-bs-theme="dark"] .problem-description code {
    background-color: #2b3035;
}

@media (max-width: 767.98px) {
    .mobile-stack {
        flex-direction: column;
        align-items: stretch;
    }

    .mobile-stack > * {
        width: 100%;
    }
}

/* Make all table containers responsive by default */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* ===== What's New Modal Styles ===== */
.whats-new-modal .modal-content {
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
    border: none;
}
.whats-new-modal #whatsNewVersionSelect {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    border-color: rgba(255,255,255,0.3);
    background-color: rgba(255,255,255,0.15);
    color: white;
}
.whats-new-modal #whatsNewVersionSelect option { color: #333; background: white; }
.whats-new-modal .modal-header {
    background: var(--primary-color);
    color: white;
    border-bottom: none;
}
.whats-new-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}
.whats-new-modal .modal-title {
    font-weight: 700;
}
.whats-new-release-card {
    border: none;
    border-radius: 0.75rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}
.whats-new-release-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1) !important;
}
.whats-new-release-card .card-body { padding: 0; }
.whats-new-release-card .card-collapse-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
}
.whats-new-release-card .card-collapse-trigger .collapse-chevron {
    transition: transform 0.2s ease;
    color: #adb5bd;
    flex-shrink: 0;
}
.whats-new-release-card:not(.collapsed) .card-collapse-trigger .collapse-chevron {
    transform: rotate(180deg);
}
.whats-new-release-card .card-collapse-body {
    padding: 0 0.75rem 0.75rem 0.75rem;
}
.whats-new-release-header {
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.whats-new-release-header:hover {
    background-color: rgba(0,0,0,0.02);
}
.whats-new-release-header .collapse-chevron {
    transition: transform 0.2s ease;
    color: #adb5bd;
}
.whats-new-release-header:not(.collapsed) .collapse-chevron {
    transform: rotate(180deg);
}
.whats-new-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.whats-new-feature-icon.icon-danger { background-color: #fde8e8; color: #dc3545; }
.whats-new-feature-icon.icon-primary { background-color: #e7f1ff; color: #0d6efd; }
.whats-new-feature-icon.icon-success { background-color: #e6f9ee; color: #198754; }
.whats-new-feature-icon.icon-info { background-color: #e0f7fa; color: #0dcaf0; }
.whats-new-feature-icon.icon-warning { background-color: #fff8e1; color: #ffc107; }
.whats-new-nav-btn {
    position: relative;
}
.whats-new-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background-color: #dc3545;
    border-radius: 50%;
    border: 1.5px solid white;
}
.whats-new-scroll {
    max-height: 420px;
    overflow-y: auto;
}
@media (max-width: 767.98px) {
    .whats-new-scroll { max-height: 55vh; }
    .whats-new-feature-icon { width: 36px; height: 36px; font-size: 1rem; }
}

/* ── Login Splash Screen ── */
/* Hide page instantly when splash is pending (set in <head> before paint) */
html.splash-pending body > *:not(#loginSplash) {
    visibility: hidden;
}
html.splash-pending #loginSplash {
    display: flex;
    align-items: center;
    justify-content: center;
}

#loginSplash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    background: #fff;
    overflow: hidden;
}
#loginSplash.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

#loginSplash .splash-img {
    display: block;
    max-width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transform: scale(1.05);
    animation: splashIn 2.4s ease-out forwards;
}

#loginSplash.fade-out {
    animation: splashFadeOut 0.5s ease-in forwards;
}

/* Hide page content behind splash */
body.splash-active > *:not(#loginSplash) {
    visibility: hidden;
}

@keyframes splashIn {
    0%   { opacity: 0; transform: scale(1.05); }
    20%  { opacity: 1; }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes splashFadeOut {
    to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    #loginSplash .splash-img,
    #loginSplash.fade-out {
        animation-duration: 0.01s !important;
    }
}

/* =========================================================================
   Dark Mode Overrides (Bootstrap 5.3 native via data-bs-theme="dark")
   ========================================================================= */

[data-bs-theme="dark"] {
    /* Override app-specific custom properties for dark mode */
    --primary-color: #5ba0d0;
    --secondary-color: #7bbde6;
    --tertiary-color: #d9a520;
}

/* ── Navbar Dark Mode ── */
[data-bs-theme="dark"] .navbar {
    background-color: var(--bs-body-bg) !important;
}

/* ── Hero Section Dark Mode ── */
[data-bs-theme="dark"] .hero-section::before {
    background: rgba(33, 37, 41, 0.88);
}

/* ── Sidebar Dark Mode ── */
[data-bs-theme="dark"] .sidebar {
    background-color: var(--bs-tertiary-bg);
    border-right-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .sidebar .nav-link {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .sidebar .nav-link:hover {
    background-color: var(--bs-secondary-bg);
}

[data-bs-theme="dark"] .sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* ── Cards Dark Mode ── */
[data-bs-theme="dark"] .card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
}

/* ── Footer Dark Mode ── */
[data-bs-theme="dark"] footer {
    background-color: var(--bs-tertiary-bg);
    border-top-color: var(--bs-border-color);
}

/* ── Breadcrumb Dark Mode ── */
[data-bs-theme="dark"] .breadcrumb-wrapper {
    background: linear-gradient(135deg, var(--bs-tertiary-bg) 0%, var(--bs-secondary-bg) 100%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

[data-bs-theme="dark"] .breadcrumb-wrapper .breadcrumb-item.active {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .breadcrumb-wrapper .breadcrumb-item + .breadcrumb-item::before {
    color: var(--bs-secondary-color);
}

/* ── Code Editor Dark Mode ── */
[data-bs-theme="dark"] .code-editor {
    border-color: var(--bs-border-color);
}

/* ── Test Case Cards Dark Mode ── */
[data-bs-theme="dark"] .test-case-card {
    border-left-color: var(--bs-border-color);
}

/* ── Rich Text Content Dark Mode ── */
[data-bs-theme="dark"] .problem-description pre {
    background-color: var(--bs-secondary-bg);
}

[data-bs-theme="dark"] .problem-description code {
    background-color: var(--bs-secondary-bg);
}

[data-bs-theme="dark"] .problem-description table th,
[data-bs-theme="dark"] .problem-description table td {
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .problem-description table th {
    background-color: var(--bs-secondary-bg);
}

[data-bs-theme="dark"] .problem-description blockquote {
    color: var(--bs-secondary-color);
}

/* ── What's New Modal Dark Mode ── */
[data-bs-theme="dark"] .whats-new-modal #whatsNewVersionSelect option {
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .whats-new-release-card {
    background-color: var(--bs-secondary-bg) !important;
}

[data-bs-theme="dark"] .whats-new-release-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.3) !important;
}

[data-bs-theme="dark"] .whats-new-release-header:hover {
    background-color: rgba(255,255,255,0.05);
}

[data-bs-theme="dark"] .whats-new-feature-icon.icon-danger { background-color: rgba(220, 53, 69, 0.2); }
[data-bs-theme="dark"] .whats-new-feature-icon.icon-primary { background-color: rgba(13, 110, 253, 0.2); }
[data-bs-theme="dark"] .whats-new-feature-icon.icon-success { background-color: rgba(25, 135, 84, 0.2); }
[data-bs-theme="dark"] .whats-new-feature-icon.icon-info { background-color: rgba(13, 202, 240, 0.2); }
[data-bs-theme="dark"] .whats-new-feature-icon.icon-warning { background-color: rgba(255, 193, 7, 0.2); }

[data-bs-theme="dark"] .whats-new-dot {
    border-color: var(--bs-body-bg);
}

/* ── Login Splash Screen Dark Mode ── */
[data-bs-theme="dark"] #loginSplash {
    background: var(--bs-body-bg);
}

/* ── Dark Mode Toggle Button ── */
.theme-toggle-btn {
    background: none;
    border: none;
    padding: 0.375rem 0.5rem;
    font-size: 1.1rem;
    color: var(--bs-body-color);
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease;
    line-height: 1;
}

.theme-toggle-btn:hover {
    background-color: var(--bs-secondary-bg);
}

.theme-toggle-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.theme-toggle-btn .bi-sun-fill { display: none; }
.theme-toggle-btn .bi-moon-fill { display: inline; }

[data-bs-theme="dark"] .theme-toggle-btn .bi-sun-fill { display: inline; }
[data-bs-theme="dark"] .theme-toggle-btn .bi-moon-fill { display: none; }

/* Respect system preference when no manual selection */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .theme-toggle-btn .bi-sun-fill { display: inline; }
    :root:not([data-bs-theme]) .theme-toggle-btn .bi-moon-fill { display: none; }
}

/* ── Dark Mode: bg-light Override ── */
/* Bootstrap's bg-light doesn't adapt to dark mode. This override maps it to bg-body-tertiary. */
[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
}

/* Also fix bg-light badges */
[data-bs-theme="dark"] .badge.bg-light {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

/* ── Dark Mode: table-light Override ── */
/* Bootstrap's table-light doesn't adapt to dark mode (used in leaderboard for empty cells). */
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table > tbody > tr > .table-light,
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > .table-light {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-secondary-color);
}

/* ── Dark Mode: table-dark header contrast fix ── */
/* In dark mode, table-dark blends with the background, so we add contrast */
[data-bs-theme="dark"] .table-dark,
[data-bs-theme="dark"] .table-dark > th,
[data-bs-theme="dark"] .table-dark > td {
    --bs-table-bg: #1a1d20;
    --bs-table-striped-bg: #1a1d20;
    --bs-table-hover-bg: #1a1d20;
    --bs-table-border-color: #343a40;
    background-color: #1a1d20 !important;
    border-bottom: 2px solid #495057;
}

/* Ensure dynamically generated header content also inherits styling */
[data-bs-theme="dark"] thead.table-dark th {
    background-color: #1a1d20 !important;
    border-bottom-color: #495057;
}

/* ── Dark Mode: table-striped contrast fix ── */
/* Ensure striped rows have visible contrast in dark mode */
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > *,
[data-bs-theme="dark"] .table-striped-columns > tbody > tr > :nth-child(even) {
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
}

/* ── Dark Mode: table-hover contrast fix ── */
[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
}

/* ── Dark Mode: Leaderboard "your row" highlight ── */
[data-bs-theme="dark"] .you-row,
[data-bs-theme="dark"] .you-row td {
    background-color: rgba(255, 193, 7, 0.15) !important;
}

/* ── Dark Mode: Task Card Styles ── */
/* These are defined inline in student/view_section.html but need dark mode overrides */

/* Problem item hover */
[data-bs-theme="dark"] .problem-item:hover {
    background-color: var(--bs-secondary-bg) !important;
}

/* Problem item states */
[data-bs-theme="dark"] .problem-item.passed,
[data-bs-theme="dark"] .problem-item.solved {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

[data-bs-theme="dark"] .problem-item.failed {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* Task card states */
[data-bs-theme="dark"] .task-scheduled {
    background-color: var(--bs-tertiary-bg) !important;
    border-color: var(--bs-secondary-color) !important;
}

[data-bs-theme="dark"] .task-scheduled .card-header {
    background-color: var(--bs-secondary-bg) !important;
}

[data-bs-theme="dark"] .task-scheduled .progress-circle {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-secondary-color) !important;
}

/* Progress circle - default 0% state */
[data-bs-theme="dark"] .progress-circle.bg-light {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

/* ── Dark Mode: Button Overrides ── */
/* btn-light is nearly white and looks jarring in dark mode */
[data-bs-theme="dark"] .btn-light {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}
[data-bs-theme="dark"] .btn-light:hover {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

/* btn-outline-secondary border is nearly invisible on dark backgrounds */
[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: var(--bs-secondary-color);
    color: var(--bs-secondary-color);
}
[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--bs-secondary-color);
    color: var(--bs-body-bg);
}

/* btn-warning solid is too bright in dark mode — tone it down */
[data-bs-theme="dark"] .btn-warning {
    background-color: #997404;
    border-color: #8a6803;
    color: #fff;
}
[data-bs-theme="dark"] .btn-warning:hover {
    background-color: #8a6803;
    border-color: #7a5c02;
    color: #fff;
}

/* btn-outline-warning contrast fix */
[data-bs-theme="dark"] .btn-outline-warning {
    border-color: #cca020;
    color: #cca020;
}
[data-bs-theme="dark"] .btn-outline-warning:hover {
    background-color: #cca020;
    color: #000;
}

/* btn-info solid is too bright in dark mode */
[data-bs-theme="dark"] .btn-info {
    background-color: #0a8a9d;
    border-color: #097b8c;
    color: #fff;
}
[data-bs-theme="dark"] .btn-info:hover {
    background-color: #097b8c;
    border-color: #086c7a;
    color: #fff;
}

/* btn-outline-info contrast fix */
[data-bs-theme="dark"] .btn-outline-info {
    border-color: #17a2b8;
    color: #17a2b8;
}
[data-bs-theme="dark"] .btn-outline-info:hover {
    background-color: #17a2b8;
    color: #000;
}

/* btn-outline-success contrast fix */
[data-bs-theme="dark"] .btn-outline-success {
    border-color: #28a745;
    color: #28a745;
}
[data-bs-theme="dark"] .btn-outline-success:hover {
    background-color: #28a745;
    color: #fff;
}

/* btn-outline-danger contrast fix */
[data-bs-theme="dark"] .btn-outline-danger {
    border-color: #dc3545;
    color: #dc3545;
}
[data-bs-theme="dark"] .btn-outline-danger:hover {
    background-color: #dc3545;
    color: #fff;
}

/* btn-outline-primary contrast fix */
[data-bs-theme="dark"] .btn-outline-primary {
    border-color: #5ba0d0;
    color: #5ba0d0;
}
[data-bs-theme="dark"] .btn-outline-primary:hover {
    background-color: #5ba0d0;
    color: #000;
}

/* btn-success solid — slightly muted for dark mode */
[data-bs-theme="dark"] .btn-success {
    background-color: #1e7e3e;
    border-color: #1c7439;
}
[data-bs-theme="dark"] .btn-success:hover {
    background-color: #1c7439;
    border-color: #1a6c34;
}

/* btn-danger solid — slightly muted for dark mode */
[data-bs-theme="dark"] .btn-danger {
    background-color: #c82333;
    border-color: #bd2130;
}
[data-bs-theme="dark"] .btn-danger:hover {
    background-color: #bd2130;
    border-color: #b21f2d;
}

/* btn-primary solid — adjusted for dark mode */
[data-bs-theme="dark"] .btn-primary {
    background-color: #2a5f8f;
    border-color: #265680;
}
[data-bs-theme="dark"] .btn-primary:hover {
    background-color: #265680;
    border-color: #224d72;
}

/* btn-secondary solid — adjusted for dark mode */
[data-bs-theme="dark"] .btn-secondary {
    background-color: #5a6268;
    border-color: #545b62;
}
[data-bs-theme="dark"] .btn-secondary:hover {
    background-color: #545b62;
    border-color: #4e555b;
}

/* btn-dark — ensure it stays readable */
[data-bs-theme="dark"] .btn-dark {
    background-color: #212529;
    border-color: #1d2124;
    color: #fff;
}
[data-bs-theme="dark"] .btn-dark:hover {
    background-color: #1d2124;
    border-color: #1a1d20;
}

/* ── Dark Mode: Navbar ── */
[data-bs-theme="dark"] .navbar-light.bg-white {
    background-color: var(--bs-body-bg) !important;
    border-bottom-color: var(--bs-border-color);
}

/* ── Dark Mode: Inline hardcoded green backgrounds ── */
[data-bs-theme="dark"] [style*="background:#198754"],
[data-bs-theme="dark"] [style*="background: #198754"] {
    background-color: #146c43 !important;
}

/* ── Dark Mode: Modal headers with bg-warning ── */
[data-bs-theme="dark"] .modal-header.bg-warning {
    background-color: #997404 !important;
    color: #fff !important;
}
