/* Shared date picker */
.app-date-input {
    cursor: pointer;
    color-scheme: dark;
}

[data-theme="light"] .app-date-input {
    color-scheme: light;
}

.app-date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.75;
}

.app-date-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: transparent;
}

.app-date-picker-backdrop[hidden] {
    display: none;
}

.app-date-picker {
    position: fixed;
    width: min(360px, calc(100vw - 24px));
    padding: 16px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 14px;
    background: var(--bg-card, #1e1e2a);
    color: var(--text-primary, #fff);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.app-date-picker-header {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.app-date-picker-title {
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-date-picker-nav,
.app-date-picker-day,
.app-date-picker-action {
    border: 0;
    font: inherit;
    cursor: pointer;
}

.app-date-picker-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 9px;
    background: var(--bg-secondary, #1a1a24);
    color: var(--text-primary, #fff);
}

.app-date-picker-nav:hover {
    border-color: var(--accent-primary, #2563eb);
    color: var(--accent-primary, #60a5fa);
}

.app-date-picker-weekdays,
.app-date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.app-date-picker-weekdays {
    margin-bottom: 4px;
}

.app-date-picker-weekdays span {
    padding: 6px 0;
    color: var(--text-secondary, rgba(255, 255, 255, 0.68));
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.app-date-picker-day {
    position: relative;
    aspect-ratio: 1;
    min-width: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-primary, #fff);
    font-size: 14px;
    font-weight: 500;
}

.app-date-picker-day:hover:not(:disabled),
.app-date-picker-day:focus-visible {
    outline: none;
    background: var(--bg-hover, rgba(255, 255, 255, 0.08));
    box-shadow: inset 0 0 0 1px var(--accent-primary, #2563eb);
}

.app-date-picker-day.outside-month {
    color: var(--text-muted, rgba(255, 255, 255, 0.4));
}

.app-date-picker-day.today::after {
    content: "";
    position: absolute;
    right: calc(50% - 2px);
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-primary, #60a5fa);
}

.app-date-picker-day.selected {
    background: var(--accent-primary, #2563eb);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 14px var(--brand-shadow, rgba(37, 99, 235, 0.3));
}

.app-date-picker-day.selected::after {
    background: #fff;
}

.app-date-picker-day:disabled {
    cursor: not-allowed;
    opacity: 0.25;
}

.app-date-picker-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
}

.app-date-picker-action {
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 9px;
    background: transparent;
    color: var(--accent-primary, #60a5fa);
    font-size: 14px;
    font-weight: 600;
}

.app-date-picker-action:hover,
.app-date-picker-action:focus-visible {
    outline: none;
    background: var(--accent-primary-light, rgba(37, 99, 235, 0.15));
}

@media (max-width: 480px) {
    body.app-date-picker-open {
        overflow: hidden;
    }

    .app-date-picker-backdrop {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
        background: rgba(4, 6, 15, 0.62);
        backdrop-filter: blur(4px);
    }

    .app-date-picker {
        position: static;
        width: 100%;
        padding: 14px;
        border-radius: 14px;
    }

    .app-date-picker-day {
        min-height: 40px;
        aspect-ratio: auto;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .app-date-picker {
        animation: app-date-picker-in 140ms ease-out;
    }

    @keyframes app-date-picker-in {
        from {
            opacity: 0;
            transform: translateY(8px) scale(0.98);
        }
    }
}
