/* T-Lab Booking — popup de réservation (Phase 1) — style Tesla (rouge #E11B22) */
:root { --tlb-red: #E11B22; --tlb-red-dark: #B3161B; --tlb-ink: #171a20; --tlb-muted: #5c5e62; --tlb-border: #e3e3e3; }

html.tlb-lock { overflow: hidden; }

.tlb-overlay {
    position: fixed; inset: 0; z-index: 99999;
    display: none; align-items: center; justify-content: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.tlb-overlay.is-open { display: flex; }
.tlb-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }

/* Force le masquage réel des étapes/boutons en [hidden] : le thème (section{display:block})
   neutralise sinon l'attribut [hidden], et toutes les étapes s'affichent d'un coup. */
.tlb-overlay [hidden] { display: none !important; }

.tlb-dialog {
    position: relative; z-index: 1;
    width: min(680px, 94vw); max-height: 92vh;
    background: #fff; border-radius: 14px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.tlb-close {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    -webkit-appearance: none; appearance: none; /* sinon iOS rend un 2e fond natif → cercle « dupliqué » */
    display: flex; align-items: center; justify-content: center;
    box-sizing: border-box; padding: 0;
    width: 34px; height: 34px; border: 0; border-radius: 50%;
    background: rgba(0,0,0,.05); color: var(--tlb-ink);
    font-size: 22px; line-height: 1; cursor: pointer;
}
.tlb-close:hover { background: rgba(0,0,0,.1); }
/* WoodMart force `min-height` (et appearance) aux <button> → le × deviendrait une ellipse.
   On neutralise avec une spécificité suffisante (un simple .tlb-close !important ne gagne pas). */
.tlb-overlay .tlb-dialog .tlb-close { min-width: 0 !important; min-height: 0 !important; }

/* Header + étapes */
.tlb-head { padding: 22px 24px 0; }
.tlb-title { margin: 0 0 14px; font-size: 20px; font-weight: 600; color: var(--tlb-ink); }
.tlb-steps { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 0; padding: 0 0 14px; border-bottom: 1px solid var(--tlb-border); }
.tlb-steps li { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; color: var(--tlb-muted); }
.tlb-steps li span { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #eee; font-size: 11px; font-weight: 600; }
.tlb-steps li.is-active { color: var(--tlb-ink); font-weight: 600; }
.tlb-steps li.is-active span { background: var(--tlb-red); color: #fff; }
.tlb-steps li.is-done span { background: var(--tlb-ink); color: #fff; }

/* Corps */
.tlb-body { padding: 20px 24px; overflow-y: auto; }
.tlb-step-title { margin: 0 0 14px; font-size: 16px; font-weight: 600; color: var(--tlb-ink); }
.tlb-muted { color: var(--tlb-muted); font-size: 13px; }

/* Récap */
.tlb-recap-model { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.tlb-recap-list { list-style: none; margin: 0 0 14px; padding: 0; }
.tlb-recap-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.tlb-recap-list li:last-child { border-bottom: none; } /* dernière option : pas de barre → évite le double séparateur avec le bloc Total (vaut aussi pour une seule prestation) */
.tlb-recap-empty { color: var(--tlb-muted); }
.tlb-recap-tot > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.tlb-recap-rem { color: var(--tlb-red); }
.tlb-recap-grand { font-weight: 700; font-size: 16px; border-top: 1px solid var(--tlb-border); margin-top: 4px; padding-top: 20px !important; }

/* Centres */
.tlb-centres { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tlb-centre { display: flex; flex-direction: column; gap: 5px; text-align: left; padding: 16px; border: 1.5px solid var(--tlb-border); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.tlb-centre:hover { border-color: #bbb; }
.tlb-centre.is-sel { border-color: var(--tlb-red); box-shadow: 0 0 0 3px rgba(225,27,34,.12); }
.tlb-centre-nom { font-weight: 600; color: var(--tlb-ink); }
.tlb-centre-ville { font-size: 11px; color: var(--tlb-muted); text-align: center; }

/* Champs */
.tlb-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.tlb-field > span { font-size: 13px; font-weight: 500; color: var(--tlb-ink); }
.tlb-field input { padding: 11px 12px; border: 1.5px solid var(--tlb-border); border-radius: 8px; font-size: 15px; font-family: inherit; }
.tlb-field input:focus { outline: none; border-color: var(--tlb-red); }
.tlb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.tlb-consent { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--tlb-muted); margin-top: 4px; }
.tlb-consent input { margin-top: 2px; }

/* Créneaux */
.tlb-slots { display: flex; flex-wrap: wrap; gap: 10px; }
.tlb-slot { padding: 10px 18px; border: 1.5px solid var(--tlb-border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--tlb-ink); }
.tlb-slot:hover { border-color: #bbb; }
.tlb-slot.is-sel { border-color: var(--tlb-red); background: var(--tlb-red); color: #fff; }

/* Heure de récupération */
.tlb-mt { margin-top: 26px; }
.tlb-retour-jour { margin: 0 0 12px; font-size: 14px; color: var(--tlb-muted); }
.tlb-retour-jour strong { color: var(--tlb-ink); }
.tlb-check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--tlb-ink); margin-top: 14px; cursor: pointer; }
.tlb-check input { margin-top: 2px; }
.tlb-autre-jour { margin-top: 12px; }
.tlb-autre-jour .tlb-field { margin-bottom: 0; max-width: 280px; }

/* Champ date maison + calendrier (style T-Lab) */
.tlb-datefield { position: relative; max-width: 280px; }
.tlb-datebox { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 11px 12px; border: 1.5px solid var(--tlb-border); border-radius: 8px; background: #fff; font-size: 15px; font-family: inherit; color: var(--tlb-ink); cursor: pointer; text-align: left; }
.tlb-datebox:hover { border-color: #bbb; }
.tlb-datebox.is-open { border-color: var(--tlb-red); }
.tlb-date-ph { color: #8a8a8e; }
.tlb-cal-ico { color: var(--tlb-muted); flex-shrink: 0; }
.tlb-cal { position: fixed; z-index: 100; width: 280px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--tlb-border); border-radius: 12px; box-shadow: 0 10px 34px rgba(0,0,0,.18); padding: 12px; }
.tlb-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tlb-cal-mon { font-weight: 600; font-size: 14px; color: var(--tlb-ink); text-transform: capitalize; }
.tlb-cal-nav { border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--tlb-ink); cursor: pointer; padding: 2px 9px; border-radius: 6px; }
.tlb-cal-nav:hover { background: #f3f3f4; color: var(--tlb-red); }
.tlb-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.tlb-cal-wd { display: flex; align-items: center; justify-content: center; height: 24px; font-size: 11px; color: var(--tlb-muted); }
.tlb-cal-day { display: flex; align-items: center; justify-content: center; width: 100%; height: 34px; padding: 0; margin: 0; border: 0; background: transparent; border-radius: 8px; font-size: 13px; font-family: inherit; color: var(--tlb-ink); cursor: pointer; }
.tlb-cal-day:hover:not([disabled]) { background: #f3f3f4; }
.tlb-cal-day.is-sel { background: var(--tlb-red); color: #fff; }
.tlb-cal-day[disabled] { color: #ccc; cursor: default; }

/* Liste déroulante (heure de récupération) */
.tlb-select { width: 100%; max-width: 280px; padding: 11px 12px; border: 1.5px solid var(--tlb-border); border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff; color: var(--tlb-ink); cursor: pointer; }
.tlb-select:focus { outline: none; border-color: var(--tlb-red); }
.tlb-select:disabled { color: var(--tlb-muted); background: #f7f7f8; cursor: default; }

/* Erreurs */
.tlb-err { color: var(--tlb-red); font-size: 13px; margin: 12px 0 0; }

/* Paiement */
.tlb-pay-amounts { margin-bottom: 18px; }
.tlb-pay-opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--tlb-border); border-radius: 10px; margin-bottom: 10px; cursor: pointer; font-size: 15px; }
.tlb-pay-opt:hover { border-color: #bbb; }
.tlb-pay-fixed { font-size: 16px; background: #f7f7f8; border-radius: 10px; padding: 14px 16px; margin: 0 0 18px; }
.tlb-pay-methods { display: flex; flex-direction: column; gap: 10px; }
.tlb-pay-methods .tlb-btn { width: 100%; padding: 13px; font-size: 15px; }

/* Confirmation */
.tlb-done { text-align: center; padding: 24px 8px; }
.tlb-done-ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: var(--tlb-red); color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; }
.tlb-done-text { color: var(--tlb-muted); margin: 0 0 18px; }

/* Footer */
.tlb-foot { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--tlb-border); }
.tlb-foot-spacer { flex: 1; }
.tlb-btn { padding: 11px 22px; border-radius: 6px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; border: 1.5px solid transparent; }
.tlb-btn-primary { background: var(--tlb-red); color: #fff; border-color: var(--tlb-red); }
.tlb-btn-primary:hover { background: var(--tlb-red-dark); border-color: var(--tlb-red-dark); }
.tlb-btn-ghost { background: #fff; color: var(--tlb-ink); border-color: var(--tlb-border); }
.tlb-btn-ghost:hover { border-color: var(--tlb-ink); }
.tlb-btn-paypal { background: #ffc439; color: #003087; border-color: #ffc439; }
.tlb-btn-paypal:hover { background: #f0b72e; border-color: #f0b72e; }

/* Mobile : plein écran */
@media (max-width: 600px) {
    /* Ancré en haut (pas centré) + 100dvh : sinon, sur iPhone, 100vh > zone visible (barre d'URL)
       et le centrage pousse le titre + le × au-dessus de l'écran → coupés. */
    .tlb-overlay { align-items: flex-start; }
    .tlb-dialog { width: 100vw; height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0; }
    .tlb-centres, .tlb-grid2 { grid-template-columns: 1fr; }
    /* Étapes : une seule ligne, pastilles alignées (sinon « Coordonnées » passe à la ligne / se décale). */
    .tlb-steps { flex-wrap: nowrap; align-items: center; gap: 4px 6px; overflow-x: auto; }
    .tlb-steps li { white-space: nowrap; font-size: 11px; }
    .tlb-steps li span { margin: 0; width: 18px; height: 18px; }
    /* Respiration en haut (~30px) + bouton de fermeture bien visible/accessible. */
    .tlb-head { padding-top: 34px; }
    .tlb-close { top: 26px; width: 38px; height: 38px; font-size: 24px; }
    /* Le calendrier (popover) doit TOUJOURS passer au-dessus du pied (Précédent / Suivant) sur mobile.
       Cause iOS : Safari promeut .tlb-body (overflow-y:auto) en couche composite, ce qui EMPRISONNE
       le calendrier position:fixed dans cette couche → il passe sous le pied quel que soit son z-index.
       Fix : on remonte la couche du corps (.tlb-body) AU-DESSUS du pied. Le calendrier (piégé dedans)
       passe alors au-dessus. Garde-fous : pied épinglé bas (z-index 1) + calendrier à z-index 100000
       (prend le relais s'il s'échappe vers un contexte supérieur). */
    .tlb-body { position: relative; z-index: 2; }
    .tlb-foot { position: relative; z-index: 1; }
    .tlb-cal { z-index: 100000; }
}
