/**
 * ==========================================
 * CALENDRIER.CSS - Styles pour le calendrier
 * ==========================================
 * Styles spécifiques pour FullCalendar et la sélection de dates
 */

/* ==========================================
   CALENDRIER FULLCALENDAR
   ========================================== */

/* Personnalisation du calendrier */
#calendar {
    font-family: var(--font-body);
}

.fc .fc-button-primary {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: white !important;
    border-radius: 8px !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.fc .fc-button-primary:hover {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.fc .fc-button-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Titre du mois */
.fc .fc-toolbar-title {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    color: var(--color-primary) !important;
    font-family: var(--font-heading) !important;
}

/* En-têtes des jours */
.fc .fc-col-header-cell {
    background: var(--color-bg-light) !important;
    font-weight: 600 !important;
    padding: 1rem 0.5rem !important;
    text-transform: uppercase !important;
    font-size: 0.875rem !important;
    color: var(--color-gray-dark) !important;
}

/* Cellules des jours */
.fc .fc-daygrid-day {
    cursor: pointer;
    transition: all 0.2s ease;
}

.fc .fc-daygrid-day:hover {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

.fc .fc-daygrid-day-number {
    padding: 0.5rem !important;
    font-weight: 600 !important;
}

/* Dates passées (désactivées) */
.fc .fc-day-past {
    background-color: #f8f9fa !important;
    opacity: 0.5;
    cursor: not-allowed !important;
}

.fc .fc-day-past:hover {
    background-color: #f8f9fa !important;
}

/* Dates futures (disponibles) */
.fc .fc-day-future {
    background-color: white !important;
}

/* Aujourd'hui */
.fc .fc-day-today {
    background-color: rgba(var(--color-accent-rgb, 244, 196, 48), 0.1) !important;
}

.fc .fc-day-today .fc-daygrid-day-number {
    background: var(--color-accent);
    color: #333;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* ==========================================
   ÉVÉNEMENTS - RÉSERVATIONS
   ========================================== */

/* Événements de réservation */
.fc-event {
    border: none !important;
    padding: 0.25rem !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    cursor: default !important;
}

/* Réservations */
.fc-event[style*="#CC1849"] {
    background-color: #CC1849 !important;
    color: white !important;
}

/* Dates réservées - Marquage visuel discret */
.fc .reserved-date {
    background: linear-gradient(
        135deg,
        rgba(204, 24, 73, 0.08) 25%,
        transparent 25%,
        transparent 50%,
        rgba(204, 24, 73, 0.08) 50%,
        rgba(204, 24, 73, 0.08) 75%,
        transparent 75%,
        transparent
    ) !important;
    background-size: 8px 8px !important;
    pointer-events: none !important;
}

/* Alternative : version encore plus discrète */
/* .fc .reserved-date {
    background: repeating-linear-gradient(
        45deg,
        rgba(204, 24, 73, 0.05),
        rgba(204, 24, 73, 0.05) 5px,
        transparent 5px,
        transparent 10px
    ) !important;
    pointer-events: none !important;
} */

/* ==========================================
   ÉVÉNEMENTS - VACANCES SCOLAIRES
   ========================================== */

/* Barres fines pour vacances scolaires */
.fc-daygrid-event.vacances-event {
    min-height: 10px !important;
    line-height: 10px !important;
    padding: 1px 2px !important;
    font-size: 0.65em !important;
    opacity: 0.85 !important;
    margin-top: auto !important;
}

.fc-event[style*="#4CAF50"] {
    background-color: #4CAF50 !important;
    color: #0D0D0D !important;
}

.fc-event[style*="#2196F3"] {
    background-color: #2196F3 !important;
    color: #0D0D0D !important;
}

.fc-event[style*="#FF9800"] {
    background-color: #FF9800 !important;
    color: #0D0D0D !important;
}

/* Style texte vacances */
.vacances-event .fc-event-title {
    font-size: 0.85em;
    text-align: center;
    opacity: 0.95;
    line-height: 1em;
}

/* Positionner les vacances en bas de la cellule */
.fc-daygrid-day-frame {
    display: flex;
    flex-direction: column;
}

.fc-daygrid-day-events {
    margin-top: auto;
}

/* ==========================================
   ÉVÉNEMENTS - JOURS FÉRIÉS
   ========================================== */

/* Barres fines pour jours fériés */
.fc-daygrid-event.ferie-event {
    min-height: 10px !important;
    line-height: 10px !important;
    padding: 1px 2px !important;
    font-size: 0.65em !important;
    opacity: 0.85 !important;
    background-color: #7518CC !important;
    color: white !important;
}

.ferie-event .fc-event-title {
    line-height: 1em;
}

/* ==========================================
   SÉLECTION DE DATES
   ========================================== */

/* Sélection en cours */
.fc .fc-highlight {
    background: var(--color-primary) !important;
    opacity: 0.3 !important;
}

/* Dates sélectionnées */
.fc .fc-day-selected {
    background-color: var(--color-primary) !important;
    opacity: 0.2 !important;
}

/* ==========================================
   BANDEAU DE SÉLECTION
   ========================================== */

.date-selection-summary {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selection-details {
    animation: fadeIn 0.3s ease;
}

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

.date-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-info strong {
    font-size: 0.875rem;
}

.date-info.nights span {
    color: var(--color-primary);
}

/* ==========================================
   TOGGLE SWITCH
   ========================================== */

.calendar-toggle-switch input[type="checkbox"] {
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.calendar-toggle-switch input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.calendar-toggle-switch input[type="checkbox"]:checked::before {
    transform: translateX(24px);
}

/* ==========================================
   LÉGENDE
   ========================================== */

#calendar-legend {
    user-select: none;
}

#calendar-legend span {
    font-size: 0.9375rem;
    color: var(--color-gray-dark);
}

#calendar-legend i {
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==========================================
   FORMULAIRE DE RÉSERVATION
   ========================================== */

#bookingForm input[type="date"],
#bookingForm select {
    font-family: var(--font-body);
}

#bookingForm input[type="date"]:focus,
#bookingForm select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 196, 30, 58), 0.1);
}

/* ==========================================
   MESSAGES D'ALERTE
   ========================================== */

.calendar-alert {
    position: fixed;
    top: 100px;
    right: 20px;
    max-width: 400px;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.calendar-alert.error {
    border-left: 4px solid #dc3545;
}

.calendar-alert.success {
    border-left: 4px solid #28a745;
}

.calendar-alert.info {
    border-left: 4px solid #17a2b8;
}

.calendar-alert-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.calendar-alert-close:hover {
    background: #f8f9fa;
    color: #333;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    /* Calendrier mobile */
    .fc .fc-toolbar {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .fc .fc-toolbar-title {
        font-size: 1.5rem !important;
    }
    
    .fc .fc-button {
        padding: 0.5rem !important;
        font-size: 0.875rem !important;
    }
    
    .fc .fc-daygrid-day-number {
        font-size: 0.875rem !important;
    }
    
    .fc-event {
        font-size: 0.625rem !important;
    }
    
    /* Bandeau de sélection mobile */
    .selection-details > div {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .selection-details button {
        width: 100%;
    }
    
    /* Alerte mobile */
    .calendar-alert {
        top: 80px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .fc .fc-toolbar-title {
        font-size: 1.25rem !important;
    }
    
    .fc .fc-col-header-cell {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.25rem !important;
    }
}

/* ==========================================
   ÉTATS DE CHARGEMENT
   ========================================== */

.calendar-loading {
    position: relative;
}

.calendar-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.calendar-loading::before {
    content: '⏳';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    z-index: 101;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* ==========================================
   ACCESSIBILITÉ
   ========================================== */

/* Focus visible pour navigation clavier */
.fc .fc-button:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.fc .fc-daygrid-day:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

/* Améliorer le contraste pour les malvoyants */
@media (prefers-contrast: high) {
    .fc .fc-event {
        border: 2px solid black !important;
    }
    
    .fc .fc-highlight {
        opacity: 0.5 !important;
    }
}

/* Mode sombre (si activé) */
@media (prefers-color-scheme: dark) {
    #calendar {
        background: #1a1a1a;
        color: white;
    }
    
    .fc .fc-col-header-cell {
        background: #2a2a2a !important;
        color: white !important;
    }
    
    .fc .fc-day-future {
        background-color: #1a1a1a !important;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .date-selection-summary,
    .calendar-toggle-switch,
    #bookingContainer,
    .fc-toolbar {
        display: none !important;
    }
    
    #calendar {
        box-shadow: none !important;
    }
    
    .fc-event {
        page-break-inside: avoid;
    }
}

/* ==========================================
   BANDEAU RÉSERVATION (optionnel)
   ========================================== */

.bandeauresa {
    background: linear-gradient(90deg, #ef0d3d, #ea5978);
    color: white;
    padding: 20px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.bandeauresa h1 {
    margin: 0;
    font-size: 24px;
}

.bandeauresa-buttons {
    display: flex;
    gap: 15px;
}

/* Bouton de réservation principal */
.btn-reservation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #6a11cb, #9b4dca, #c471ed);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.4s ease;
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-reservation:hover {
    background: linear-gradient(135deg, #8e2de2, #b565d8, #d891ef);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 25px rgba(106, 17, 203, 0.6);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-reservation:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.5);
}

/* Autres boutons du bandeau */
.bandeauresa-buttons a:not(.btn-reservation) {
    text-decoration: none;
    color: white;
    background-color: #444343;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.bandeauresa-buttons a:not(.btn-reservation):hover {
    background-color: #E64A19;
}

/* ==========================================
   PANELS LIENS RÉSERVATION
   ========================================== */

.booking-sites {
    margin: 2rem auto;
    max-width: 1200px;
    text-align: center;
    padding: 0 1rem;
}

.booking-sites h2 {
    font-size: 1.8rem;
    color: #3e3b37;
    margin-bottom: 2rem;
}

.booking-group {
    margin-bottom: 2.5rem;
}

.booking-group h3 {
    color: #3e3b37;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.booking-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.booking-cell {
    flex: 1 1 calc(20% - 1rem);
    min-width: 100px;
    max-width: 130px;
    background-color: #640375;
    border-radius: 16px;
    padding: 0.8rem 0.4rem;
    text-decoration: none;
    color: white;
    transition: transform 0.2s ease, background-color 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.booking-cell img {
    width: 45px;
    height: auto;
    margin-bottom: 0.5rem;
    transition: width 0.2s ease;
}

.booking-cell span {
    font-weight: bold;
    font-size: 0.85rem;
    transition: font-size 0.2s ease;
}

.booking-cell:hover {
    background-color: #d504fa;
    transform: translateY(-4px);
}

/* ==========================================
   LÉGENDE CALENDRIER (améliorée)
   ========================================== */

.zone-a { background: #4CAF50; }
.zone-b { background: #2196F3; }
.zone-c { background: #FF9800; }
.ferie  { background: #7518CC; }

/* ==========================================
   RESPONSIVE BANDEAU & PANELS
   ========================================== */

@media (max-width: 768px) {
    /* Bandeau réservation mobile */
    .bandeauresa {
        flex-direction: column;
        align-items: center;
    }

    .bandeauresa h1 {
        font-size: 20px;
        text-align: center;
    }

    .bandeauresa-buttons {
        gap: 10px;
    }

    .btn-reservation {
        font-size: 16px;
        padding: 12px 24px;
        width: auto;
        max-width: 90%;
    }

    .bandeauresa-buttons a:not(.btn-reservation) {
        font-size: 14px;
        padding: 8px 15px;
    }
    
    /* Panels de réservation mobile */
    .booking-cell {
        flex: 1 1 calc(45% - 1rem);
        max-width: 120px;
    }
    
    .booking-cell img {
        width: 40px;
    }

    .booking-cell span {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .booking-cell {
        flex: 1 1 calc(48% - 0.5rem);
        padding: 0.6rem 0.3rem;
        max-width: 100px;
    }

    .booking-cell img {
        width: 35px;
    }

    .booking-cell span {
        font-size: 0.75rem;
    }
}