/* --- Variables et Style de Base --- */
:root {
    --main-bg-color: #f4f7f6;
    --widget-bg-color: #ffffff;
    --primary-text-color: #072440;
    --text-on-primary-color: #FFFFFF; /* Blanc par défaut */
    --secondary-text-color: #6c757d;
    --border-color: #dee2e6;
    --error-color: #e74c3c;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    --font-family: 'Montserrat', sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--main-bg-color);
    color: var(--primary-text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

/* --- Conteneur Principal (Widget) --- */
#booking-widget {
    width: 100%;
    max-width: clamp(250px, 95vw, 500px);
    background-color: var(--widget-bg-color);
    border-radius: 16px;
    padding: 32px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-content: center;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

/* --- Gestion des Étapes --- */
.booking-step { display: none; }
.booking-step.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
    width: 100%;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Éléments de Texte --- */
h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.6rem;
    font-weight: 600;
}
.subtitle {
    text-align: center;
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--secondary-text-color);
    font-size: 0.95rem;
}

/* --- Formulaires --- */
.form-group { margin-bottom: 20px; }
label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}
input[type="date"],
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-family);
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}
textarea { resize: vertical; }
input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-text-color);
    box-shadow: 0 0 0 3px rgba(7, 36, 64, 0.1);
}

/* --- Validation des champs --- */
.is-invalid {
    border-color: var(--error-color) !important;
}
.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}
.error-message {
    color: var(--error-color);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 6px;
    height: auto;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-in-out, margin-top 0.3s ease-out;
    overflow: hidden;
    text-align: center;
}
.error-message.visible {
    max-height: 20px; /* Assez grand pour une ligne de texte */
    opacity: 1;
}
.form-hint {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    margin-top: 6px;
}

/* --- Sélecteur Nombre de Personnes --- */
.party-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
}
.party-display {
    font-size: 1.2rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}
.party-btn {
    width: 40px;
    height: 40px;
    border: none;
    background-color: #f0f0f0;
    border-radius: 6px;
    font-size: 1.5rem;
    font-weight: 400;
    cursor: pointer;
    color: var(--primary-text-color);
    transition: background-color 0.2s;
}
.party-btn:hover { background-color: #e0e0e0; }
.party-btn:disabled { background-color: #f8f8f8; color: #ccc; cursor: not-allowed; }

/* --- Boutons --- */
.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-text-color);
    color: var(--text-on-primary-color);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}
.btn-primary:hover {
    background-color: #0b3b69;
    transform: translateY(-2px);
}
.btn-back {
    background: none;
    border: none;
    color: var(--secondary-text-color);
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 16px;
    padding: 0;
}
.btn-back:hover {
    color: var(--primary-text-color);
}

/* --- Créneaux Horaires --- */
.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    margin-top: 16px;
    max-height: 250px;
    overflow: auto;
}
.time-slot {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
.time-slot:hover {
    border-color: var(--primary-text-color);
    color: var(--primary-text-color);
}
.time-slot.selected {
    background-color: var(--primary-text-color);
    color: var(--text-on-primary-color);
    border-color: var(--primary-text-color);
}
.time-slot.unavailable {
    background-color: #f8f8f8;
    color: #ccc;
    cursor: not-allowed;
    border-color: var(--border-color);
}
.time-slot.unavailable:hover {
    /* On annule l'effet de survol */
    border-color: var(--border-color);
    color: #ccc;
}

/* --- Écran de chargement (Overlay) --- */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none; /* Caché par défaut */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
#loading-overlay.visible {
    display: block;
    opacity: 1;
}

/* --- Icône de succès --- */
.success-icon { width: 80px; height: 80px; display: block; margin: 20px auto; }
.success-icon__circle { stroke-dasharray: 166; stroke-dashoffset: 166; stroke-width: 2; stroke-miterlimit: 10; stroke: #072440; fill: none; animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards; }
.success-icon__check { transform-origin: 50% 50%; stroke-dasharray: 48; stroke-dashoffset: 48; stroke-width: 3; stroke: #072440; animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards; }
@keyframes stroke { 100% { stroke-dashoffset: 0; } }

/* --- Responsive --- */
@media (max-width: 480px) {
    body { align-items: flex-start; }
    #booking-widget { padding: 24px; border-radius: 0; min-height: 70vh; border: none; box-shadow: none; }
}

.copyrights {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    /* font-style: italic; */
    color: #b3b3b3;
    padding: 5px;
    width: 100%;
    text-align: center;
    background: #fff;
}

















/* MANAGE RESERVATION */


/* --- Widget de Gestion --- */
.manage-view { display: none; }
.manage-view.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}
.reservation-summary {
    margin: 32px 0;
    line-height: 1.8;
}
.reservation-summary p {
    margin: 8px 0;
    font-size: 1rem;
}
.reservation-summary strong {
    color: var(--primary-text-color);
    font-weight: 600;
    margin-right: 8px;
}
.reservation-summary span {
    color: var(--secondary-text-color);
}
.reservation-id {
    margin-top: 24px !important;
    font-size: 0.8rem !important;
    text-align: center;
    color: #bbb;
}
.reservation-id span {
    font-family: monospace;
    color: #bbb;
}

/* --- Groupes de boutons --- */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
}

/* --- Nouveaux types de boutons --- */
.btn-secondary {
    width: 100%;
    padding: 14px;
    background-color: transparent;
    color: var(--secondary-text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}
.btn-secondary:hover {
    background-color: #f8f9fa;
    color: var(--primary-text-color);
}
.btn-danger {
    width: 100%;
    padding: 14px;
    background-color: var(--error-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}
.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}




/* --- STYLES POUR LE SÉLECTEUR DE DATE PERSONNALISÉ --- */

.custom-datepicker {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
}

.datepicker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#current-month-year {
    font-weight: 600;
    font-size: 1.1rem;
}

.month-nav-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--secondary-text-color);
    transition: background-color 0.2s;
}
.month-nav-btn:hover {
    background-color: #f0f0f0;
}
.month-nav-btn:disabled {
    color: var(--border-color);
    cursor: not-allowed;
}

.datepicker-days-names,
.datepicker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.datepicker-days-names span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--secondary-text-color);
    padding: 8px 0;
}

.day-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border 0.2s;
    border: 2px solid transparent;
    font-size: 0.9rem;
    height: 1.5rem;
    width: 1.5rem;
    margin: auto;
}

.day-cell.today {
    font-weight: 600;
    border-color: var(--primary-text-color);
}

.day-cell.selected {
    background-color: var(--primary-text-color);
    color: var(--text-on-primary-color);
    font-weight: 600;
}

.day-cell.disabled,
.day-cell.past-day {
    color: #ccc;
    cursor: not-allowed;
    text-decoration: line-through;
    background-color: #f8f8f8;
}

.day-cell.empty {
    cursor: default;
    background-color: transparent;
}


/* --- STYLES POUR LE BANDEAU EN ATTENTE --- */

.pending-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(52, 152, 219, 0.08); /* Fond bleu très léger */
    color: #2980b9; /* Bleu foncé pour le texte */
    border: 1px solid rgba(52, 152, 219, 0.2);
    border-left: 5px solid #3498db; /* Bordure gauche bleue */
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    font-weight: 500;
}

.pending-banner .icon {
    font-size: 1.2rem;
    font-weight: bold;
}

/* --- STYLES POUR LE BANDEAU D'ANNULATION --- */

.cancellation-banner {
    display: flex; /* Permet un bel alignement de l'icône et du texte */
    align-items: center;
    gap: 12px;
    background-color: rgba(231, 76, 60, 0.08); /* Fond rouge très léger */
    color: #c0392b; /* Rouge foncé pour le texte */
    border: 1px solid rgba(231, 76, 60, 0.2);
    border-left: 5px solid #e74c3c; /* Bordure gauche rouge pour attirer l'oeil */
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    font-weight: 500;
}

.accepted-banner .icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.accepted-banner {
    display: flex; /* Permet un bel alignement de l'icône et du texte */
    align-items: center;
    gap: 12px;
    background-color: #3ce74414;
    color: #119846;
    border: 1px solid #3ce74414;
    border-left: 5px solid #119846; /* Bordure gauche rouge pour attirer l'oeil */
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    font-weight: 500;
}

.cancellation-banner .icon {
    font-size: 1.2rem;
    font-weight: bold;
}




/* --- STYLES POUR LE BRANDING DU RESTAURANT --- */

.restaurant-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

#restaurant-logo {
    max-height: 70px; /* Ajustez la hauteur maximale du logo */
    max-width: 180px; /* Ajustez la largeur maximale */
    object-fit: contain; /* Assure que le logo n'est pas déformé */
    margin-bottom: 16px;
    border-radius: 10px;
}

#restaurant-name {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-text-color);
    margin: 0;
    text-align: center;
}


p {
    text-align: center;
}

/* --- STYLES POUR LE POPUP D'INFORMATIONS --- */

/* Bouton de déclenchement */
.info-btn {
    background: none;
    border: none;
    color: var(--secondary-text-color);
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: -6px; /* Pour le rapprocher du titre */
    margin-bottom: 12px;
}
.info-btn:hover {
    color: var(--primary-text-color);
}

/* Overlay (fond semi-transparent) */
.info-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.info-popup-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Contenu du popup */
.info-popup {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90vw;
    max-width: 500px;
    padding: 24px 32px;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    margin: 20px;
}
.info-popup-overlay.visible .info-popup {
    transform: scale(1);
}

.info-popup .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    color: var(--secondary-text-color);
    cursor: pointer;
    line-height: 1;
}
.info-popup .close-btn:hover {
    background: #e0e0e0;
}

.info-popup h2 {
    margin-top: 0;
    margin-bottom: 24px;
    text-align: center;
    color: var(--primary-text-color);
}

.info-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.info-section h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1rem;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.info-item .icon {
    font-size: 1.2rem;
    color: var(--primary-text-color);
    width: 24px;
    text-align: center;
}
.info-item p, .info-item a {
    margin: 0;
    font-size: 1rem;
    color: var(--primary-text-color);
    text-decoration: none;
}
.info-item a:hover {
    text-decoration: underline;
}

.map-link {
    display: inline-block;
    margin-top: 8px;
    font-weight: 500;
    text-decoration: none;
    color: var(--primary-text-color);
}
.map-link:hover {
    text-decoration: underline;
}
.hours-list .hour {
    text-align: end;
    margin-left: 5px;
}
.hours-list .day {
    font-weight: 500;
    width: 6rem;
    text-align: start;
}
.hours-list p {
    margin: 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0px;
    border-bottom: solid 1px #ddd;
}

.extra-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}