/*
 * Styles de base des composants du kit (minuteur, formulaire, barre collante, liens de téléchargement).
 * Chaque page garde son propre style : elle règle ces variables et peut tout surcharger.
 */
:root {
  --tp-accent: #1d1b17;
  --tp-accent-texte: #fff;
  --tp-texte: #1d1b17;
  --tp-doux: #6b665c;
  --tp-fond: #fff;
  --tp-bord: #d9d2c3;
  --tp-erreur: #b3261e;
  --tp-rayon: 12px;
}

[hidden] { display: none !important; }

/* Minuteur : 3 blocs h / min / s */
[data-minuteur] { display: inline-flex; gap: 6px; font-variant-numeric: tabular-nums; }
[data-minuteur="texte"] { display: inline; }
body:not(.tp-pret) [data-minuteur]:empty::before { content: "--:--:--"; opacity: .5; }
.tp-m { display: inline-flex; align-items: baseline; gap: 2px; }
.tp-m b { font-size: 1.15em; }
.tp-m small { font-size: .7em; opacity: .75; }

/* Bonus rapides perdus quand l'offre est finie (vrai : le serveur ne les livre plus) */
.tp-bonus-perdu { opacity: .5; }
.tp-bonus-perdu h3, .tp-bonus-perdu .tp-bonus-titre { text-decoration: line-through; }

/* Formulaire */
form[data-commande] .tp-champ-erreur { border-color: var(--tp-erreur) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tp-erreur) 20%, transparent) !important; }
form[data-commande] [data-erreur] { color: var(--tp-erreur); font-weight: 600; font-size: 14px; margin: 6px 0 10px; }
form[data-commande] button[disabled] { opacity: .65; cursor: wait; }
/* Case « recevoir les nouveautés » : jamais cochée d'avance */
form[data-commande] .tp-accord { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; margin: 2px 0 14px; font-size: 14px; line-height: 1.45; cursor: pointer; }
form[data-commande] .tp-accord input { width: 20px; height: 20px; margin: 1px 0 0; }

/*
 * Pays et indicatif avec drapeaux. Le kit remplace le <select name="pays"> (gardé, caché) par un bouton, et
 * l'<output data-indicatif> par un bouton « drapeau +229 ». Pour qu'ils aient exactement le style des autres champs,
 * ajouter « .form .tp-choix » au sélecteur des champs dans le style de la page.
 */
.tp-choix-zone { position: relative; }
.tp-natif {
  position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important;
  margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; border: 0 !important; opacity: 0 !important; pointer-events: none !important;
}
.tp-choix {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 14px; margin: 0;
  border: 1.5px solid var(--tp-champ-bord, #cfc6b3); border-radius: var(--tp-rayon); background: var(--tp-fond); color: var(--tp-texte);
  font: inherit; font-size: 16px; line-height: 1.2; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.tp-choix:focus-visible, .tp-choix[aria-expanded="true"] {
  outline: none; border-color: var(--tp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tp-accent) 18%, transparent);
}
.tp-choix-contenu { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.tp-choix-texte { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tp-choix-texte.tp-choix-vide { color: var(--tp-doux); font-weight: 500; }
.tp-choix-fleche { display: inline-flex; flex: none; color: var(--tp-doux); transition: transform .15s ease; }
.tp-choix[aria-expanded="true"] .tp-choix-fleche { transform: rotate(180deg); }
.tp-choix.tp-choix-indicatif { width: auto; gap: 6px; padding: 0 8px 0 12px; font-variant-numeric: tabular-nums; }
.tp-choix-indicatif .tp-choix-contenu { gap: 8px; }
div.tp-tel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.tp-drapeau {
  flex: none; display: block; width: 24px; height: 18px; border-radius: 3px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); background: #ece8df;
}

.tp-liste {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px);
  display: flex; flex-direction: column; max-height: 340px; padding: 8px;
  background: var(--tp-fond); color: var(--tp-texte); border: 1px solid var(--tp-bord); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(20, 16, 8, .18);
}
.tp-liste.tp-haut { top: auto; bottom: calc(100% + 6px); }
.tp-liste-tete { display: none; }
.tp-liste .tp-recherche { flex: none; width: 100%; margin: 0 0 6px; }
.tp-recherche {
  min-height: 44px; padding: 0 12px; border: 1.5px solid var(--tp-bord); border-radius: 10px;
  background: var(--tp-fond); color: var(--tp-texte); font: inherit; font-size: 16px;
}
.tp-options {
  position: relative; flex: 1; min-height: 0; margin: 0; padding: 0; list-style: none;
  overflow-y: auto; overscroll-behavior: contain; outline: none;
}
.tp-groupe {
  padding: 12px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tp-doux);
}
.tp-options [role="option"] {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 10px; border-radius: 10px; cursor: pointer;
}
.tp-options [role="option"]:hover, .tp-options .tp-actif { background: color-mix(in srgb, var(--tp-accent) 9%, transparent); }
.tp-options [aria-selected="true"] { font-weight: 700; }
.tp-options [aria-selected="true"]::after {
  content: ""; flex: none; width: 7px; height: 12px; margin: -3px 4px 0 2px;
  border: solid var(--tp-accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.tp-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-ind { flex: none; font-variant-numeric: tabular-nums; }
.tp-liste-pays .tp-ind { color: var(--tp-doux); font-size: 14px; }
.tp-liste-indicatif .tp-ind { min-width: 48px; font-weight: 700; }
.tp-liste-indicatif .tp-nom { color: var(--tp-doux); }
.tp-liste-vide { margin: 0; padding: 14px 10px; color: var(--tp-doux); font-size: 14px; }
.tp-voile { display: none; }

@media (max-width: 560px) {
  .tp-voile { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(10, 10, 10, .45); }
  .tp-liste, .tp-liste.tp-haut {
    position: fixed; z-index: 71; left: 0; right: 0; top: auto; bottom: 0;
    max-height: 78vh; max-height: min(78dvh, 620px); padding: 4px 12px calc(12px + env(safe-area-inset-bottom));
    border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
  }
  .tp-liste-tete { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px 6px; font-size: 17px; }
  .tp-liste-fermer {
    width: 44px; height: 44px; margin-right: -8px; border: 0; background: transparent; color: var(--tp-doux);
    font-size: 28px; line-height: 1; cursor: pointer;
  }
  .tp-options [role="option"] { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) { .tp-choix-fleche { transition: none; } }

/* Fenêtre de commande (dialog) */
dialog[data-dialogue-commande] {
  border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  background: var(--tp-fond); color: var(--tp-texte); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
dialog[data-dialogue-commande]::backdrop { background: rgba(10, 10, 10, .55); }
@media (max-width: 560px) {
  dialog[data-dialogue-commande] { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; }
}

/* Barre d'achat collante (téléphone) */
[data-barre] {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; transform: translateY(110%);
  transition: transform .25s ease; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
[data-barre].tp-visible { transform: none; }
@media (prefers-reduced-motion: reduce) { [data-barre] { transition: none; } }

/* Liens de téléchargement (page merci) */
.tp-lien {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; margin: 0 0 10px;
  border: 1.5px solid var(--tp-bord); border-radius: var(--tp-rayon); color: var(--tp-texte); text-decoration: none; background: var(--tp-fond);
}
.tp-lien:hover { border-color: var(--tp-accent); }
.tp-lien-nom { font-weight: 600; overflow-wrap: anywhere; }
.tp-lien-action {
  flex: none; background: var(--tp-accent); color: var(--tp-accent-texte); font-weight: 700; font-size: 14px; padding: 8px 12px; border-radius: 999px;
}

/* Attente du paiement */
.tp-attente { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--tp-bord); border-top-color: var(--tp-accent); animation: tp-tourne 1s linear infinite; }
@keyframes tp-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tp-attente { animation-duration: 3s; } }
