/* Dark mode styles for Flask Client Portal */
/* Extracted from layout.html for better caching and performance */

/* Base dark mode variables */
[data-theme="dark"] {
    --bs-body-bg: #212529;
    --bs-body-color: #e9ecef;
    --bs-card-bg: #2c3034;
    --bs-card-border-color: #373b3e;
    --bs-border-color: #373b3e;
    --bs-table-bg: #2c3034;
    --bs-table-striped-bg: #343a40;
    --bs-table-hover-bg: #373b3e;
    --bs-table-border-color: #373b3e;
    --bs-table-color: #e9ecef !important;
    --bs-table-hover-color: #fff;
    --bs-table-striped-color: #e9ecef;
    --bs-table-active-bg: #373b3e;
    --bs-table-active-color: #fff;
    color-scheme: dark;
}

/* Navbar */
[data-theme="dark"] .navbar {
    background-color: #343a40 !important;
}
[data-theme="dark"] .navbar-light .navbar-brand,
[data-theme="dark"] .navbar-light .navbar-nav .nav-link {
    color: #f8f9fa !important;
}
[data-theme="dark"] .navbar-light .navbar-toggler {
    border-color: #f8f9fa;
}
[data-theme="dark"] .navbar-light .navbar-toggler-icon {
    filter: invert(1);
}

/* Cards */
[data-theme="dark"] .card {
    background-color: #343a40;
    border-color: #495057;
}
[data-theme="dark"] .card-header {
    background-color: #495057;
    border-color: #495057;
    color: #f8f9fa;
}
[data-theme="dark"] .card-body {
    color: #f8f9fa;
}

/* Lists */
[data-theme="dark"] .list-group-item {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}

/* Dropdowns */
[data-theme="dark"] .dropdown-menu {
    background-color: #343a40;
    border-color: #495057;
}
[data-theme="dark"] .dropdown-item {
    color: #f8f9fa;
}
[data-theme="dark"] .dropdown-item:hover {
    background-color: #495057;
    color: #f8f9fa;
}
[data-theme="dark"] .dropdown-divider {
    border-color: #495057;
}

/* Tables */
[data-theme="dark"] .table {
    --bs-table-color: #e9ecef !important;
    color: #ffffff !important;
    border-color: var(--bs-table-border-color);
}
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
    --bs-table-accent-bg: var(--bs-table-striped-bg);
    color: var(--bs-table-striped-color);
    --bs-table-color-type: #ffffff !important;
}
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) {
    --bs-table-accent-bg: var(--bs-table-bg);
    color: #ffffff;
    --bs-table-color-type: #ffffff !important;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(2n+1) > * {
    --bs-table-accent-bg: var(--bs-table-bg);
    color: #ffffff;
    --bs-table-color-type: #ffffff !important;
}
[data-theme="dark"] .table-hover > tbody > tr:hover {
    --bs-table-accent-bg: var(--bs-table-hover-bg);
    color: #ffffff;
}
[data-theme="dark"] .table-bordered {
    border-color: var(--bs-table-border-color);
}
[data-theme="dark"] .table-bordered th,
[data-theme="dark"] .table-bordered td {
    border-color: var(--bs-table-border-color);
}
[data-theme="dark"] .table thead th {
    border-bottom-color: var(--bs-table-border-color);
    background-color: var(--bs-table-bg);
    color: #ffffff;
}
[data-theme="dark"] .table tbody + tbody {
    border-top-color: var(--bs-table-border-color);
}
[data-theme="dark"] .table-sm th,
[data-theme="dark"] .table-sm td {
    padding: 0.3rem;
}
[data-theme="dark"] .table-responsive {
    border-color: var(--bs-table-border-color);
}

/* Forms */
[data-theme="dark"] .form-control {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}
[data-theme="dark"] .form-control:focus {
    background-color: #343a40;
    border-color: #6c757d;
    color: #f8f9fa;
}
[data-theme="dark"] .form-label {
    color: #f8f9fa;
}
[data-theme="dark"] .form-text {
    color: #adb5bd;
}

/* Buttons */
[data-theme="dark"] .btn-light {
    background-color: #495057;
    border-color: #495057;
    color: #f8f9fa;
}
[data-theme="dark"] .btn-light:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #f8f9fa;
}

/* Alerts */
[data-theme="dark"] .alert {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}
[data-theme="dark"] .alert-success {
    background-color: #1e4620;
    border-color: #2a5a2a;
}
[data-theme="dark"] .alert-danger {
    background-color: #462020;
    border-color: #5a2a2a;
}
[data-theme="dark"] .alert-warning {
    background-color: #463d20;
    border-color: #5a4d2a;
}
[data-theme="dark"] .alert-info {
    background-color: #203546;
    border-color: #2a455a;
}

/* Badges */
[data-theme="dark"] .badge {
    color: #f8f9fa;
}

/* Modal */
[data-theme="dark"] .modal-content {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}
[data-theme="dark"] .modal-header {
    border-color: #495057;
}
[data-theme="dark"] .modal-footer {
    border-color: #495057;
}

/* Links */
[data-theme="dark"] a {
    color: #6ea8fe;
}
[data-theme="dark"] a:hover {
    color: #8bb9fe;
}

/* Text colors */
[data-theme="dark"] .text-muted {
    color: #adb5bd !important;
}
[data-theme="dark"] .text-dark {
    color: #f8f9fa !important;
}

/* Form switches */
[data-theme="dark"] .form-check-input {
    background-color: #495057;
    border-color: #6c757d;
}
[data-theme="dark"] .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* DataTables Dark Mode */
[data-theme="dark"] table.dataTable,
[data-theme="dark"] .dataTables_wrapper {
    color: #ffffff !important;
}

[data-theme="dark"] table.dataTable thead th,
[data-theme="dark"] table.dataTable tbody td {
    color: #ffffff !important;
    background-color: #2c3034 !important;
    border-color: #373b3e !important;
}

[data-theme="dark"] table.dataTable tbody tr.odd {
    background-color: #343a40 !important;
}

[data-theme="dark"] table.dataTable tbody tr.even {
    background-color: #2c3034 !important;
}

[data-theme="dark"] table.dataTable tbody tr:hover {
    background-color: #373b3e !important;
    color: #ffffff !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_processing,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: #ffffff !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #ffffff !important;
    background: #2c3034 !important;
    border-color: #373b3e !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #ffffff !important;
    background: #373b3e !important;
    border-color: #373b3e !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    color: #ffffff !important;
    background: #373b3e !important;
    border-color: #373b3e !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #6c757d !important;
    background: #2c3034 !important;
    border-color: #373b3e !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: #2c3034 !important;
    color: #ffffff !important;
    border-color: #373b3e !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: #2c3034 !important;
    color: #ffffff !important;
    border-color: #373b3e !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_processing {
    background-color: #2c3034 !important;
    color: #ffffff !important;
}

/* Override any inline styles */
[data-theme="dark"] table.dataTable tbody tr td,
[data-theme="dark"] table.dataTable thead th {
    color: #ffffff !important;
}

[data-theme="dark"] table.dataTable tbody tr.odd td {
    background-color: #343a40 !important;
}

[data-theme="dark"] table.dataTable tbody tr.even td {
    background-color: #2c3034 !important;
}

[data-theme="dark"] table.dataTable tbody tr:hover td {
    background-color: #373b3e !important;
    color: #ffffff !important;
}
