html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* =========================
   Prometheus Theme System
   ========================= */

:root {
    --pt-bg: #f8fafc;
    --pt-surface: #ffffff;
    --pt-surface-soft: #f1f5f9;
    --pt-text: #111827;
    --pt-muted: #6b7280;
    --pt-border: #e5e7eb;
    --pt-card-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
}

[data-theme="dark"] {
    --pt-bg: #0f172a;
    --pt-surface: #111827;
    --pt-surface-soft: #1f2937;
    --pt-text: #e5e7eb;
    --pt-muted: #9ca3af;
    --pt-border: #374151;
    --pt-card-shadow: 0 .125rem .5rem rgba(0, 0, 0, .35);
}

body {
    background: var(--pt-bg);
    color: var(--pt-text);
}

.card,
.modal-content,
.dropdown-menu,
.list-group-item,
.table,
.alert-light {
    background-color: var(--pt-surface);
    color: var(--pt-text);
    border-color: var(--pt-border);
}

.card-header,
.card-footer {
    background-color: var(--pt-surface-soft);
    color: var(--pt-text);
    border-color: var(--pt-border);
}

.card.shadow-sm {
    box-shadow: var(--pt-card-shadow) !important;
}

.text-muted,
.form-text {
    color: var(--pt-muted) !important;
}

.border,
.table,
.table th,
.table td {
    border-color: var(--pt-border) !important;
}

.form-control,
.form-select {
    background-color: var(--pt-surface);
    color: var(--pt-text);
    border-color: var(--pt-border);
}

    .form-control:focus,
    .form-select:focus {
        background-color: var(--pt-surface);
        color: var(--pt-text);
    }

    .form-control::placeholder {
        color: var(--pt-muted);
    }

.navbar {
    background-color: var(--pt-surface) !important;
    border-color: var(--pt-border) !important;
}

    .navbar-brand,
    .nav-link,
    .navbar .btn {
        color: var(--pt-text);
    }

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: var(--pt-surface-soft);
    color: var(--pt-text);
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: rgba(96, 165, 250, 0.12);
    color: var(--pt-text);
}

[data-theme="dark"] .btn-outline-secondary {
    color: #d1d5db;
    border-color: #4b5563;
}

    [data-theme="dark"] .btn-outline-secondary:hover {
        background-color: #374151;
        color: #ffffff;
    }

[data-theme="dark"] .btn-outline-primary {
    color: #93c5fd;
    border-color: #3b82f6;
}

[data-theme="dark"] .badge.bg-light {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
    border-color: #374151 !important;
}

[data-theme="dark"] code {
    color: #f9a8d4;
}

[data-theme="dark"] .alert-info {
    background-color: #0c4a6e;
    color: #e0f2fe;
    border-color: #0369a1;
}

[data-theme="dark"] .alert-warning {
    background-color: #713f12;
    color: #fef3c7;
    border-color: #a16207;
}

[data-theme="dark"] .alert-danger {
    background-color: #7f1d1d;
    color: #fee2e2;
    border-color: #b91c1c;
}

[data-theme="dark"] .alert-success {
    background-color: #14532d;
    color: #dcfce7;
    border-color: #15803d;
}

.theme-toggle-btn {
    white-space: nowrap;
}

/* =========================
   Dark mode Bootstrap fixes
   ========================= */

[data-theme="dark"] {
    color-scheme: dark;
}

    /* Page + common surfaces */
    [data-theme="dark"] body,
    [data-theme="dark"] .container,
    [data-theme="dark"] .container-fluid {
        background-color: var(--pt-bg);
        color: var(--pt-text);
    }

    /* Cards */
    [data-theme="dark"] .card,
    [data-theme="dark"] .card-body,
    [data-theme="dark"] .modal-content,
    [data-theme="dark"] .list-group-item {
        background-color: var(--pt-surface);
        color: var(--pt-text);
        border-color: var(--pt-border);
    }

    [data-theme="dark"] .card-header,
    [data-theme="dark"] .card-footer {
        background-color: var(--pt-surface-soft) !important;
        color: var(--pt-text) !important;
        border-color: var(--pt-border) !important;
    }

        /* Collapsible permission header button */
        [data-theme="dark"] button.card-header,
        [data-theme="dark"] .card-header.bg-white,
        [data-theme="dark"] .bg-white {
            background-color: var(--pt-surface-soft) !important;
            color: var(--pt-text) !important;
        }

    /* Tables */
    [data-theme="dark"] .table {
        --bs-table-color: var(--pt-text);
        --bs-table-bg: var(--pt-surface);
        --bs-table-border-color: var(--pt-border);
        --bs-table-striped-bg: #1f2937;
        --bs-table-striped-color: var(--pt-text);
        --bs-table-hover-bg: #273449;
        --bs-table-hover-color: var(--pt-text);
        color: var(--pt-text) !important;
        border-color: var(--pt-border) !important;
    }

        [data-theme="dark"] .table thead,
        [data-theme="dark"] .table thead tr,
        [data-theme="dark"] .table thead th {
            background-color: var(--pt-surface-soft) !important;
            color: var(--pt-text) !important;
            border-color: var(--pt-border) !important;
        }

        [data-theme="dark"] .table tbody,
        [data-theme="dark"] .table tbody tr,
        [data-theme="dark"] .table tbody td {
            color: var(--pt-text) !important;
            border-color: var(--pt-border) !important;
        }

    [data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
        background-color: #1f2937 !important;
        color: var(--pt-text) !important;
    }

    [data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > * {
        background-color: var(--pt-surface) !important;
        color: var(--pt-text) !important;
    }

    [data-theme="dark"] .table-hover > tbody > tr:hover > * {
        background-color: #273449 !important;
        color: var(--pt-text) !important;
    }

    /* Fix Bootstrap text utilities inside dark mode */
    [data-theme="dark"] .text-dark {
        color: var(--pt-text) !important;
    }

    [data-theme="dark"] .text-muted {
        color: var(--pt-muted) !important;
    }

    /* Links */
    [data-theme="dark"] a {
        color: #93c5fd;
    }

        [data-theme="dark"] a:hover {
            color: #bfdbfe;
        }

    /* Forms */
    [data-theme="dark"] .form-control,
    [data-theme="dark"] .form-select {
        background-color: var(--pt-surface);
        color: var(--pt-text);
        border-color: var(--pt-border);
    }

        [data-theme="dark"] .form-control:disabled,
        [data-theme="dark"] .form-select:disabled {
            background-color: #111827;
            color: var(--pt-muted);
        }

    /* Dropdown options */
    [data-theme="dark"] option {
        background-color: var(--pt-surface);
        color: var(--pt-text);
    }

    /* List groups */
    [data-theme="dark"] .list-group-item {
        background-color: var(--pt-surface);
        color: var(--pt-text);
        border-color: var(--pt-border);
    }

        [data-theme="dark"] .list-group-item.active {
            background-color: #0d6efd !important;
            border-color: #0d6efd !important;
            color: #ffffff !important;
        }

    /* Light alerts/cards used as helper boxes */
    [data-theme="dark"] .alert-light {
        background-color: var(--pt-surface-soft) !important;
        color: var(--pt-text) !important;
        border-color: var(--pt-border) !important;
    }

    /* Badges/buttons contrast */
    [data-theme="dark"] .badge.bg-info {
        color: #082f49 !important;
    }

    [data-theme="dark"] .badge.bg-warning {
        color: #422006 !important;
    }

    /* Horizontal rules */
    [data-theme="dark"] hr {
        border-color: var(--pt-border);
        opacity: 1;
    }

.card-header[data-bs-toggle="collapse"] {
    cursor: pointer;
}

    .card-header[data-bs-toggle="collapse"]:hover {
        background: var(--pt-surface-soft) !important;
    }

/* =========================
   Dark mode button text fixes
   ========================= */

[data-theme="dark"] a.btn-primary,
[data-theme="dark"] button.btn-primary,
[data-theme="dark"] .btn-primary {
    color: #ffffff !important;
}

[data-theme="dark"] a.btn-success,
[data-theme="dark"] button.btn-success,
[data-theme="dark"] .btn-success {
    color: #ffffff !important;
}

[data-theme="dark"] a.btn-danger,
[data-theme="dark"] button.btn-danger,
[data-theme="dark"] .btn-danger {
    color: #ffffff !important;
}

[data-theme="dark"] a.btn-secondary,
[data-theme="dark"] button.btn-secondary,
[data-theme="dark"] .btn-secondary {
    color: #ffffff !important;
}

[data-theme="dark"] a.btn-outline-secondary,
[data-theme="dark"] button.btn-outline-secondary,
[data-theme="dark"] .btn-outline-secondary {
    color: #e5e7eb !important;
}

[data-theme="dark"] a.btn-outline-primary,
[data-theme="dark"] button.btn-outline-primary,
[data-theme="dark"] .btn-outline-primary {
    color: #bfdbfe !important;
}

[data-theme="dark"] a.btn-warning,
[data-theme="dark"] button.btn-warning,
[data-theme="dark"] .btn-warning {
    color: #111827 !important;
}

[data-theme="dark"] a.btn-info,
[data-theme="dark"] button.btn-info,
[data-theme="dark"] .btn-info {
    color: #082f49 !important;
}