/* ============================================================
   Bootstrap Date Range Picker — dark / light theme overrides
   Loaded after daterangepicker.css so specificity wins cleanly.
   The picker popup is appended to <body> (parentEl:'body') so
   it is never clipped by overflow:hidden containers.
   ============================================================ */

/* ??? Shared tweaks (both modes) ??? */
.daterangepicker {
    border-radius: 0.5rem;
    overflow: hidden;
    font-size: 0.875rem;
}

.daterangepicker .calendar-table table {
    border-collapse: separate;
    border-spacing: 2px;
}

.daterangepicker td,
.daterangepicker th {
    border-radius: 0.3rem;
}

/* ??? DARK MODE ??? */
html[data-bs-theme="dark"] .daterangepicker {
    background-color: #2b3035;
    border: 1px solid #495057;
    color: #dee2e6;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.6);
}

/* ?? Arrow ?? */
html[data-bs-theme="dark"] .daterangepicker::before {
    border-bottom-color: #495057;
    border-top-color: #495057;
}
html[data-bs-theme="dark"] .daterangepicker::after {
    border-bottom-color: #2b3035;
    border-top-color: #2b3035;
}
html[data-bs-theme="dark"] .daterangepicker.drops-up::before {
    border-top-color: #495057;
}
html[data-bs-theme="dark"] .daterangepicker.drops-up::after {
    border-top-color: #2b3035;
}

/* ?? Calendar table wrapper ?? */
html[data-bs-theme="dark"] .daterangepicker .calendar-table {
    background-color: #2b3035;
    border: none;
}

/* ?? Week-day header cells ?? */
html[data-bs-theme="dark"] .daterangepicker th {
    color: #6c757d;
    background-color: transparent;
    border: none;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ?? Month/year navigation arrows ?? */
html[data-bs-theme="dark"] .daterangepicker th.prev span,
html[data-bs-theme="dark"] .daterangepicker th.next span {
    border-color: #adb5bd;
}
html[data-bs-theme="dark"] .daterangepicker th.prev:hover,
html[data-bs-theme="dark"] .daterangepicker th.next:hover {
    background-color: #343a40;
    color: #dee2e6;
}

/* ?? Month / year header label ?? */
html[data-bs-theme="dark"] .daterangepicker th.month {
    color: #dee2e6;
    font-weight: 600;
}

/* ?? Month / year <select> dropdowns ?? */
html[data-bs-theme="dark"] .daterangepicker .monthselect,
html[data-bs-theme="dark"] .daterangepicker .yearselect {
    background-color: #343a40;
    border: 1px solid #495057;
    border-radius: 0.3rem;
    color: #dee2e6;
    padding: 0.1rem 0.35rem;
}
html[data-bs-theme="dark"] .daterangepicker .monthselect:focus,
html[data-bs-theme="dark"] .daterangepicker .yearselect:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,.25);
    outline: none;
}

/* ?? Regular day cells ?? */
html[data-bs-theme="dark"] .daterangepicker td.available {
    color: #dee2e6;
    background-color: transparent;
    border: none;
}
html[data-bs-theme="dark"] .daterangepicker td.available:hover {
    background-color: #495057;
    color: #fff;
}

/* ?? Off-month days (greyed out) ?? */
html[data-bs-theme="dark"] .daterangepicker td.off {
    color: #495057 !important;
    background-color: transparent !important;
}

/* ?? Today ?? */
html[data-bs-theme="dark"] .daterangepicker td.today {
    font-weight: 700;
    color: #74c0fc;
}
html[data-bs-theme="dark"] .daterangepicker td.today.active,
html[data-bs-theme="dark"] .daterangepicker td.today.in-range {
    color: #fff;
}

/* ?? In-range highlight ?? */
html[data-bs-theme="dark"] .daterangepicker td.in-range {
    background-color: rgba(13,110,253,.2);
    color: #dee2e6;
    border-radius: 0;
}

/* ?? Start & end dates ?? */
html[data-bs-theme="dark"] .daterangepicker td.active,
html[data-bs-theme="dark"] .daterangepicker td.active:hover {
    background-color: #0d6efd;
    color: #fff;
    font-weight: 600;
}
html[data-bs-theme="dark"] .daterangepicker td.start-date.in-range {
    border-radius: 0.3rem 0 0 0.3rem;
}
html[data-bs-theme="dark"] .daterangepicker td.end-date.in-range {
    border-radius: 0 0.3rem 0.3rem 0;
}
html[data-bs-theme="dark"] .daterangepicker td.start-date.end-date {
    border-radius: 0.3rem;
}

/* ?? Disabled days ?? */
html[data-bs-theme="dark"] .daterangepicker td.disabled,
html[data-bs-theme="dark"] .daterangepicker td.disabled:hover {
    color: #495057;
    background-color: transparent;
    cursor: not-allowed;
    text-decoration: none;
}

/* ?? From / To mini input fields inside the picker header ?? */
html[data-bs-theme="dark"] .daterangepicker .daterangepicker_input input {
    background-color: #212529;
    border: 1px solid #495057;
    border-radius: 0.3rem;
    color: #dee2e6;
}
html[data-bs-theme="dark"] .daterangepicker .daterangepicker_input input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,.25);
    outline: none;
}
html[data-bs-theme="dark"] .daterangepicker .daterangepicker_input i {
    color: #6c757d;
}

/* ?? Apply / Cancel button row ?? */
html[data-bs-theme="dark"] .daterangepicker .drp-buttons {
    border-top: 1px solid #343a40;
    background-color: #212529;
    padding: 0.5rem 0.75rem;
}
html[data-bs-theme="dark"] .daterangepicker .drp-selected {
    color: #6c757d;
    font-size: 0.75rem;
}
html[data-bs-theme="dark"] .daterangepicker .applyBtn {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    font-size: 0.8rem;
}
html[data-bs-theme="dark"] .daterangepicker .applyBtn:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}
html[data-bs-theme="dark"] .daterangepicker .applyBtn:disabled {
    background-color: #495057;
    border-color: #495057;
    opacity: 0.65;
}
html[data-bs-theme="dark"] .daterangepicker .cancelBtn {
    background-color: transparent;
    border: 1px solid #495057;
    color: #adb5bd;
    font-size: 0.8rem;
}
html[data-bs-theme="dark"] .daterangepicker .cancelBtn:hover {
    background-color: #343a40;
    border-color: #6c757d;
    color: #dee2e6;
}

/* ?? Preset ranges sidebar ?? */
html[data-bs-theme="dark"] .daterangepicker .ranges {
    background-color: #212529;
}
html[data-bs-theme="dark"] .daterangepicker.show-ranges .drp-calendar.left {
    border-left-color: #343a40;
}
html[data-bs-theme="dark"] .daterangepicker .ranges ul {
    padding: 0.3rem 0;
    margin: 0;
}
html[data-bs-theme="dark"] .daterangepicker .ranges li {
    color: #adb5bd;
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
    cursor: pointer;
    transition: background-color 0.1s, color 0.1s;
}
html[data-bs-theme="dark"] .daterangepicker .ranges li:hover {
    background-color: #2b3035;
    color: #dee2e6;
}
html[data-bs-theme="dark"] .daterangepicker .ranges li.active {
    background-color: #0d6efd;
    color: #fff;
}

/* ??? LIGHT MODE ??? */
html[data-bs-theme="light"] .daterangepicker {
    box-shadow: 0 0.25rem 1rem rgba(0,0,0,.15);
}
html[data-bs-theme="light"] .daterangepicker td.in-range {
    background-color: rgba(13,110,253,.1);
    color: #212529;
    border-radius: 0;
}
html[data-bs-theme="light"] .daterangepicker td.active,
html[data-bs-theme="light"] .daterangepicker td.active:hover {
    background-color: #0d6efd;
    color: #fff;
}
html[data-bs-theme="light"] .daterangepicker td.start-date.in-range {
    border-radius: 0.3rem 0 0 0.3rem;
}
html[data-bs-theme="light"] .daterangepicker td.end-date.in-range {
    border-radius: 0 0.3rem 0.3rem 0;
}
html[data-bs-theme="light"] .daterangepicker .drp-buttons {
    border-top-color: #dee2e6;
}
html[data-bs-theme="light"] .daterangepicker .applyBtn {
    background-color: #0d6efd;
    border-color: #0d6efd;
}
html[data-bs-theme="light"] .daterangepicker .applyBtn:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}
html[data-bs-theme="light"] .daterangepicker .ranges li.active {
    background-color: #0d6efd;
    color: #fff;
}
