/* ==========================================================================
   SUPPRESSION GÉNÉRALE HEADER/FOOTER (MODE APP)
   ========================================================================== */

/* Masque le header, le footer et les widgets du thème WordPress */
header, footer, 
.site-header, .site-footer, 
.wp-block-template-part,
.nav-placeholder {
    display: none !important;
}

/* Supprime toutes les marges forcées par WordPress */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: var(--smoke) !important;
}

/* Nettoyage des conteneurs de thèmes (Twenty Twenty-Five, etc.) */
.wp-site-blocks, .entry-content, .post-content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}

/* Centre le contenu parfaitement dans l'écran vide */
.booking-main-wrapper, .tbl-mgt-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ==========================================================================
   1. VARIABLES & RESET
   ========================================================================== */
:root {
    --gold: #d4af37;
    --gold-dark: #aa8c2c;
    --night: #1a1a1a;
    --smoke: #f4f4f4;
    --white: #ffffff;
    --danger: #e74c3c;
    --success: #27ae60;
    --shadow: 0 10px 30px rgba(0,0,0,0.1);
    --radius: 12px;
}

* { box-sizing: border-box; }
body { 
    margin: 0; 
    font-family: 'Inter', -apple-system, sans-serif; 
    background: var(--smoke); 
    color: var(--night); 
    line-height: 1.5;
}

/* ==========================================================================
   2. ÉLÉMENTS COMMUNS (Wrappers, Cards, Alertes)
   ========================================================================== */
.booking-main-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 40px 20px; }
.booking-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; width: 100%; animation: fadeIn 0.4s ease; }
.booking-card-header { background: var(--night); padding: 30px; text-align: center; border-bottom: 4px solid var(--gold); }
.booking-title { color: var(--white); margin: 0; font-size: 24px; text-transform: uppercase; letter-spacing: 1px; }
.booking-subtitle { color: rgba(255,255,255,0.7); margin: 10px 0 0; font-size: 14px; }
.booking-badge { background: var(--gold); color: var(--night); display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 800; text-transform: uppercase; margin-bottom: 10px; }
.booking-card-body { padding: 40px; }

.booking-alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; border-left: 4px solid var(--gold); background: #fff9e6; font-size: 14px; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Champs de formulaire */
.booking-field { margin-bottom: 20px; }
.booking-field label { display: block; font-weight: 700; font-size: 12px; margin-bottom: 8px; text-transform: uppercase; color: #666; }
.booking-field input, .booking-field select { width: 100%; padding: 12px 15px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; transition: 0.3s; }
.booking-field input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1); }

/* Bouton Confirmer (Utilisé partout) */
.booking-btn-confirm { 
    width: 100%; padding: 16px; background: var(--night); color: var(--white); border: none; 
    border-radius: 8px; font-weight: 700; cursor: pointer; transition: 0.3s; text-transform: uppercase; letter-spacing: 1px;
}
.booking-btn-confirm:hover { background: var(--gold); color: var(--night); transform: translateY(-2px); }

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

/* ==========================================================================
  /* ==========================================================================
   1. VARIABLES & RESET WP (MODE APP)
   ========================================================================== */
:root {
    --gold: #d4af37;
    --night: #1a1a1a;
    --smoke: #f4f4f4;
    --white: #ffffff;
    --danger: #e74c3c;
    --success: #27ae60;
    --shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Cache les éléments WordPress inutiles */
header, footer, .site-header, .site-footer, #wpadminbar { display: none !important; }
html { margin-top: 0 !important; }
body { 
    margin: 0; padding: 0; 
    font-family: 'Inter', -apple-system, sans-serif; 
    background: var(--smoke) !important; 
}

/* ==========================================================================
   2. STRUCTURE COMMUNE (WRAPPERS & CARDS)
   ========================================================================== */
.app-main-wrapper { 
    display: flex; justify-content: center; align-items: flex-start; 
    min-height: 100vh; padding: 40px 20px; box-sizing: border-box;
}

.app-card { 
    background: white; border-radius: 15px; box-shadow: var(--shadow); 
    width: 100%; max-width: 1200px; overflow: hidden; animation: fadeIn 0.4s ease;
}

.app-header { 
    background: var(--night); padding: 30px; text-align: center; 
    border-bottom: 4px solid var(--gold); 
}

.app-title { color: white; margin: 0; text-transform: uppercase; font-size: 24px; }
.app-subtitle { color: rgba(255,255,255,0.7); font-size: 14px; margin-top: 10px; }
.app-badge { 
    background: var(--gold); color: var(--night); padding: 4px 12px; 
    border-radius: 20px; font-size: 11px; font-weight: 800; 
    display: inline-block; margin-bottom: 10px; 
}

.app-body { padding: 40px; }

/* ==========================================================================
   3. DASHBOARD (GRILLE & ITEMS)
   ========================================================================== */
.dashboard-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 20px; margin-bottom: 30px; 
}

.dash-item { 
    display: flex; align-items: center; padding: 20px; 
    background: #fff; border: 1px solid #eee; border-radius: 15px; 
    text-decoration: none; color: inherit; transition: 0.3s ease;
}

.dash-item:hover { 
    border-color: var(--gold); transform: translateY(-3px); box-shadow: var(--shadow); 
}

.dash-icon {
    width: 50px; height: 50px; background: var(--night); color: var(--gold);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-right: 15px;
}

/* ==========================================================================
   4. TABLES DE DONNÉES & GESTION (PLAN DE SALLE)
   ========================================================================== */
.split-layout { display: grid; grid-template-columns: 320px 1fr; gap: 40px; }

/* Tableaux */
.table-container { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { 
    text-align: left; padding: 12px; font-size: 12px; 
    color: #888; text-transform: uppercase; border-bottom: 2px solid #eee; 
}
.admin-table td { padding: 12px; border-bottom: 1px solid #eee; vertical-align: middle; }

/* Formulaires & Inputs */
.input-inline { border: 1px solid #eee; padding: 8px; border-radius: 6px; width: 100%; box-sizing: border-box; }
.w-small { width: 70px !important; text-align: center; }

/* Boutons d'actions */
.action-buttons { display: flex; gap: 8px; justify-content: flex-end; }
.btn-action { 
    width: 35px; height: 35px; border: none; border-radius: 6px; 
    cursor: pointer; color: white; transition: 0.2s; display: flex;
    align-items: center; justify-content: center;
}
.btn-save { background: var(--night); }
.btn-delete { background: var(--danger); }
.btn-check { background: var(--success); }

/* ==========================================================================
   5. FOOTER & RESPONSIVE
   ========================================================================== */
.app-footer { margin-top: 30px; border-top: 1px solid #eee; padding-top: 20px; }

.footer-actions {
    display: flex; flex-direction: column; gap: 15px; align-items: center;
}

@media screen and (min-width: 600px) {
    .footer-actions { flex-direction: row; justify-content: space-between; }
}

/* Correction Mobile */
@media screen and (max-width: 992px) {
    .split-layout { grid-template-columns: 1fr; }
    .app-main-wrapper { padding: 0; }
    .app-card { border-radius: 0; box-shadow: none; }
    .app-body { padding: 20px; }
    .app-header { border-radius: 0 0 25px 25px; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* Style harmonisé pour les menus déroulants */
select.input-inline {
    background-color: white;
    cursor: pointer;
    appearance: none; /* Enlever le style par défaut du navigateur */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
/* ==========================================================================
   FORMULAIRE DE RÉSERVATION (COMPLÉMENT)
   ========================================================================== */

/* Style spécifique pour les inputs en focus */
.input-inline:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    background-color: #fff;
}

/* Bouton principal de réservation */
.booking-btn-next {
    width: 100%;
    padding: 16px;
    background: var(--night);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.booking-btn-next:hover {
    background: var(--gold);
    color: var(--night);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}

/* Adaptation spécifique pour le split-layout sur mobile pour cette page */
@media screen and (max-width: 600px) {
    .app-main-wrapper { padding: 10px; }
    .split-layout { grid-template-columns: 1fr !important; gap: 20px !important; }
}
/* ==========================================================================
   5. PAGE CRÉNEAUX (.creneaux)
   ========================================================================= */
.creneaux .booking-card { max-width: 800px; }
.service-selector { display: flex; gap: 10px; margin-bottom: 30px; background: var(--smoke); padding: 5px; border-radius: 10px; }
.service-btn { flex: 1; padding: 12px; border: none; border-radius: 8px; cursor: pointer; font-weight: 700; transition: 0.3s; background: transparent; color: #777; }
.service-btn.active { background: var(--white); color: var(--night); box-shadow: 0 4px 10px rgba(0,0,0,0.05); }

.booking-time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
.time-item { position: relative; }
.time-item input { position: absolute; opacity: 0; }
.time-item label { 
    display: block; padding: 15px 5px; background: white; border: 2px solid #eee; 
    border-radius: 10px; text-align: center; cursor: pointer; font-weight: 600; transition: 0.3s;
}
.time-item label:hover:not(.full) { border-color: var(--gold); }
.time-item input:checked + label { background: var(--gold); border-color: var(--gold); color: var(--night); }
.time-item label.full { background: #f5f5f5; color: #ccc; cursor: not-allowed; border-color: #eee; }

/* ==========================================================================
   6. LOGIN & LIENS RETOUR
   ========================================================================== */
.login-card { max-width: 450px !important; }
.nav-admin-link { text-decoration: none; color: var(--gold); font-weight: 700; font-size: 14px; transition: 0.3s; }
.nav-admin-link:hover { color: var(--night); }

/* ==========================================================================
   7. RÉSERVATION CLIENT (.reservation)
   ========================================================================== */
.reservation .booking-card { max-width: 800px; }
.reservation .booking-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.reservation .booking-btn-next {
    background: var(--night);
    color: var(--white);
    padding: 16px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
}

.reservation .booking-btn-next:hover {
    background: var(--gold);
    color: var(--night);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ==========================================================================
   8. RESPONSIVE & WORDPRESS BREAKOUT
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* Écrase les marges imposées par le thème Twenty Twenty-Five */
    .wp-site-blocks, 
    main, 
    .entry-content, 
    .wp-block-post-content {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    body {
        padding: 0 !important;
        background: var(--white); /* Évite les bandes grises sur les côtés */
    }

    /* Force le wrapper à ignorer les limites parentes */
    .booking-main-wrapper.custom-mobile-fix {
        width: 100vw !important;
        margin-left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 0 !important;
        min-height: auto;
    }

    /* Le header noir devient plat pour coller aux bords */
    .booking-card {
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .booking-card-header {
        border-radius: 0 0 30px 30px !important;
        padding: 40px 20px !important;
    }

    .booking-card-body {
        padding: 25px !important;
    }

    /* Grille de formulaire en colonne sur mobile */
    .reservation .booking-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ==========================================================================
   9. PAGE : CONFIRMATION (.confirmation)
   ========================================================================== */
.confirmation .booking-card { max-width: 600px; text-align: center; }

/* Liste récapitulative en grille */
.confirmation .booking-card-body ul {
    list-style: none;
    padding: 0;
    margin: 25px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.confirmation .booking-card-body li {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--gold);
    text-align: left;
}

/* Style des labels (NOM, DATE, etc) */
.confirmation .booking-card-body li strong {
    display: block;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 4px;
    font-weight: 800;
}

/* Style des valeurs */
.confirmation .booking-card-body li {
    font-size: 15px;
    color: var(--night);
    font-weight: 600;
}

/* Mise en avant spéciale du dernier élément (CODE) */
.confirmation .booking-card-body li:last-child {
    grid-column: span 2;
    background: var(--night);
    color: var(--gold);
    text-align: center;
    border: 1px dashed var(--gold);
    padding: 20px;
}

.confirmation .booking-card-body li:last-child strong {
    color: rgba(255,255,255,0.5);
}

/* Bouton Retour Accueil sous forme de bouton */
.confirmation .nav-admin-link {
    display: inline-block;
    margin-top: 25px;
    padding: 12px 25px;
    background: #eee;
    color: var(--night);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    transition: 0.3s;
}

.confirmation .nav-admin-link:hover {
    background: var(--gold);
    color: var(--night);
}
/* ==========================================================================
   BOUTON PAGE CONFIRMATION (.confirmation)
   ========================================================================== */

/* On cible le bouton spécifiquement dans la page confirmation */
.confirmation .btn-confirmation-home {
    display: inline-block;
    margin-top: 30px;
    padding: 16px 40px;
    background: var(--night);     /* Fond noir par défaut */
    color: var(--gold);           /* Texte doré */
    border: 2px solid var(--gold); /* Bordure dorée */
    border-radius: 8px;
    text-decoration: none;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Effet au survol : le bouton se remplit de doré */
.confirmation .btn-confirmation-home:hover {
    background: var(--gold);
    color: var(--night);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

/* Effet quand on clique dessus */
.confirmation .btn-confirmation-home:active {
    transform: translateY(-1px);
}
/* ==========================================================================
   PAGE: ADMIN RÉSERVATIONS (Nouveau Bloc)
   ========================================================================== */

/* Structure du Tableau */
.res-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; margin-top: -8px; }
.res-table th { padding: 15px; font-size: 11px; text-transform: uppercase; color: #aaa; letter-spacing: 1px; font-weight: 800; }
.res-table td { background: white; padding: 15px; vertical-align: middle; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; }
.res-table td:first-child { border-left: 1px solid #f0f0f0; border-radius: 10px 0 0 10px; }
.res-table td:last-child { border-right: 1px solid #f0f0f0; border-radius: 0 10px 10px 0; }

/* Infos Client */
.res-info-client { display: flex; flex-direction: column; }
.client-name { font-weight: 700; color: var(--night); font-size: 14px; }
.client-meta { font-size: 12px; color: #888; margin-top: 2px; }

/* Date & Service */
.res-date { display: flex; flex-direction: column; line-height: 1.4; }
.res-date mark { background: #f0f0f0; color: #555; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 800; margin-top: 4px; width: fit-content; align-self: center; }

/* Badge Table */
.res-table-number { 
    background: var(--night); color: white; padding: 4px 10px; border-radius: 6px; 
    font-weight: 800; font-size: 12px; display: inline-block;
}

/* Pilules de Statut */
.res-status-pill {
    padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: 800;
    text-transform: uppercase; display: inline-block;
}
.status-en_attente { background: #fff4e5; color: #ff9800; border: 1px solid #ffe0b2; }
.status-confirme { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.status-annule { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

/* Actions */
.res-actions-group { display: flex; gap: 8px; justify-content: flex-end; }
.res-actions-group button {
    width: 35px; height: 35px; border-radius: 8px; border: none;
    cursor: pointer; transition: 0.3s; color: white;
}
.res-btn-confirm { background: #2e7d32; }
.res-btn-confirm:hover { background: #1b5e20; transform: scale(1.1); }
.res-btn-delete { background: #f44336; }
.res-btn-delete:hover { background: #d32f2f; transform: scale(1.1); }

/* Utilitaires */
.text-center { text-align: center; }
.text-right { text-align: right; }
.btn-back-dash {
    display: inline-block; text-decoration: none; color: var(--gold);
    font-weight: 800; font-size: 13px; transition: 0.3s;
}
.btn-back-dash:hover { transform: translateX(-5px); }

/* ==========================================================================
   PAGE: ADMIN RÉSERVATIONS (Optimisé Mobile)
   ========================================================================== */

.res-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; margin-top: -8px; }
.res-table th { padding: 15px; font-size: 11px; text-transform: uppercase; color: #aaa; letter-spacing: 1px; font-weight: 800; }
.res-table td { background: white; padding: 15px; vertical-align: middle; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; }
.res-table td:first-child { border-left: 1px solid #f0f0f0; border-radius: 10px 0 0 10px; }
.res-table td:last-child { border-right: 1px solid #f0f0f0; border-radius: 0 10px 10px 0; }

.res-info-client { display: flex; flex-direction: column; }
.client-name { font-weight: 700; color: var(--night); font-size: 14px; }
.client-meta { font-size: 12px; color: #888; margin-top: 2px; }

.res-date { display: flex; flex-direction: column; line-height: 1.4; }
.res-date mark { background: #f0f0f0; color: #555; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 800; margin-top: 4px; width: fit-content; align-self: center; }

.res-table-number { background: var(--night); color: white; padding: 4px 10px; border-radius: 6px; font-weight: 800; font-size: 12px; display: inline-block; }

.res-status-pill { padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: 800; text-transform: uppercase; display: inline-block; }
.status-en_attente { background: #fff4e5; color: #ff9800; border: 1px solid #ffe0b2; }
.status-confirme { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.status-annule { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

.res-actions-group { display: flex; gap: 8px; justify-content: flex-end; }
.res-actions-group button { width: 35px; height: 35px; border-radius: 8px; border: none; cursor: pointer; transition: 0.3s; color: white; }
.res-btn-confirm { background: #2e7d32; }
.res-btn-delete { background: #f44336; }

/* --- RESPONSIVE MOBILE : TABLEAU AVEC SCROLL HORIZONTAL (FIXÉ) --- */
@media screen and (max-width: 850px) {
    
    /* 1. Force le conteneur à devenir une fenêtre de scroll */
    .table-overflow-container {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important; /* Active le scroll horizontal */
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch; /* Scroll fluide sur iOS */
        padding-bottom: 10px; /* Espace pour la barre de scroll */
    }

    /* 2. Force le tableau à garder sa structure et dépasser en largeur */
    .res-table { 
        display: table !important; 
        min-width: 750px !important; /* Empêche l'écrasement, crée le scroll */
        width: 100%;
        border-spacing: 0 8px;
    }

    /* 3. Assure que les lignes et cellules se comportent normalement */
    .res-table thead { display: table-header-group !important; }
    .res-table tbody { display: table-row-group !important; }
    .res-table tr { display: table-row !important; }
    
    .res-table td, 
    .res-table th { 
        display: table-cell !important; 
        padding: 10px 15px !important;
        white-space: nowrap !important; /* Empêche le texte de revenir à la ligne */
        width: auto !important;
    }

    /* 4. On aligne le contenu pour la lisibilité mobile */
    .res-table td { text-align: center !important; }
    .res-table td:first-child { text-align: left !important; }

    /* 5. Nettoyage : cache les labels ::before des anciens tests */
    .res-table td::before { display: none !important; }

    /* 6. Optimisation de l'espace sur le dashboard */
    .app-body { padding: 10px !important; }
    .app-card { border-radius: 0 !important; }
}