:root {
    --primary-color: #2c3e50;
    --secondary-color: #ff9800;
    --accent-color: #ff9800;
    --bg-color: #fff3df;
    --card-bg: #ffffff;
    --text-color: #333;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.hidden { display: none !important; }

.form-group {
    margin-bottom: 1.2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group { flex: 1; }

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover { background-color: #4caf50; }
.btn-submit { background-color: var(--accent-color); width: 100%; font-weight: bold;}
.btn-submit:hover { background-color: #49361b; }
.btn-danger { background-color: #c9302c }
.btn-danger:hover { background-color: #c9302c; }

/* Tableaux Responsives */
.table-responsive { width: 100%; overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 0.75rem; border-bottom: 1px solid #ddd; }
th { background-color: #f2f2f2; }

/* Adaptabilité Mobile */
@media (max-width: 768px) {
    .form-row { flex-direction: column; gap: 0; }
    header { flex-direction: column; text-align: center; gap: 1rem; }
}

/* --- GESTION DES PAGES S.P.A (Routage Caché) --- */
.page {
    display: none; /* Cache complètement la page et ses éléments du DOM visuel */
    min-height: 100vh;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active-page {
    display: block; /* Affiche uniquement la page active */
}

/* Bouton d'accès admin discret */
.btn-admin-access {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}
.btn-admin-access:hover {
    background: rgba(255,255,255,0.1);
}

/* Animation de transition fluide */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
	
}

/* --- Styles des Badges de Statut dans le Panneau Admin --- */
/* --- Styles des Badges de Statut (Panneau Administration) --- */
.badge {
    display: inline-block !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-size: 0.85rem !important;
    /* font-weight: bold !important; */
    text-align: center !important;
    color: #ffffff !important; /* Force le texte en blanc */
}

/* Encadré à fond orange pour "En attente" */
.badge.status-en_attente {
    background-color: #ff9800 !important;
    border: 1px solid #e68a00 !important;
}

/* Encadré à fond vert pour "Accepté" */
.badge.status-acceptee {
    background-color: #4caf50 !important;
    border: 1px solid #43a047 !important;
}

/* Encadré à fond rouge pour "Refusé" */
.badge.status-refusee {
    background-color: #f44336 !important;
    border: 1px solid #e53935 !important;
}

/* Encadré à fond gris pour les annulations */
.badge.status-annulee, 
.badge.status-annulee_meteo {
    background-color: #777777 !important;
    border: 1px solid #666666 !important;
}

/* ==========================================================================
   ADAPTABILITÉ DU PANNEAU D'ADMINISTRATION (MOBILE & SMARTPHONES)
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. Ajustement des conteneurs principaux */
    #page-admin .container {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    #page-admin .card {
        padding: 1rem;
    }

    /* 2. Réorganisation des boutons de crise et formulaires en colonne */
    .control-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .control-group button {
        width: 100%;
        margin-right: 0 !important;
    }

    .admin-controls .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .admin-controls .form-row input, 
    .admin-controls .form-row button {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* 3. Transformation du Tableau en mode "Cartes" (Cards) */
    #page-admin table, 
    #page-admin thead, 
    #page-admin tbody, 
    #page-admin th, 
    #page-admin td, 
    #page-admin tr {
        display: block; /* Supprime le comportement de tableau figé */
    }

    /* Masquage des en-têtes de colonnes devenus inutiles */
    #page-admin thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Style de chaque ligne de réservation transformée en carte */
    #page-admin tr {
        background: #fdfdfd;
        border: 1px solid #ddd;
        border-radius: 6px;
        margin-bottom: 15px;
        padding: 10px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    /* Style des cellules de données */
    #page-admin td {
        border: none;
        border-bottom: 1px dashed #eee;
        position: relative;
        padding-left: 45% !important; /* Crée l'espace à gauche pour le titre */
        text-align: right; /* Aligne la valeur à droite */
        min-height: 28px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        box-sizing: border-box;
    }

    #page-admin td:last-child {
        border-bottom: none; /* Supprime la bordure sur le dernier élément */
    }

    /* Génération dynamique des labels à gauche de chaque ligne */
    #page-admin td::before {
        position: absolute;
        left: 10px;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--primary-color);
    }

    /* Injection des titres correspondants aux anciennes colonnes */
    #page-admin td:nth-of-type(1)::before { content: "Client :"; }
    #page-admin td:nth-of-type(2)::before { content: "Date & Heure :"; }
    #page-admin td:nth-of-type(3)::before { content: "Zone & Places :"; }
    #page-admin td:nth-of-type(4)::before { content: "Statut :"; }
    #page-admin td:nth-of-type(5)::before { content: "Table Physique :"; }
    #page-admin td:nth-of-type(6)::before { content: "Actions Statut :"; }
    #page-admin td:nth-of-type(7)::before { content: "Supprimer :"; }

    /* Ajustement des éléments interactifs (select et boutons) sur mobile */
    #page-admin td select {
        width: auto;
        max-width: 150px;
        padding: 4px;
    }

    #page-admin td button {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

/* ==========================================================================
   MODULE DE COMMANDE DE PIZZAS & INTERFACE PAYCONIQ PRO
   ========================================================================== */

/* Grille adaptative de cartes de pizzas */
.pizza-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pizza-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.pizza-card:hover {
    transform: translateY(-4px);
}

.pizza-emoji {
    font-size: 4rem;
    background: #fff8ee;
    padding: 20px;
    text-align: center;
}

.pizza-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.pizza-info h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
    color: #333;
}

.pizza-info h7 {
    margin: 0 0 10px 0;
    font-size: 0.7rem;
    display: flex;
    justify-content: space-between;
    color: #333;
}

.Nom_pizza_Artisanale {
    margin: 0 0 10px 0;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    color: #333;
}

.pizza-price {
    color: #d9534f;
    font-weight: bold;
}

.pizza-info p {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 15px 0;
    flex-grow: 1;
}

.pizza-info button {
    background: #d9534f;
    width: 100%;
    border-radius: 6px;
    font-weight: bold;
}
.pizza-info button:hover { background: #c9302c; }

/* Panier Coulissant Latéral (Cart Sidebar) */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    max-width: 100%;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 15px rgba(0,0,0,0.15);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.cart-sidebar.open {
    transform: translateX(0);
}

.cart-header {
    padding: 15px;
    background: #49361b;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-header h3 { margin:0; font-size:1.1rem; }
.close-cart { background:none; border:none; font-size:1.8rem; color:#fff; cursor:pointer; }

.cart-items-container {
    padding: 15px;
    flex-grow: 1;
    overflow-y: auto;
}

.cart-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    background: #fdfdfd;
}

.cart-total-line {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 15px;
}
#cart-total { color: #d9534f; }

.btn-payconiq {
    background: #00A1E4;
    width: 100%;
    padding: 12px;
    font-weight: bold;
    font-size: 1.05rem;
    border-radius: 8px;
}
.btn-payconiq:hover { background: #0082b8; }
.btn-payconiq:disabled { background: #ccc; cursor: not-allowed; }

/* Fenêtre de dialogue Floue Payconiq Modal */
.payconiq-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 20px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.payconiq-logo {
    width: 50px;
    height: 50px;
    background: #00A1E4;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    margin: 0 auto 15px;
}

.qr-box {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 12px;
    display: inline-block;
    margin: 15px 0;
    border: 1px solid #ddd;
}

.btn-simulate-success {
    background: #4CAF50;
    width: 100%;
    margin-bottom: 10px;
    border-radius: 6px;
}
.btn-simulate-success:hover { background: #217d72; }

.btn-close-modal {
    background: none;
    color: #666;
    width: 100%;
}
.btn-close-modal:hover { color: #333; background: #eee; }

/* --- Correction / Ajustement Global des Couleurs des Badges CSS --- */
.badge {
    display: inline-block !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-size: 0.85rem !important;
    font-weight: bold !important;
    text-align: center !important;
    color: #ffffff !important;
}
.badge.status-en_attente { background-color: #ff9800 !important; }
.badge.status-acceptee { background-color: #4caf50 !important; }
.badge.status-refusee { background-color: #f44336 !important; }

/* Responsive sur Tableaux en cartes */
@media (max-width: 768px) {
    #page-admin td:nth-of-type(6)::before { content: "Actions :"; }
    #page-admin td:nth-of-type(7)::before { content: "Supprimer :"; }
}

/* --- Menu d'onglets pour le Routage des Pages Clients --- */
.client-nav {
    display: flex;
    justify-content: center;
    background-color: #fff;
    border-bottom: 2px solid #eee;
    margin-bottom: 1.5rem;
}

.client-nav button {
    background: none;
    color: #666;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 0;
    border-bottom: 4px solid transparent;
    transition: all 0.3s ease;
}

.client-nav button:hover {
    background: #fff8ee;
    color: var(--primary-color);
}

/* Onglet actif (page courante) */
.client-nav button.active {
    color: var(--primary-color);
    border-bottom: 4px solid var(--primary-color);
    background: #fff8ee;
}

/* --- Gestion de l'affichage des sections (SPA) --- */
.client-section {
    display: none; /* Cache par défaut */
    animation: fadeInSection 0.4s ease-in-out;
}

.client-section.active {
    display: block; /* Affiche si actif */
}

@keyframes fadeInSection {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}