/* Custom Calendar Datepicker - Matches Clean Native Desktop Look & Fixes Mobile Past-Date Selection */
.cal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: calFadeIn 0.2s ease-out;
}

@keyframes calFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes calSlideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.cal-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 326px;
    padding: 16px 14px 12px;
    animation: calSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1c1c19;
    user-select: none;
    -webkit-user-select: none;
}

/* Header */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.cal-title-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-month-title {
    font-size: 15px;
    font-weight: 700;
    color: #1c1c19;
    letter-spacing: -0.01em;
}

.cal-caret {
    font-size: 11px;
    color: #54433b;
    margin-top: 1px;
}

.cal-nav-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-nav-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #1c1c19;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    padding: 0;
}

.cal-nav-btn:hover:not(:disabled) {
    background: #f0ede9;
}

.cal-nav-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    pointer-events: none;
}

.cal-nav-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Weekday Headers */
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 6px;
    text-align: center;
}

.cal-weekday {
    font-size: 12px;
    font-weight: 600;
    color: #54433b;
    padding: 4px 0;
}

/* Day Grid */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 12px;
}

.cal-day-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #1c1c19;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, transform 0.08s;
    padding: 0;
    position: relative;
    min-height: 38px;
}

.cal-day-cell:hover:not(.is-disabled):not(.is-selected) {
    background: #f2ece7;
}

.cal-day-cell:active:not(.is-disabled) {
    transform: scale(0.95);
}

/* Past Dates - Strictly Disabled */
.cal-day-cell.is-disabled {
    color: #b5aba3 !important;
    opacity: 0.38 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background: transparent !important;
}

.cal-day-cell.is-other-month {
    color: #c4b8b0;
    opacity: 0.45;
}

.cal-day-cell.is-other-month.is-disabled {
    opacity: 0.2 !important;
}

/* Today's Date */
.cal-day-cell.is-today {
    box-shadow: inset 0 0 0 2px #1c1c19;
    font-weight: 700;
}

/* Selected Date */
.cal-day-cell.is-selected {
    background: #0075ff !important;
    color: #ffffff !important;
    font-weight: 700;
}

.cal-day-cell.is-selected.is-today {
    box-shadow: inset 0 0 0 2px #0056b3;
}

/* Footer Actions */
.cal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 2px;
    border-top: 1px solid #f0ede9;
}

.cal-action-btn {
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #0075ff;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s, opacity 0.15s;
}

.cal-action-btn:hover {
    background: rgba(0, 117, 255, 0.08);
}

.cal-action-btn:active {
    opacity: 0.7;
}

/* Mobile responsive tweak */
@media (max-width: 480px) {
    .cal-card {
        max-width: 100%;
        border-radius: 18px;
        padding: 18px 16px 14px;
    }
    .cal-day-cell {
        min-height: 42px;
        font-size: 14px;
    }
}
