:root {
    --primary-color: #2c3e50; /* Bleu foncé (Couleur principale) */
    --secondary-color: #34495e; /* Gris foncé (En-têtes, boutons nav) */
    --accent-color: #e74c3c; /* Rouge vif (Couleur principale du calendrier, action) */
    --success-color: #27ae60; /* Vert (Bouton d'arrivée) */
    --background-color: #f4f6f9; /* Gris clair (Fond de page, champs input) */
    --text-color: #2d3436; /* Noir doux */
    --card-background: #ffffff; /* Blanc (Fond des jours, modales) */
    --border-radius: 16px;
    --shadow: rgba(44, 62, 80, 0.15);
    --transition-speed: 0.3s;
}

/* ------------------------------------------------------------- */
/* BASE & CONTENEUR PRINCIPAL */
/* ------------------------------------------------------------- */

body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box; /* IMPORTANT pour le positionnement fixe */
}

/* 🛑 SOLUTION DU PROBLÈME DE DÉFILEMENT SUR MOBILE */
.no-scroll {
    overflow: hidden !important; /* Empêche tout défilement */
    position: fixed; /* Fixe le corps à sa position */
    width: 100%;
    height: 100%;
    padding: 0; /* Retire le padding pour la fixation */
}
/* Votre JS doit ajouter/retirer cette classe au <body> quand la modale s'ouvre/ferme */

.container {
    max-width: 1000px;
    width: 100%;
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px var(--shadow);
    padding: 25px;
    box-sizing: border-box;
    animation: fadeIn 0.8s ease-out;
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    text-align: center;
    margin-bottom: 25px;
}

img {
    max-width: 120px;
    height: auto;
}

h2 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-color);
    text-align: center;
    font-size: 2.2rem;
    margin-top: 0;
    font-weight: 700;
}
h3 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-color);
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

/* ------------------------------------------------------------- */
/* AUTHENTIFICATION (CONNEXION/DECONNEXION) */
/* ------------------------------------------------------------- */

#authContainer {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius);
    background-color: #ecf0f1;
}

#authStatus {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.auth-form h2 {
    font-size: 1.6rem;
    margin-bottom: 5px;
}

.auth-form input {
    width: 90%;
    max-width: 300px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #bdc3c7;
    box-sizing: border-box;
}

.auth-form button, #logoutButton {
    width: 90%;
    max-width: 300px;
    padding: 12px;
    font-size: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    font-weight: 600;
    border: none;
    color: white;
}

.auth-form button {
    background-color: var(--primary-color);
    margin-top: 5px;
}

.auth-form button:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

#logoutButton {
    background-color: var(--accent-color);
    margin-top: 15px;
}

#logoutButton:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}


/* ------------------------------------------------------------- */
/* PANNEAU D'ADMINISTRATION (CALENDRIER) */
/* ------------------------------------------------------------- */

#adminPanel.hidden {
    display: none !important;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.month-year-display {
    font-family: 'Playfair Display', serif;
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    flex-grow: 1;
}

.month-year-display span {
    display: block;
    line-height: 1.2;
}

.nav-button {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 15px;
    font-size: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    width: 150px; 
    margin: 0; 
    font-weight: 500;
}

.nav-button:hover {
    background: var(--accent-color);
    transform: translateY(-3px);
}

/* ------------------------------------------------------------- */
/* CALENDRIER : GRILLE 7 COLONNES */
/* ------------------------------------------------------------- */

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr); 
    gap: 12px;
    margin-top: 20px;
    text-align: center;
}

.day {
    background: var(--card-background);
    border-radius: var(--border-radius);
    min-height: 150px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    padding: 15px 5px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    position: relative;
    border: 2px solid #ecf0f1;
    text-align: center;
    box-sizing: border-box;
}

.day:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(231, 76, 60, 0.6);
    border-color: var(--accent-color);
}

.day.has-reservation {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.day > div:first-child {
    font-size: 2.5em; 
    font-weight: 700;
    margin-bottom: 5px;
    font-family: 'Playfair Display', serif; 
    line-height: 1; 
}

.day > div:last-child {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 400;
    margin-top: 5px;
}

.day.weekday-header {
    background: var(--secondary-color);
    color: white;
    font-weight: 700;
    pointer-events: none;
    cursor: default;
    box-shadow: none;
    min-height: 50px; 
    font-size: 1.1em;
    justify-content: center;
    border: none;
    border-radius: 10px; 
    display: flex; 
    align-items: center;
    padding: 10px 5px; /* Ajusté */
}


/* ------------------------------------------------------------- */
/* MODALE PRINCIPALE (RÉSERVATION) ET FORMULAIRES */
/* ------------------------------------------------------------- */

select, input, textarea {
    padding: 12px 15px;
    font-size: 1rem;
    border-radius: 10px;
    border: 1px solid #bdc3c7;
    width: 100%;
    margin: 8px 0;
    background-color: var(--background-color);
    transition: all var(--transition-speed) ease;
    box-sizing: border-box; /* Assure que le padding n'augmente pas la largeur */
}

select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.4);
    background-color: white;
}

label {
    font-weight: 500;
    color: var(--secondary-color);
    width: 100%;
    display: block; 
    margin-top: 10px;
}

/* Base de la modale */
.overlay, .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; 
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.overlay {
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

.modal {
    z-index: 1000;
    /* Assure que la modale reste centrée même si le contenu est grand */
    overflow-y: auto; 
    padding: 20px;
}

.modal-content {
    background: var(--card-background);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 550px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.4s ease-out;
    padding: 30px; 
    /* Mise en page interne Flexbox */
    display: flex;
    flex-direction: column;
    gap: 15px; 
    max-height: 95vh; /* Limite la hauteur de la modale elle-même */
    overflow-y: auto; /* Permet le défilement du contenu si nécessaire */
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center;
    padding-bottom: 10px;
    margin-bottom: 15px; 
    border-bottom: 1px solid #ddd;
    text-align: center;
}

.modal-title {
    flex-basis: 100%; 
    margin: 0 0 10px 0; 
    font-size: 1.8rem; 
}

#selectedDate,
#priceDisplay {
    flex-grow: 1; 
    text-align: center; 
    margin: 0; 
    padding: 5px 0;
    color: var(--secondary-color); 
    font-weight: 500; 
    font-size: 1.1rem;
}

#priceDisplay {
    font-weight: 700;
    color: var(--success-color); /* Vert pour le prix */
    padding-left: 15px;
    padding-right: 15px;
    border-left: 1px solid #ddd;
}

/* Boutons principaux et de formulaire */
button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 15px;
    margin-top: 15px;
    width: 100%;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    font-weight: 600;
}

button:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

.button-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.button-container button {
    flex: 1;
    margin: 0;
    padding: 18px;
}

.form-buttons {
    display: flex;
    flex-direction: column-reverse; /* Met "Fermer" en bas */
    gap: 12px;
    margin-top: 15px;
}

.form-buttons button {
    margin-top: 0;
    width: 100%;
}

.form-buttons #closeModalBtn,
.form-buttons #backToChoiceBtn {
    background-color: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    transition: all var(--transition-speed) ease;
}

.form-buttons #closeModalBtn:hover,
.form-buttons #backToChoiceBtn:hover {
    background-color: var(--secondary-color);
    color: white;
    transform: translateY(-2px); /* Légère animation au survol */
}

.hidden {
    display: none !important;
}

/* ------------------------------------------------------------- */
/* STYLES DES LISTES DE RÉSERVATION (UL/LI) */
/* ------------------------------------------------------------- */

#reservations {
    padding-left: 0;
    list-style-type: none;
    margin-top: 15px;
    overflow-y: auto; 
    max-height: 300px; 
    -webkit-overflow-scrolling: touch; 
}

#reservations li {
    margin-bottom: 12px;
    padding: 15px; 
    border-radius: 10px;
    background-color: var(--card-background);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); 
    border-left: 5px solid var(--accent-color); 
    transition: all var(--transition-speed) ease-in-out;
    font-size: 1em;
    line-height: 1.4;
}

#reservations li:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.separator {
    background-color: var(--background-color) !important;
    height: 1px;
    margin: 10px 0;
    padding: 0;
    border: none !important;
    box-shadow: none !important;
}

.group-separator {
    background-color: var(--secondary-color) !important;
    color: white;
    text-align: center;
    padding: 5px 10px;
    margin: 15px 0 !important;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.reservation-item-container { 
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.text-and-arrival-container { 
    display: flex;
    align-items: flex-start; 
    flex-grow: 1;
    overflow: hidden; 
    margin-right: 10px;
}

.reservation-text-span {
    flex-grow: 1;
    margin-right: 10px;
    white-space: normal; 
    overflow: hidden;
    text-overflow: ellipsis; 
    word-break: break-word; 
    font-weight: 500;
}

/* Bouton de confirmation d'arrivée (✓) */
.arrival-button {
    background-color: black;       /* noir par défaut */
    color: white;
    border: none;
    font-size: 1.2em; 
    width: 45px; 
    height: 45px; 
    border-radius: 50%;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0;
    margin-left: 10px;
    font-weight: 700;
    flex-shrink: 0; 
    box-shadow: 0 2px 5px rgba(44, 62, 80, 0.4);
    transition: all 0.3s ease;
}

/* État confirmé → vert */
.arrival-button.confirmed {
    background-color: green;       /* vert quand confirmé */
    box-shadow: 0 2px 5px rgba(21, 211, 100, 0.4);
}

/* Effet hover */
.arrival-button:hover {
    background-color: #333;        /* gris foncé au survol */
    transform: scale(1.05); 
}

/* Bouton d'annulation */
.cancel-single-button {
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    font-size: 0.85em;
    width: auto;
    align-self: flex-start; 
    margin-top: 0;
    padding: 6px 12px;
    margin-left: 10px;
    border-radius: 8px;
    flex-shrink: 0; 
    height: 35px; 
}

.cancel-single-button:hover {
    background-color: var(--accent-color);
    color: white;
    transform: translateY(-1px);
}

/* ------------------------------------------------------------- */
/* STYLES DE L'ALERTE PERSONNALISÉE */
/* ------------------------------------------------------------- */

.custom-alert-overlay, .custom-alert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; 
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.custom-alert-overlay {
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001; 
}

.custom-alert-modal {
    z-index: 1002;
}

.custom-alert-content {
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease-out;
}

.custom-alert-logo {
    max-width: 80px;
    margin-bottom: 10px;
}

.custom-alert-content h2 {
    margin: 5px 0 15px;
    font-size: 1.5rem;
}

.custom-alert-content p {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 20px;
}

.custom-alert-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    width: auto;
}

.custom-alert-button:hover {
    background: var(--accent-color);
    transform: translateY(-1px);
}

/* ------------------------------------------------------------- */
/* RÉACTIVITÉ MOBILE (@media) */
/* ------------------------------------------------------------- */

@media (max-width: 768px) {
    body {
        padding: 10px; /* Moins de padding sur le body */
    }

    .container {
        padding: 15px;
        border-radius: 10px;
        box-shadow: 0 5px 15px var(--shadow);
    }
    
    /* TITRES */
    h2 {
        font-size: 1.8rem;
    }
    h3 {
        font-size: 1.3rem;
    }

    /* CONTRÔLE PRINCIPAL */
    .controls {
        flex-wrap: nowrap; 
        gap: 5px; 
    }

    /* BOUTONS DE NAVIGATION */
    .nav-button {
        width: 70px; /* Plus petit */
        padding: 8px 5px;
        font-size: 0.75rem; 
    }

    /* AFFICHAGE MOIS/ANNÉE */
    .month-year-display {
        font-size: 1.2rem; 
    }

    /* CALENDRIER MOBILE */
    .day.weekday-header {
        display: none; 
    }

    /* Passer à une grille 2 colonnes pour les jours sur mobile */
    .calendar {
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px; 
    }
    
    .day {
        min-height: 100px;
        padding: 10px;
        border-radius: 10px;
    }
    
    .day > div:first-child {
        font-size: 2em; 
    }
    .day > div:last-child {
        font-size: 0.9em; 
    }

    /* MODALE SUR MOBILE */
    .modal-content {
        padding: 15px;
        max-width: 95%; /* Prend plus de largeur */
        max-height: 98vh; /* Prend presque toute la hauteur */
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
    
    #selectedDate, #priceDisplay {
        font-size: 1rem;
    }
    
    /* Harmonisation des boutons */
    button {
        padding: 12px;
        font-size: 1rem;
    }

    .button-container {
        flex-direction: column;
    }
    
    /* FORMULAIRES */
    select, input, textarea {
        padding: 10px;
        font-size: 0.95rem;
    }

    /* LISTE RÉSERVATION SUR MOBILE */
    #reservations {
        max-height: 250px;
    }

    .reservation-item-container {
        flex-direction: column; 
        align-items: stretch;
    }
    
    .text-and-arrival-container {
        margin-bottom: 10px; 
        align-items: center; /* Aligne le texte et le bouton V/X */
    }
    
    .arrival-button {
        align-self: center; 
        margin-left: 10px;
    }
    
    .cancel-single-button {
        width: 100%; 
        margin-left: 0;
        align-self: stretch;
    }
}

/*  Voir le tableau de bord */

.dashboard-button {
    display: none;
}
