/* Contenedor principal del calendario */
.calendar-container {
    width: 100%;
    padding: 20px;
    font-family: 'Poppins', sans-serif;
}

/* Estilos del calendario FullCalendar */
#calendar {
    background: white;
    height: 50vh;
    border-radius: 28px;
    box-shadow: 0 10px 40px rgba(23, 37, 76, 0.1);
    padding: 24px;
}

@media (min-width: 768px) {
    #calendar {
        height: 70vh;
    }
}

/* Días inválidos (hoy, pasados y fines de semana) */
.fc-daygrid-day.invalid-day .fc-daygrid-day-number {
    color: #9aa3aa;
}

.fc-daygrid-day.invalid-day .fc-daygrid-day-frame {
    opacity: 0.75;
    background-color: #f5f5f5;
}

.fc-daygrid-day.invalid-day {
    cursor: not-allowed;
}

/* Botones del calendario - aplicar border-radius consistente */
.fc-button {
    border-radius: 16px !important;
    margin: 0 4px !important;
    text-transform: capitalize !important;
}

.fc-today-button {
    border-radius: 16px !important;
    text-transform: capitalize !important;
}

.fc-toolbar-title::first-letter {
    text-transform: capitalize !important;
}

.fc-col-header-cell {
    text-transform: capitalize !important;
}

/* Estilos del booking-modal */
#booking-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: none;
    border-radius: 32px;
    padding: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    min-width: 420px;
    max-width: 92vw;
    animation: bookingModalEnter 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#booking-modal::backdrop {
    background: rgba(23, 37, 76, 0.42);
    backdrop-filter: blur(8px);
    animation: bookingBackdropFadeIn 0.22s ease-out;
}

@keyframes bookingModalEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes bookingBackdropFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#booking-modal .modal-content {
    padding: 28px;
}

#booking-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(23, 37, 76, 0.08);
}

#booking-modal .modal-header h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.4rem;
    color: #17254c;
    margin: 0;
    letter-spacing: 0.2px;
}

#booking-modal .close-btn {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 1px solid rgba(23, 37, 76, 0.1);
    border-radius: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: #121212;
    transition: all 0.2s ease;
}

#booking-modal .close-btn:hover {
    background: linear-gradient(135deg, #f73a19 0%, #ee7463 100%);
    transform: rotate(90deg) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

#booking-modal .form-group {
    margin-bottom: 16px;
}

#booking-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #17254c;
    font-family: 'Poppins', sans-serif;
}

#booking-modal .form-group input,
#booking-modal .form-group select,
#booking-modal .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid rgba(23, 37, 76, 0.1);
    border-radius: 16px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

#booking-modal .form-group input:focus,
#booking-modal .form-group select:focus,
#booking-modal .form-group textarea:focus {
    outline: none;
    border-color: #17254c;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(23, 37, 76, 0.12);
}

#booking-modal .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

#booking-modal .btn-cancel,
#booking-modal .btn-submit {
    padding: 12px 22px;
    border: none;
    border-radius: 16px !important;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

#booking-modal .btn-cancel {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #64748b;
    border: 1px solid rgba(23, 37, 76, 0.1);
}

#booking-modal .btn-cancel:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

#booking-modal .btn-submit {
    background: linear-gradient(135deg, #17254c 0%, #1e3a8a 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(23, 37, 76, 0.28);
    position: relative;
}

#booking-modal .btn-submit:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(23, 37, 76, 0.36);
}

#booking-modal .btn-submit[disabled],
#booking-modal .btn-submit[aria-disabled="true"] {
    opacity: 0.65;
    cursor: not-allowed;
}

#booking-modal .btn-submit[disabled]::after,
#booking-modal .btn-submit[aria-disabled="true"]::after {
    content: "";
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* Bloqueo de scroll global cuando cualquier modal está abierto */
html.modal-open,
body.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* Fallback automático basado en :has() para navegadores modernos */
html:has(#booking-modal[open]),
body:has(#booking-modal[open]),
html:has(.message-modal[open]),
body:has(.message-modal[open]) {
    overflow: hidden !important;
}

.message-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    border: none;
    border-radius: 24px;
    padding: 0;
    background: #ffffff;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    width: min(92vw, 520px);
    animation: messageModalEnter 0.24s ease-out;
}

.message-modal::backdrop {
    background: rgba(23, 37, 76, 0.55);
    backdrop-filter: blur(2px);
    animation: bookingBackdropFadeIn 0.22s ease-out;
}

@keyframes messageModalEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.message-modal .modal-content {
    padding: 24px;
}

.message-modal .modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(23, 37, 76, 0.08);
}

.message-modal .modal-header h2 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.25rem;
    margin: 0;
}

/* Éxito */
.success-header h2 {
    color: #0f5132;
}

.success-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.32);
}

/* Error */
.error-header h2 {
    color: #7f1d1d;
}

.error-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    color: #ffffff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.32);
}

/* Cuerpo y acciones */
.message-modal .modal-body p {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #17254c;
}

.message-modal .modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

/* Botones específicos */
.btn-success {
    padding: 10px 20px;
    border: none;
    border-radius: 14px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(22, 163, 74, 0.36);
}

.btn-error {
    padding: 10px 20px;
    border: none;
    border-radius: 14px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-error:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.36);
}

/* Bloqueo de scroll cuando cualquier modal de mensaje está abierto (si lo usas) */
html:has(.message-modal[open]),
body:has(.message-modal[open]) {
    overflow: hidden !important;
}

/* Numeración de días: azul corporativo */
.fc .fc-daygrid-day-number {
    color: #17254c;
    font-weight: 500;
    text-decoration: none;
}

/* Semana actual: marcado suave */
.fc-daygrid-day.current-week .fc-daygrid-day-frame {
    background-color: #d9eef3;
}

/* Días futuros válidos: refuerzo de color */
.fc-daygrid-day.future-day .fc-daygrid-day-frame {
    color: #17254c;
}

/* Resalte sutil para días futuros válidos */
.fc-daygrid-day.future-day .fc-daygrid-day {
    outline: 1px solid #58adb7;
    outline-offset: -1px;
}

/* Hoy: marca ligera sin exagerar */
.fc .fc-day-today .fc-daygrid-day-frame {
    box-shadow: inset 0 0 0 1px #58adb7;
}

/* Números de días futuros disponibles en azul (sin afectar inválidos) */
.fc-daygrid-day.future-day:not(.invalid-day) .fc-daygrid-day-number {
    color: #17254c;
}

/* Quitar el "fade" de FullCalendar en días del otro mes que son futuros válidos */
.fc-daygrid-day.fc-day-other.future-day:not(.invalid-day) .fc-daygrid-day-top,
.fc-daygrid-day.fc-day-other.future-day:not(.invalid-day) .fc-daygrid-day-number,
.fc-daygrid-day.fc-day-other.future-day:not(.invalid-day) .fc-daygrid-day-frame {
    opacity: 1;
}

/* Dar feedback de que se puede clicar en días futuros válidos */
.fc-daygrid-day.future-day:not(.invalid-day) {
    cursor: pointer;
}

@media (max-width: 480px) {
    /* Toolbar título */
    #fc-dom-1 {
        font-size: 0.95rem;
    }

    /* Botones: más compactos */
    .fc-button,
    .fc-today-button,
    .fc-prev-button,
    .fc-next-button {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
        line-height: 1.2 !important;
        border-radius: 12px !important;
        margin: 0 2px !important;
    }

    /* Iconos más pequeños */
    .fc-icon {
        font-size: 0.9rem !important;
    }

    /* Contenedor del calendario */
    #calendar {
        padding: 12px;
        border-radius: 20px;
        height: 360px;
    }
}