/* ==========================================================================
   DATEPICKER.CSS - Custom Calendar Component with 3-Column Month & Year Grid
   ========================================================================== */

.custom-datepicker-wrap {
    position: relative;
    width: 100%;
    user-select: none;
}

.datepicker-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.datepicker-input-group input {
    width: 100%;
    padding: 10px 38px 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13.5px;
    color: var(--text-main, #1e293b);
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.datepicker-input-group input:focus,
.custom-datepicker-wrap.open .datepicker-input-group input {
    background: #ffffff;
    border-color: #4f7df3;
    box-shadow: 0 0 0 3px rgba(79, 125, 243, 0.14);
}

.datepicker-input-icon {
    position: absolute;
    right: 12px;
    color: #8896ab;
    font-size: 14px;
    pointer-events: none;
    transition: color 0.2s ease;
}

.custom-datepicker-wrap.open .datepicker-input-icon {
    color: #4f7df3;
}

/* Floating Calendar Dropdown Popup */
.custom-datepicker-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 320px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
    padding: 16px;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-datepicker-wrap.open .custom-datepicker-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Calendar Header: Month (Kiri) & Year (Kanan) */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.calendar-header-titles {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.calendar-title-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex: 1;
    transition: all 0.2s ease;
}

.calendar-title-btn:hover,
.calendar-title-btn.active {
    background: #eff6ff;
    border-color: #4f7df3;
    color: #2563eb;
}

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

.calendar-nav-btn:hover {
    background: #4f7df3;
    color: #ffffff;
    border-color: #4f7df3;
}

/* 3-COLUMN SEJAJAR GRID (PILIH BULAN & TAHUN: 3 KOLOM SEJAJAR) */
.calendar-grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px 2px;
    max-height: 220px;
    overflow-y: auto;
}

.calendar-grid-3col::-webkit-scrollbar {
    width: 5px;
}

.calendar-grid-3col::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.calendar-grid-btn {
    padding: 10px 4px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 12.5px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-grid-btn:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.calendar-grid-btn.active {
    background: linear-gradient(135deg, #4f7df3, #6c5ce7) !important;
    color: #ffffff !important;
    border-color: #4f7df3;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(79, 125, 243, 0.35);
}

/* Weekday Names Header */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #8896ab;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.calendar-weekdays span {
    padding: 4px 0;
}

.calendar-weekdays span:first-child,
.calendar-weekdays span:last-child {
    color: #ef4444; /* Weekend */
}

/* Calendar Days Grid (7 Columns) */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-cell {
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 600;
    color: #1e293b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.calendar-day-cell:hover:not(.empty):not(.disabled) {
    background: #eff6ff;
    color: #2563eb;
}

.calendar-day-cell.today {
    color: #4f7df3;
    font-weight: 800;
}

.calendar-day-cell.today::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #4f7df3;
}

.calendar-day-cell.selected {
    background: linear-gradient(135deg, #4f7df3, #6c5ce7) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(79, 125, 243, 0.35);
}

.calendar-day-cell.selected::after {
    display: none;
}

.calendar-day-cell.other-month {
    color: #cbd5e1;
    font-weight: 400;
}

/* Calendar Footer: Quick Actions */
.calendar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #eef1f4;
    padding-top: 10px;
    margin-top: 10px;
}

.btn-cal-action {
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: #4f7df3;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.btn-cal-action:hover {
    background: #eff6ff;
}

.btn-cal-clear {
    color: #94a3b8;
}

.btn-cal-clear:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ==========================================================================
   DARK MODE OVERRIDES
   ========================================================================== */
body.dark-mode .datepicker-input-group input {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

body.dark-mode .datepicker-input-group input:focus,
body.dark-mode .custom-datepicker-wrap.open .datepicker-input-group input {
    background: #1e293b;
    border-color: #4f7df3;
}

body.dark-mode .custom-datepicker-popup {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

body.dark-mode .calendar-title-btn,
body.dark-mode .calendar-nav-btn,
body.dark-mode .calendar-grid-btn {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

body.dark-mode .calendar-title-btn:hover,
body.dark-mode .calendar-title-btn.active,
body.dark-mode .calendar-grid-btn:hover {
    background: #1e3a8a;
    border-color: #4f7df3;
    color: #93c5fd;
}

body.dark-mode .calendar-nav-btn:hover {
    background: #4f7df3;
    color: #ffffff;
    border-color: #4f7df3;
}

body.dark-mode .calendar-day-cell {
    color: #f8fafc;
}

body.dark-mode .calendar-day-cell:hover:not(.empty):not(.disabled) {
    background: #1e293b;
    color: #60a5fa;
}

body.dark-mode .calendar-day-cell.other-month {
    color: #475569;
}

body.dark-mode .calendar-footer {
    border-top-color: #1e293b;
}

body.dark-mode .btn-cal-action:hover {
    background: #1e293b;
}
