/* ============================================
   CUSTOM DATE PICKER - Tema Cyberpunk/Neon
   ============================================ */

/* Wrapper do input custom */
.custom-date-input-wrapper {
    position: relative;
    width: 100%;
    z-index: 2; /* Acima do conteúdo do modal mas abaixo do calendário */
}

/* Input custom (substitui o nativo) */
.custom-date-input {
    padding: 1rem;
    background: rgba(15, 0, 33, 0.8);
    border: 2px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.custom-date-input:hover {
    border-color: rgba(168, 85, 247, 0.6);
    background: rgba(15, 0, 33, 0.95);
}

.custom-date-input:focus-within,
.custom-date-input.open {
    border-color: #a855f7;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
    background: rgba(15, 0, 33, 1);
}

.custom-date-value {
    flex: 1;
    color: rgba(255, 255, 255, 0.6);
}

.custom-date-value.has-value {
    color: #ffffff;
    font-weight: 600;
}

.custom-date-icon {
    font-size: 1.3rem;
    margin-left: 0.5rem;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.6));
}

/* Overlay do calendário */
.calendar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.calendar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Calendário - Centralizado como modal */
.custom-date-calendar {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 420px;
    background: linear-gradient(135deg, rgba(25, 10, 45, 0.98), rgba(45, 0, 82, 0.98));
    border: 2px solid rgba(168, 85, 247, 0.5);
    border-radius: 16px;
    padding: 1.5rem;
    padding-top: 2rem; /* Espaço extra no topo */
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 0 80px rgba(168, 85, 247, 0.4),
        inset 0 0 100px rgba(168, 85, 247, 0.05);
    backdrop-filter: blur(20px);
    z-index: 999999; /* Acima de tudo */
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.custom-date-calendar.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

/* Header do calendário */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
    position: relative;
}

.calendar-nav-btn {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    color: #c084fc;
    font-size: 1rem;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn:hover {
    background: rgba(168, 85, 247, 0.4);
    border-color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
    transform: scale(1.1);
}

.calendar-nav-btn:active {
    transform: scale(0.95);
}

/* Botão fechar - FORA do calendário */
.calendar-close-btn {
    position: absolute;
    top: -3rem;
    right: 0;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 50%;
    color: #fca5a5;
    font-size: 1.3rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: 300;
}

.calendar-close-btn:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    transform: rotate(90deg) scale(1.15);
}

.calendar-close-btn:active {
    transform: rotate(90deg) scale(0.9);
}

.calendar-current {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.calendar-month-select,
.calendar-year-input {
    background: rgba(15, 0, 33, 0.8);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    color: #ffffff;
    padding: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-month-select {
    flex: 1;
    max-width: 140px;
}

.calendar-year-input {
    width: 80px;
    text-align: center;
}

.calendar-month-select:hover,
.calendar-year-input:hover {
    border-color: #a855f7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.calendar-month-select:focus,
.calendar-year-input:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

/* Dias da semana */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.calendar-weekday {
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: rgba(192, 132, 252, 0.8);
    padding: 0.5rem;
    text-transform: uppercase;
}

/* Grid de dias */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.calendar-day:hover:not(.disabled):not(.other-month) {
    background: rgba(168, 85, 247, 0.3);
    border-color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
    transform: scale(1.1);
    z-index: 1;
}

.calendar-day.today {
    border: 2px solid #22d3ee;
    color: #22d3ee;
    font-weight: 900;
}

.calendar-day.selected {
    background: linear-gradient(135deg, #a855f7, #e879f9);
    border-color: #a855f7;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
    color: #ffffff;
    transform: scale(1.05);
}

.calendar-day.other-month {
    color: rgba(255, 255, 255, 0.3);
    background: rgba(168, 85, 247, 0.05);
    border-color: rgba(168, 85, 247, 0.1);
    cursor: default;
}

.calendar-day.disabled {
    color: rgba(255, 255, 255, 0.2);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    cursor: not-allowed;
    opacity: 0.5;
}

.calendar-day.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Footer do calendário */
.calendar-footer {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(168, 85, 247, 0.2);
}

.calendar-today-btn,
.calendar-clear-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-today-btn {
    background: rgba(34, 211, 238, 0.2);
    color: #22d3ee;
    border-color: rgba(34, 211, 238, 0.3);
}

.calendar-today-btn:hover {
    background: rgba(34, 211, 238, 0.3);
    border-color: #22d3ee;
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.4);
}

.calendar-clear-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.calendar-clear-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Animações */
@keyframes calendarSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .custom-date-calendar {
        width: calc(100vw - 2rem);
        padding: 1.2rem;
    }

    .calendar-current {
        flex-direction: column;
    }

    .calendar-month-select {
        max-width: 100%;
    }

    .calendar-year-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .custom-date-input {
        padding: 0.8rem;
        font-size: 1rem;
    }

    .custom-date-calendar {
        padding: 1rem;
    }

    .calendar-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .calendar-day {
        font-size: 0.85rem;
    }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .custom-date-calendar,
    .calendar-day,
    .calendar-nav-btn {
        transition: none !important;
    }
}
