/* STScan custom styles */

.status-badge {
    font-size: 0.8rem;
}

.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.doc-type-tab.active {
    font-weight: bold;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

/* ── Light theme: muted steel-blue palette ── */
[data-bs-theme="light"] {
    --bs-body-bg: #e8ecf0;
    --bs-body-color: #2c3e50;
    --bs-link-color: #4a6785;
    --bs-link-hover-color: #34495e;
}

[data-bs-theme="light"] .card {
    --bs-card-bg: #fff;
    --bs-card-border-color: #c8d0d8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] .card-title a {
    color: #2c3e50;
}

[data-bs-theme="light"] .card-title a:hover {
    color: #4a6785;
}

/* Badges: vivid saturated colors */
[data-bs-theme="light"] .badge.bg-primary {
    background-color: #1565d8 !important;
    color: #fff !important;
    box-shadow: 0 0 6px rgba(21, 101, 216, 0.4);
}

[data-bs-theme="light"] .badge.bg-info {
    background-color: #0891e2 !important;
    color: #fff !important;
    box-shadow: 0 0 6px rgba(8, 145, 226, 0.4);
}

[data-bs-theme="light"] .badge.bg-success {
    background-color: #0ea44e !important;
    color: #fff !important;
    box-shadow: 0 0 6px rgba(14, 164, 78, 0.4);
}

[data-bs-theme="light"] .badge.bg-warning {
    background-color: #e8850c !important;
    color: #fff !important;
    box-shadow: 0 0 6px rgba(232, 133, 12, 0.4);
}

[data-bs-theme="light"] .badge.bg-danger {
    background-color: #dc2626 !important;
    color: #fff !important;
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}

[data-bs-theme="light"] .badge.bg-secondary {
    background-color: #6366a0 !important;
    color: #fff !important;
    box-shadow: 0 0 6px rgba(99, 102, 160, 0.3);
}

/* Buttons */
[data-bs-theme="light"] .btn-primary {
    --bs-btn-bg: #5b7a95;
    --bs-btn-border-color: #5b7a95;
    --bs-btn-hover-bg: #4a6785;
    --bs-btn-hover-border-color: #4a6785;
    --bs-btn-active-bg: #3a5570;
}

[data-bs-theme="light"] .btn-outline-primary {
    --bs-btn-color: #5b7a95;
    --bs-btn-border-color: #5b7a95;
    --bs-btn-hover-bg: #5b7a95;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #4a6785;
    --bs-btn-active-color: #fff;
}

[data-bs-theme="light"] .btn-outline-primary:hover {
    color: #fff !important;
    background-color: #5b7a95 !important;
}

[data-bs-theme="light"] .btn-success {
    --bs-btn-bg: #7a9a8a;
    --bs-btn-border-color: #7a9a8a;
    --bs-btn-hover-bg: #6a8a7a;
    --bs-btn-hover-border-color: #6a8a7a;
}

[data-bs-theme="light"] .btn-outline-success {
    --bs-btn-color: #7a9a8a;
    --bs-btn-border-color: #7a9a8a;
    --bs-btn-hover-bg: #7a9a8a;
    --bs-btn-hover-color: #fff;
}

[data-bs-theme="light"] .btn-outline-info {
    --bs-btn-color: #6a8fa8;
    --bs-btn-border-color: #6a8fa8;
    --bs-btn-hover-bg: #6a8fa8;
    --bs-btn-hover-color: #fff;
}

[data-bs-theme="light"] .btn-outline-warning {
    --bs-btn-color: #a0896a;
    --bs-btn-border-color: #a0896a;
    --bs-btn-hover-bg: #a0896a;
    --bs-btn-hover-color: #fff;
}

[data-bs-theme="light"] .btn-warning {
    --bs-btn-bg: #a0896a;
    --bs-btn-border-color: #a0896a;
    --bs-btn-hover-bg: #907a5a;
    --bs-btn-hover-border-color: #907a5a;
    --bs-btn-color: #fff;
}

[data-bs-theme="light"] .btn-outline-danger {
    --bs-btn-color: #9a6a6a;
    --bs-btn-border-color: #9a6a6a;
    --bs-btn-hover-bg: #9a6a6a;
    --bs-btn-hover-color: #fff;
}

[data-bs-theme="light"] .btn-danger {
    --bs-btn-bg: #9a6a6a;
    --bs-btn-border-color: #9a6a6a;
    --bs-btn-hover-bg: #8a5a5a;
    --bs-btn-hover-border-color: #8a5a5a;
}

[data-bs-theme="light"] .btn-outline-secondary {
    --bs-btn-color: #6a7a8a;
    --bs-btn-border-color: #a0aab5;
    --bs-btn-hover-bg: #6a7a8a;
    --bs-btn-hover-color: #fff;
}

/* Table headers */
[data-bs-theme="light"] .table-light {
    --bs-table-bg: #e8ecf0;
    --bs-table-color: #2c3e50;
    --bs-table-border-color: #c8d0d8;
}

/* Alerts */
[data-bs-theme="light"] .alert-info {
    --bs-alert-bg: #dce6f0;
    --bs-alert-color: #3a5570;
    --bs-alert-border-color: #b8c8d8;
}

[data-bs-theme="light"] .alert-light {
    --bs-alert-bg: #f0f2f5;
    --bs-alert-color: #4a5a6a;
    --bs-alert-border-color: #d0d8e0;
}

/* Text colors */
[data-bs-theme="light"] .text-primary {
    color: #5b7a95 !important;
}

[data-bs-theme="light"] .text-info {
    color: #6a8fa8 !important;
}

[data-bs-theme="light"] .text-success {
    color: #7a9a8a !important;
}

[data-bs-theme="light"] .text-warning {
    color: #a0896a !important;
}

[data-bs-theme="light"] .text-danger {
    color: #9a6a6a !important;
}

/* Border colors */
[data-bs-theme="light"] .border-primary {
    border-color: #5b7a95 !important;
}

[data-bs-theme="light"] .border-success {
    border-color: #7a9a8a !important;
}

[data-bs-theme="light"] .border-info {
    border-color: #6a8fa8 !important;
}

[data-bs-theme="light"] .border-warning {
    border-color: #a0896a !important;
}

/* Nav tabs */
[data-bs-theme="light"] .nav-tabs .nav-link.active {
    color: #4a6785;
    border-bottom-color: #4a6785;
}

[data-bs-theme="light"] .nav-tabs .nav-link:hover {
    color: #4a6785;
}

/* Pagination */
[data-bs-theme="light"] .page-link.active,
[data-bs-theme="light"] .active > .page-link {
    background-color: #5b7a95;
    border-color: #5b7a95;
}

/* Form focus */
[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    border-color: #5b7a95;
    box-shadow: 0 0 0 0.25rem rgba(91, 122, 149, 0.25);
}

[data-bs-theme="light"] .form-check-input:checked {
    background-color: #5b7a95;
    border-color: #5b7a95;
}

/* Spinner */
[data-bs-theme="light"] .spinner-border.text-primary {
    color: #5b7a95 !important;
}

/* Colored card headers */
[data-bs-theme="light"] .bg-success {
    background-color: #7a9a8a !important;
}

[data-bs-theme="light"] .bg-danger {
    background-color: #9a6a6a !important;
}

[data-bs-theme="light"] .bg-warning {
    background-color: #a0896a !important;
    color: #fff !important;
}

/* ── Dark theme: orange accent overrides ── */
[data-bs-theme="dark"] {
    --bs-body-bg: #1a1a2e;
    --bs-body-color: #e0e0e0;

    --bs-primary: #f0a050;
    --bs-primary-rgb: 240, 160, 80;

    --bs-link-color-rgb: 240, 160, 80;
    --bs-link-color: #f0a050;
    --bs-link-hover-color: #e07020;

    --bs-secondary-bg: #222240;
    --bs-tertiary-bg: #2a2a48;
}

/* Links: override Bootstrap's default blue */
[data-bs-theme="dark"] a {
    color: #d0c0b0;
}

[data-bs-theme="dark"] a:hover {
    color: #f0a050;
}

[data-bs-theme="dark"] .card-title a {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .card-title a:hover {
    color: #f0a050;
}

/* Navbar: pure black in dark mode, orange brand */
[data-bs-theme="dark"] .navbar {
    background-color: #000000 !important;
}

[data-bs-theme="dark"] .navbar-brand {
    color: #f0a050 !important;
}

/* Primary buttons: orange */
[data-bs-theme="dark"] .btn-primary {
    --bs-btn-bg: #e07020;
    --bs-btn-border-color: #e07020;
    --bs-btn-hover-bg: #c05000;
    --bs-btn-hover-border-color: #c05000;
    --bs-btn-color: #fff;
    --bs-btn-active-bg: #c05000;
    --bs-btn-active-border-color: #c05000;
}

[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: #f0a050;
    --bs-btn-border-color: #f0a050;
    --bs-btn-hover-bg: #f0a050;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #e07020;
    --bs-btn-active-border-color: #e07020;
    --bs-btn-active-color: #fff;
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    color: #fff !important;
    background-color: #f0a050 !important;
}

/* Table headers: dark instead of white */
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #222240;
    --bs-table-color: #e0e0e0;
    --bs-table-border-color: #3a3a5c;
}

/* alert-light: subtle dark panel */
[data-bs-theme="dark"] .alert-light {
    --bs-alert-bg: #222240;
    --bs-alert-color: #e0e0e0;
    --bs-alert-border-color: #3a3a5c;
}

/* Pagination active: orange */
[data-bs-theme="dark"] .page-link.active,
[data-bs-theme="dark"] .active > .page-link {
    background-color: #e07020;
    border-color: #e07020;
}

/* Nav-tabs active: orange text, dark background */
[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: var(--bs-body-bg);
    border-color: #3a3a5c #3a3a5c var(--bs-body-bg);
    color: #f0a050;
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #a0a0b8;
}

[data-bs-theme="dark"] .nav-tabs .nav-link:hover {
    color: #f0a050;
    border-color: #3a3a5c #3a3a5c transparent;
}

/* Cards: slightly lighter background */
[data-bs-theme="dark"] .card {
    --bs-card-bg: #222240;
    --bs-card-border-color: #3a3a5c;
}

[data-bs-theme="dark"] .card-header {
    border-bottom-color: #3a3a5c;
}

/* List groups */
[data-bs-theme="dark"] .list-group-item {
    --bs-list-group-bg: #222240;
    --bs-list-group-border-color: #3a3a5c;
    --bs-list-group-color: #e0e0e0;
}

/* Form controls */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #2a2a48;
    border-color: #3a3a5c;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #f0a050;
    box-shadow: 0 0 0 0.25rem rgba(240, 160, 80, 0.25);
}

[data-bs-theme="dark"] .form-check-input {
    background-color: #2a2a48;
    border-color: #3a3a5c;
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: #e07020;
    border-color: #e07020;
}

/* Breadcrumbs */
[data-bs-theme="dark"] .breadcrumb {
    --bs-breadcrumb-divider-color: #a0a0b8;
}

/* ── Badges: all orange shades ── */
[data-bs-theme="dark"] .badge.bg-primary {
    background-color: #e07020 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .badge.bg-info {
    background-color: #f0a050 !important;
    color: #1a1a2e !important;
}

[data-bs-theme="dark"] .badge.bg-success {
    background-color: #c05000 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .badge.bg-warning {
    background-color: #e07020 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .badge.bg-danger {
    background-color: #8b2500 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .badge.bg-secondary {
    background-color: #6b3a10 !important;
    color: #e0d0c0 !important;
}

/* ── Buttons: orange palette ── */
[data-bs-theme="dark"] .btn-success {
    --bs-btn-bg: #c05000;
    --bs-btn-border-color: #c05000;
    --bs-btn-hover-bg: #a04000;
    --bs-btn-hover-border-color: #a04000;
    --bs-btn-color: #fff;
    --bs-btn-active-bg: #a04000;
}

[data-bs-theme="dark"] .btn-info {
    --bs-btn-bg: #f0a050;
    --bs-btn-border-color: #f0a050;
    --bs-btn-hover-bg: #e07020;
    --bs-btn-hover-border-color: #e07020;
    --bs-btn-color: #1a1a2e;
    --bs-btn-active-bg: #e07020;
}

[data-bs-theme="dark"] .btn-warning {
    --bs-btn-bg: #e07020;
    --bs-btn-border-color: #e07020;
    --bs-btn-hover-bg: #c05000;
    --bs-btn-hover-border-color: #c05000;
    --bs-btn-color: #fff;
    --bs-btn-active-bg: #c05000;
}

[data-bs-theme="dark"] .btn-danger {
    --bs-btn-bg: #8b2500;
    --bs-btn-border-color: #8b2500;
    --bs-btn-hover-bg: #6b1a00;
    --bs-btn-hover-border-color: #6b1a00;
    --bs-btn-color: #fff;
    --bs-btn-active-bg: #6b1a00;
}

[data-bs-theme="dark"] .btn-outline-success {
    --bs-btn-color: #f0a050;
    --bs-btn-border-color: #c05000;
    --bs-btn-hover-bg: #c05000;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #a04000;
    --bs-btn-active-color: #fff;
}

[data-bs-theme="dark"] .btn-outline-info {
    --bs-btn-color: #f0a050;
    --bs-btn-border-color: #f0a050;
    --bs-btn-hover-bg: #f0a050;
    --bs-btn-hover-color: #1a1a2e;
    --bs-btn-active-bg: #e07020;
    --bs-btn-active-color: #fff;
}

[data-bs-theme="dark"] .btn-outline-warning {
    --bs-btn-color: #e07020;
    --bs-btn-border-color: #e07020;
    --bs-btn-hover-bg: #e07020;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #c05000;
    --bs-btn-active-color: #fff;
}

[data-bs-theme="dark"] .btn-outline-danger {
    --bs-btn-color: #c05000;
    --bs-btn-border-color: #8b2500;
    --bs-btn-hover-bg: #8b2500;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #6b1a00;
    --bs-btn-active-color: #fff;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #d0a878;
    --bs-btn-border-color: #6b3a10;
    --bs-btn-hover-bg: #6b3a10;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #5a3010;
    --bs-btn-active-color: #fff;
}

/* ── Alerts: orange shades ── */
[data-bs-theme="dark"] .alert-info {
    --bs-alert-bg: #3a2810;
    --bs-alert-color: #f0a050;
    --bs-alert-border-color: #6b3a10;
}

[data-bs-theme="dark"] .alert-success {
    --bs-alert-bg: #2a1a08;
    --bs-alert-color: #f0a050;
    --bs-alert-border-color: #5a3010;
}

[data-bs-theme="dark"] .alert-warning {
    --bs-alert-bg: #3a2208;
    --bs-alert-color: #f0a050;
    --bs-alert-border-color: #6b3a10;
}

[data-bs-theme="dark"] .alert-danger {
    --bs-alert-bg: #2a0a00;
    --bs-alert-color: #e08050;
    --bs-alert-border-color: #5a1a00;
}

/* ── Text colors: orange shades ── */
[data-bs-theme="dark"] .text-primary {
    color: #f0a050 !important;
}

[data-bs-theme="dark"] .text-success {
    color: #f0a050 !important;
}

[data-bs-theme="dark"] .text-info {
    color: #f0a050 !important;
}

[data-bs-theme="dark"] .text-warning {
    color: #e07020 !important;
}

[data-bs-theme="dark"] .text-danger {
    color: #c05000 !important;
}

/* ── Border colors ── */
[data-bs-theme="dark"] .border-primary {
    border-color: #e07020 !important;
}

[data-bs-theme="dark"] .border-success {
    border-color: #c05000 !important;
}

[data-bs-theme="dark"] .border-info {
    border-color: #f0a050 !important;
}

[data-bs-theme="dark"] .border-warning {
    border-color: #e07020 !important;
}

[data-bs-theme="dark"] .border-danger {
    border-color: #8b2500 !important;
}

/* ── Card headers with colored backgrounds ── */
[data-bs-theme="dark"] .bg-success {
    background-color: #c05000 !important;
}

[data-bs-theme="dark"] .bg-danger {
    background-color: #8b2500 !important;
}

[data-bs-theme="dark"] .bg-warning {
    background-color: #e07020 !important;
}

/* ── Table row highlighting ── */
[data-bs-theme="dark"] .table-danger {
    --bs-table-bg: #2a0a00;
    --bs-table-color: #e0a080;
    --bs-table-border-color: #5a1a00;
}

/* Spinner */
[data-bs-theme="dark"] .spinner-border.text-primary {
    color: #f0a050 !important;
}

/* Theme toggle button */
#theme-toggle {
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
}

#theme-toggle:hover {
    color: #f0a050 !important;
}

/* Flatpickr dark overrides */
[data-bs-theme="dark"] .flatpickr-calendar {
    background: #222240;
    border-color: #3a3a5c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .flatpickr-day {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .flatpickr-day:hover {
    background: #3a3a5c;
    border-color: #3a3a5c;
}

[data-bs-theme="dark"] .flatpickr-day.selected,
[data-bs-theme="dark"] .flatpickr-day.selected:hover {
    background: #e07020;
    border-color: #e07020;
    color: #fff;
}

[data-bs-theme="dark"] .flatpickr-day.today {
    border-color: #f0a050;
}

[data-bs-theme="dark"] .flatpickr-months,
[data-bs-theme="dark"] .flatpickr-weekdays,
[data-bs-theme="dark"] .flatpickr-month {
    background: #1a1a2e;
    color: #e0e0e0;
}

[data-bs-theme="dark"] span.flatpickr-weekday {
    color: #f0a050;
}

[data-bs-theme="dark"] .flatpickr-current-month input.cur-year,
[data-bs-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months {
    color: #e0e0e0;
    background: transparent;
}

[data-bs-theme="dark"] .flatpickr-prev-month,
[data-bs-theme="dark"] .flatpickr-next-month {
    color: #e0e0e0;
    fill: #e0e0e0;
}

[data-bs-theme="dark"] .flatpickr-prev-month:hover,
[data-bs-theme="dark"] .flatpickr-next-month:hover {
    color: #f0a050;
    fill: #f0a050;
}
