/* ==========================================================
   Custom Date Picker - Tenant Branded Styles
   ========================================================== */

/* Hide native date picker controls */
input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="date"]::-webkit-datetime-edit {
    -webkit-appearance: none;
}

input[type="date"]::-moz-calendar-picker-indicator {
    display: none;
}

input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    padding-right: 32px !important;
    background-image: none !important;
}

/* Add dropdown triangle indicator */
.calendar-modal-body .field {
    position: relative;
}

.calendar-modal-body .field:has(input[type="date"])::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 16px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--c-brand);
    pointer-events: none;
}

.datepicker-popup {
    position: absolute;
    z-index: 10000;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 12px;
    min-width: 280px;
    user-select: none;
}

/* Header with navigation */
.datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.datepicker-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--c-text);
}

.datepicker-nav {
    background: none;
    border: none;
    color: var(--c-brand);
    font-size: 1rem;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.datepicker-nav:hover {
    background: var(--c-super-pale);
    color: var(--c-accent);
}

/* Weekday labels */
.datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.datepicker-weekdays > div {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-muted);
    padding: 4px 0;
}

/* Days grid */
.datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.datepicker-day {
    aspect-ratio: 1;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--c-text);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    border: 2px solid transparent;
}

/* Other month days (grayed out) */
.datepicker-day--other {
    color: var(--c-muted);
    opacity: 0.4;
}

/* Today - use brand color border */
.datepicker-day--today {
    border-color: var(--c-brand);
    color: var(--c-brand);
    font-weight: 700;
}

/* Selected day - use brand color background */
.datepicker-day--selected {
    background: var(--c-brand);
    color: #fff;
    border-color: var(--c-brand);
    font-weight: 700;
}

/* Hover - use accent color */
.datepicker-day:hover:not(.datepicker-day--other) {
    background: var(--c-accent);
    color: #fff;
    border-color: var(--c-accent);
}

/* Footer with Clear and Today buttons */
.datepicker-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--c-border);
}

.datepicker-btn {
    background: none;
    border: none;
    color: var(--c-brand);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.datepicker-btn:hover {
    background: var(--c-super-pale);
    color: var(--c-accent);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .datepicker-popup {
        min-width: 260px;
        padding: 10px;
    }

    .datepicker-day {
        font-size: 0.8rem;
    }
}
