/* SuiviPrix — feuille de style de l'application.
 * Mobile d'abord, écrans plein écran enchaînés, thème clair/sombre automatique.
 */

:root {
  --teal: #0b7285;
  --teal-clair: #15aabf;
  --teal-sombre: #095a6b;
  --jaune: #ffd43b;
  --jaune-sombre: #f2b705;
  --rouge: #e03131;
  --vert: #2f9e44;

  --fond: #f5f7f8;
  --carte: #ffffff;
  --texte: #10242a;
  --texte-doux: #5a6b70;
  --bord: #dbe4e7;
  --ombre: 0 2px 12px rgba(10, 40, 50, .08);

  --r: 14px;
  --pad: 16px;
  --tap: 52px; /* cible tactile confortable */
  --sa-bas: env(safe-area-inset-bottom, 0px);
  --sa-haut: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0b1416;
    --carte: #13242a;
    --texte: #e9fbff;
    --texte-doux: #8fa6ac;
    --bord: #24393f;
    --ombre: 0 2px 14px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app { min-height: 100%; }

/* ------------------------------------------------------------ écrans */

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--pad) + var(--sa-haut)) var(--pad) calc(var(--pad) + var(--sa-bas));
  /* Sur un écran de bureau, l'application garde son gabarit de téléphone :
     une colonne centrée plutôt qu'une interface étalée d'un bord à l'autre. */
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
.screen--active { display: flex; animation: entree .22s ease; }

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

.screen__barre {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--pad);
  min-height: 40px;
}
/* `min-width: 0` sans quoi un libellé de produit à rallonge refuse de rétrécir
   et pousse les raccourcis hors de l'écran. */
.screen__titre {
  font-size: 1.15rem; font-weight: 700;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Les raccourcis passent après le titre : présents, mais discrets. */
.screen__barre .bouton--icone[data-nav-accueil],
.screen__barre .bouton--icone[data-nav-compte] { flex: none; color: var(--texte-doux); font-size: 1.25rem; }
.screen__corps { flex: 1; display: flex; flex-direction: column; gap: var(--pad); }

/* ------------------------------------------------------------ éléments */

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border: none; border-radius: var(--r);
  background: var(--teal); color: #fff;
  font-size: 1rem; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: transform .08s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.bouton:active { transform: scale(.97); }
.bouton:disabled { opacity: .5; cursor: default; }
.bouton--large { width: 100%; }
.bouton--fantome { background: transparent; color: var(--texte); border: 1.5px solid var(--bord); }
.bouton--jaune { background: var(--jaune); color: #10242a; }
.bouton--danger { background: var(--rouge); }
.bouton--icone {
  min-height: 40px; width: 40px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--texte); font-size: 1.4rem;
}

.champ {
  width: 100%; min-height: var(--tap);
  padding: 0 16px;
  border: 1.5px solid var(--bord); border-radius: var(--r);
  background: var(--carte); color: var(--texte);
  font-size: 1rem; font-family: inherit;
}
.champ:focus { outline: none; border-color: var(--teal-clair); }
.label { font-size: .85rem; color: var(--texte-doux); margin-bottom: 6px; display: block; }

.carte {
  background: var(--carte);
  border-radius: var(--r);
  box-shadow: var(--ombre);
  padding: var(--pad);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--bord); background: var(--carte); color: var(--texte);
  font-size: .9rem; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.chip--actif { background: var(--teal); color: #fff; border-color: var(--teal); }

.discret { color: var(--texte-doux); font-size: .9rem; }
.centre { text-align: center; }
.pile { display: flex; flex-direction: column; gap: 12px; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ------------------------------------------------------------ accueil */

.accueil__scan {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; text-align: center;
}
.scan-cta {
  width: 190px; height: 190px; border-radius: 50%;
  border: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, var(--teal-clair), var(--teal));
  color: #fff; box-shadow: 0 12px 40px rgba(11, 114, 133, .4);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  transition: transform .1s;
}
.scan-cta:active { transform: scale(.95); }
.scan-cta__ico { font-size: 3.4rem; line-height: 1; }
.scan-cta__txt { font-size: 1.1rem; font-weight: 700; }

/* ------------------------------------------------------------ scan */

.viseur { position: relative; flex: 1; border-radius: var(--r); overflow: hidden; background: #000; }
.viseur video { width: 100%; height: 100%; object-fit: cover; }
.viseur__cadre {
  position: absolute; inset: 18% 12%;
  border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
}
.viseur__laser {
  position: absolute; left: 12%; right: 12%; height: 2px; background: var(--jaune);
  animation: balayage 2s ease-in-out infinite;
}
@keyframes balayage { 0%,100% { top: 20%; } 50% { top: 78%; } }

/* ------------------------------------------------------------ prix */

.prix-affiche {
  font-size: 3.2rem; font-weight: 800; text-align: center;
  letter-spacing: -1px; padding: 12px 0;
}
.prix-affiche small { font-size: 1.4rem; color: var(--texte-doux); }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pave button {
  min-height: 58px; border: none; border-radius: 12px;
  background: var(--carte); color: var(--texte); box-shadow: var(--ombre);
  font-size: 1.4rem; font-weight: 600; cursor: pointer;
}
.pave button:active { background: var(--teal); color: #fff; }

.rang {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--teal); color: #fff; padding: 4px 12px; border-radius: 999px;
  font-weight: 700;
}

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge--frais { background: rgba(47, 158, 68, .15); color: var(--vert); }
.badge--vieux { background: rgba(240, 173, 78, .18); color: #b8860b; }
.badge--suspect { background: rgba(224, 49, 49, .15); color: var(--rouge); }

/* ------------------------------------------------------------ divers */

.entete {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--carte); box-shadow: var(--ombre);
  font-size: .9rem; cursor: pointer;
}

.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--sa-bas)); transform: translateX(-50%);
  background: var(--texte); color: var(--fond);
  padding: 12px 20px; border-radius: 999px; box-shadow: var(--ombre);
  font-weight: 600; z-index: 100; animation: monte .25s ease;
  max-width: 90vw;
}
.toast--ok { background: var(--vert); color: #fff; }
.toast--err { background: var(--rouge); color: #fff; }
@keyframes monte { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.succes-tick {
  width: 84px; height: 84px; border-radius: 50%; background: var(--vert);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
  color: #fff; font-size: 2.6rem; animation: pop .3s ease;
}
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

.liste-resultats { display: flex; flex-direction: column; gap: 8px; }
.resultat { display: flex; align-items: center; gap: 12px; padding: 10px; cursor: pointer; }
.resultat img, .resultat .vignette {
  width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--bord);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.resultat__nom { font-weight: 600; }

.carte-gps {
  height: 240px;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bord);
  z-index: 0; /* garde les tuiles sous les toasts et l'en-tête */
}
.carte-gps .leaflet-control-attribution { font-size: 10px; }

.markdown p { margin: 6px 0; }
.markdown h4 { margin: 10px 0 4px; font-size: 1rem; }
.markdown ul { margin: 6px 0; padding-left: 20px; }
.markdown li { margin: 2px 0; }
.markdown code { background: var(--bord); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.markdown a { color: var(--teal-clair); }

.hors-ligne {
  background: var(--jaune); color: #10242a; text-align: center;
  padding: 6px; font-size: .85rem; font-weight: 600; border-radius: 8px;
}

/* Calendrier des scans — une case par jour, la pastille dit combien de relevés.
   La grille commence lundi : c'est la semaine telle qu'on la lit ici. */
.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  /* Les cases sont carrées : laissée pleine largeur, la grille donnerait sur un
     écran de bureau des cases hautes comme la main. Un calendrier garde la
     taille d'un calendrier, et se centre dans l'espace restant. */
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}
.cal__ent {
  text-align: center; padding: 4px 0;
  font-size: .75rem; font-weight: 700; color: var(--texte-doux);
}
.cal__jour {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1.5px solid var(--bord); border-radius: 10px;
  background: var(--carte); color: var(--texte);
  font-size: .95rem; font-family: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.cal__jour:disabled { border-color: transparent; background: transparent; color: var(--texte-doux); opacity: .35; cursor: default; }
.cal__jour--actif { border-color: var(--teal); font-weight: 700; }
.cal__jour--choisi { background: var(--teal); border-color: var(--teal); color: #fff; }
/* Aujourd'hui reste repérable même quand un autre jour est sélectionné. */
.cal__jour--aujourdhui { box-shadow: inset 0 0 0 2px var(--jaune); }
.cal__pastille {
  min-width: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--teal); color: #fff;
  font-size: .7rem; font-weight: 700; line-height: 16px;
}
.cal__jour--choisi .cal__pastille { background: #fff; color: var(--teal); }
/* Même gabarit que la grille, sinon les flèches de mois se retrouvent aux deux
   bouts de l'écran, loin du calendrier qu'elles commandent. */
.cal__mois {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; max-width: 380px; margin: 0 auto;
}
.cal__mois b { text-transform: capitalize; }
