/* ============================================================
   CUSTOM DATEPICKER / CALENDAR COMPONENT (SIDEBAR BRAND COLOR THEME)
   ============================================================ */

.custom-datepicker {
    position: relative;
    width: 100%;
}

.custom-datepicker .datepicker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 14px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--text-primary, #1a1a2e);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.custom-datepicker .datepicker-trigger:hover {
    border-color: #94a3b8;
}

.custom-datepicker.active .datepicker-trigger {
    border-color: var(--primary, #0f3b5e);
    box-shadow: 0 0 0 3px rgba(15, 59, 94, 0.12);
    background: #ffffff;
}

.custom-datepicker .datepicker-trigger i:first-child,
.custom-datepicker .datepicker-trigger .trigger-icon,
.custom-datepicker .datepicker-trigger .fa-calendar-alt,
.custom-datepicker .datepicker-trigger .fa-calendar {
    font-size: 14.5px;
    color: var(--text-muted, #64748b);
    margin-right: 4px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.custom-datepicker .datepicker-trigger .datepicker-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.custom-datepicker .datepicker-trigger i:last-child,
.custom-datepicker .datepicker-trigger .chevron-icon,
.custom-datepicker .datepicker-trigger .fa-chevron-down {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.custom-datepicker.active .datepicker-trigger i:last-child,
.custom-datepicker.active .datepicker-trigger .chevron-icon,
.custom-datepicker.active .datepicker-trigger .fa-chevron-down {
    transform: rotate(180deg);
    color: var(--primary, #0f3b5e);
}

/* Calendar Dropdown Popup */
.custom-datepicker .datepicker-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 290px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    z-index: 2200;
    padding: 14px;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-datepicker.align-right .datepicker-dropdown {
    left: auto;
    right: 0;
}

.custom-datepicker.active .datepicker-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Navigation Header */
.datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.datepicker-month-year-selects {
    display: flex;
    align-items: center;
    gap: 6px;
}

.datepicker-btn-month,
.datepicker-btn-year {
    height: 30px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    color: #1e293b;
    font-size: 13px;
    font-weight: 700;
    padding: 0 10px;
    outline: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    user-select: none;
}

.datepicker-btn-month:hover,
.datepicker-btn-year:hover {
    border-color: var(--primary, #0f3b5e);
    background: #ffffff;
    color: var(--primary, #0f3b5e);
}

.datepicker-btn-month i,
.datepicker-btn-year i {
    font-size: 10px;
    color: #64748b;
    transition: transform 0.2s ease;
}

.datepicker-btn-month.active i,
.datepicker-btn-year.active i {
    transform: rotate(180deg);
    color: var(--primary, #0f3b5e);
}

/* Custom Month & Year Popover Overlay */
.datepicker-popover {
    position: absolute;
    top: 50px;
    left: 14px;
    right: 14px;
    bottom: 50px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid #e2e8f0;
    z-index: 2300;
    padding: 10px;
    display: none;
    flex-direction: column;
    overflow-y: auto;
}

.datepicker-popover.active {
    display: flex;
}

.datepicker-popover-title {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f1f5f9;
}

.datepicker-grid-month {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.datepicker-grid-year {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.popover-item {
    padding: 8px 4px;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.popover-item:hover {
    background: rgba(15, 59, 94, 0.08);
    color: var(--primary, #0f3b5e);
    border-color: rgba(15, 59, 94, 0.2);
}

.popover-item.selected {
    background: var(--primary, #0f3b5e);
    color: #ffffff;
    border-color: var(--primary, #0f3b5e);
    font-weight: 700;
}

.datepicker-nav-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s ease;
}

.datepicker-nav-btn:hover {
    background: rgba(15, 59, 94, 0.08);
    color: var(--primary, #0f3b5e);
    border-color: rgba(15, 59, 94, 0.2);
}

/* Week Days Header */
.datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 6px;
}

.datepicker-weekday {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    padding: 4px 0;
}

/* Days Grid */
.datepicker-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 10px;
}

.datepicker-day {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 500;
    color: #334155;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.datepicker-day:hover {
    background: rgba(15, 59, 94, 0.08);
    color: var(--primary, #0f3b5e);
}

.datepicker-day.other-month {
    color: #cbd5e1;
}

.datepicker-day.today {
    font-weight: 700;
    color: var(--primary, #0f3b5e);
    background: rgba(15, 59, 94, 0.08);
    border: 1px dashed var(--primary, #0f3b5e);
}

.datepicker-day.selected {
    background: var(--primary, #0f3b5e) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(15, 59, 94, 0.3);
}

/* Calendar Footer */
.datepicker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.datepicker-footer-btn {
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary, #0f3b5e);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.datepicker-footer-btn:hover {
    background: rgba(15, 59, 94, 0.08);
}

.datepicker-footer-btn.clear {
    color: #ef4444;
}

/* Mobile Responsive Popover Adjustment */
@media (max-width: 640px) {
    .custom-datepicker .datepicker-dropdown,
    .custom-datepicker.align-right .datepicker-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) scale(0.95) !important;
        width: calc(100vw - 32px) !important;
        max-width: 320px !important;
        z-index: 99999 !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25) !important;
    }

    .custom-datepicker.active .datepicker-dropdown {
        transform: translate(-50%, -50%) scale(1) !important;
    }
}

.datepicker-footer-btn.clear:hover {
    background: #fef2f2;
}

/* ========================================================
   THEME MODE: NAVY KLASIK (html[data-mode="navy"])
======================================================== */
html[data-mode="navy"] .custom-datepicker .datepicker-trigger,
body[data-mode="navy"] .custom-datepicker .datepicker-trigger,
[data-mode="navy"] .custom-datepicker .datepicker-trigger {
    background: #0d2137;
    border-color: rgba(56, 189, 248, 0.3);
    color: #f8fafc;
}
html[data-mode="navy"] .custom-datepicker .datepicker-dropdown,
body[data-mode="navy"] .custom-datepicker .datepicker-dropdown,
[data-mode="navy"] .custom-datepicker .datepicker-dropdown {
    background: #0d2137;
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.6), 0 0 20px rgba(14, 165, 233, 0.15);
}
html[data-mode="navy"] .datepicker-btn-month,
html[data-mode="navy"] .datepicker-btn-year,
html[data-mode="navy"] .datepicker-nav-btn,
html[data-mode="navy"] .popover-item,
html[data-mode="navy"] .datepicker-day {
    background: #102a45;
    border-color: rgba(56, 189, 248, 0.2);
    color: #f8fafc;
}
html[data-mode="navy"] .datepicker-popover {
    background: #0d2137;
    border-color: rgba(56, 189, 248, 0.3);
}

/* ========================================================
   THEME MODE: FULL DARK MODE (html[data-mode="dark"])
======================================================== */
html[data-mode="dark"] .custom-datepicker .datepicker-trigger,
body[data-mode="dark"] .custom-datepicker .datepicker-trigger,
[data-mode="dark"] .custom-datepicker .datepicker-trigger {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}
html[data-mode="dark"] .custom-datepicker .datepicker-dropdown,
body[data-mode="dark"] .custom-datepicker .datepicker-dropdown,
[data-mode="dark"] .custom-datepicker .datepicker-dropdown {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.75);
}
html[data-mode="dark"] .datepicker-btn-month,
html[data-mode="dark"] .datepicker-btn-year,
html[data-mode="dark"] .datepicker-nav-btn,
html[data-mode="dark"] .popover-item,
html[data-mode="dark"] .datepicker-day {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}
html[data-mode="dark"] .datepicker-popover {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.15);
}
