/* Comparateur ELEKIO — CSS écrit à la main, mobile-first, sans dépendance. */

:root {
  --fond: #f4f4f2;
  --surface: #fcfcfb;
  --texte: #0b0b0b;
  --texte-2: #52514e;
  --bordure: #d9d8d3;
  --accent: #1f5fae;
  --accent-texte: #ffffff;
  --meilleur-fond: #e3f4ea;
  --meilleur-bord: #1b7a4b;
  --alerte: #a8261f;
  --alerte-fond: #fbeaea;
  --demo-fond: #fff4d6;
  --grille: #e6e5e0;
  --serie-1: #2a78d6;
  --serie-2: #eb6834;
  --serie-3: #1baf7a;
  --serie-4: #eda100;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121211;
    --surface: #1a1a19;
    --texte: #f0efec;
    --texte-2: #c3c2b7;
    --bordure: #3a3a37;
    --accent: #5b9be8;
    --accent-texte: #0b0b0b;
    --meilleur-fond: #16382a;
    --meilleur-bord: #4cc38a;
    --alerte: #ff8f87;
    --alerte-fond: #3a1a18;
    --demo-fond: #3b3115;
    --grille: #2c2c2a;
    --serie-1: #3987e5;
    --serie-2: #d95926;
    --serie-3: #199e70;
    --serie-4: #c98500;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0 0 0.25rem; }
code { font-size: 0.9em; }
small { color: var(--texte-2); }

.masque {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Barre de navigation ------------------------------------------------ */
.barre {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.75rem 4%;
  background: var(--surface); border-bottom: 1px solid var(--bordure);
}
.marque { font-weight: 700; text-decoration: none; color: var(--texte); }
.marque span { font-weight: 400; color: var(--texte-2); }
.menu { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; }
.menu a { text-decoration: none; padding: 0.4rem 0; }
.menu a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
.deconnexion { margin: 0; }
.lien {
  background: none; border: 0; padding: 0.4rem 0; color: var(--accent);
  font: inherit; cursor: pointer; text-decoration: underline;
}

.bandeau-demo {
  margin: 0; padding: 0.5rem 4%; background: var(--demo-fond);
  border-bottom: 1px solid var(--bordure); font-size: 0.9rem;
}

.contenu { width: 92%; max-width: 1200px; margin: 0 auto; padding: 1rem 0 3rem; }

/* --- Blocs ---------------------------------------------------------------- */
.carte {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: 8px;
  padding: 1rem; margin: 0 0 1rem;
}
.alerte {
  background: var(--alerte-fond); color: var(--alerte); border-radius: 6px;
  padding: 0.5rem 0.75rem; margin: 0.5rem 0;
}
.alerte-texte { color: var(--alerte); }
.aide { color: var(--texte-2); font-size: 0.9rem; margin: 0.5rem 0 0; }
.na { color: var(--texte-2); font-style: italic; }

/* --- Formulaires ------------------------------------------------------------ */
label { display: block; font-weight: 600; margin: 0.75rem 0 0.25rem; }
input[type="email"], input[type="password"], input[type="search"], textarea {
  display: block; width: 100%; padding: 0.6rem; font: inherit; color: var(--texte);
  background: var(--fond); border: 1px solid var(--bordure); border-radius: 6px;
}
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
input:focus, textarea:focus, button:focus, a:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.bouton {
  display: inline-block; margin-top: 0.75rem; padding: 0.65rem 1.2rem; min-height: 44px;
  font: inherit; font-weight: 600; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: var(--accent-texte); text-decoration: none;
}
.bouton.secondaire { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.bouton[disabled] { opacity: 0.6; cursor: wait; }

.connexion { max-width: 420px; margin: 3rem auto; }
.connexion h1 { font-size: 1.2rem; }
.connexion .bouton { width: 100%; }

.recherche { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.recherche input { flex: 1 1 60%; }
.recherche .bouton { margin-top: 0; }

progress { width: 100%; height: 1rem; }

/* --- Résultat : cartes (mobile) puis tableau (large) ------------------------ */
.synthese { margin: 0 0 1rem; }
.vue-tableau { display: none; }
.vue-cartes { list-style: none; margin: 0; padding: 0; }
.carte-ref dl { margin: 0.5rem 0 0; }
.carte-ref .offre {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem;
  padding: 0.5rem; border-top: 1px solid var(--bordure);
}
.carte-ref dt { font-weight: 600; flex: 0 0 40%; }
.carte-ref dd { margin: 0; flex: 1 1 50%; text-align: right; }
.offre.meilleur, td.meilleur {
  background: var(--meilleur-fond); box-shadow: inset 4px 0 0 var(--meilleur-bord);
}
.total-carte { margin: 0.5rem 0 0; text-align: right; }
.designation { display: block; color: var(--texte-2); font-size: 0.9rem; font-weight: 400; }

.prix { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge-meilleur {
  display: inline-block; font-size: 0.75rem; font-weight: 700; color: var(--meilleur-bord);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.ecart { display: block; font-size: 0.85rem; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.detail { display: block; font-size: 0.8rem; color: var(--texte-2); }
.motif { overflow-wrap: anywhere; }

table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { padding: 0.5rem; border-bottom: 1px solid var(--bordure); text-align: left; vertical-align: top; }
thead th { font-size: 0.85rem; color: var(--texte-2); border-bottom: 2px solid var(--bordure); }
tfoot th, tfoot td { border-top: 2px solid var(--bordure); font-weight: 600; }
.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total { font-weight: 700; }
.vue-defilante { overflow-x: auto; }

@media (min-width: 900px) {
  .vue-tableau { display: block; overflow-x: auto; }
  .vue-cartes { display: none; }
  .comparatif td.cellule { width: 17%; }
  h1 { font-size: 1.6rem; }
}

/* --- Bibliothèque ----------------------------------------------------------- */
.liste-produits, .liste-releves { list-style: none; margin: 0; padding: 0; }
.produit { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: baseline; }
.produit .choix { display: flex; gap: 0.5rem; align-items: center; margin: 0; flex: 0 0 auto; }
.produit .choix input { width: 1.2rem; height: 1.2rem; }
.produit .ref { font-family: ui-monospace, Menlo, Consolas, monospace; }
.produit .designation { flex: 1 1 60%; }
.produit .meilleur-prix { flex: 1 1 100%; }
.produit small { display: inline-block; }
@media (min-width: 900px) {
  .produit .meilleur-prix { flex: 0 1 35%; }
}

/* --- Relevés ------------------------------------------------------------------ */
.releve-entete { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.etiquette-etat { font-size: 0.8rem; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--bordure); }
.etat-interrompu .etiquette-etat { color: var(--alerte); border-color: var(--alerte); }
.releve-chiffres { margin: 0.5rem 0 0; }
.detail-erreurs { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.9rem; overflow-wrap: anywhere; }

/* --- Graphique SVG ------------------------------------------------------------ */
.figure-graphique { margin: 0 0 1rem; }
.figure-graphique figcaption { font-weight: 600; margin-bottom: 0.5rem; }
.graphique { display: block; width: 100%; height: auto; }
.graphique .grille { stroke: var(--grille); stroke-width: 1; }
.graphique .axe { fill: var(--texte-2); font-size: 20px; }
.graphique .etiquette { fill: var(--texte); font-size: 20px; }
@media (min-width: 900px) {
  .figure-graphique { max-width: 760px; }
  .graphique .axe, .graphique .etiquette { font-size: 11px; }
}
.graphique .ligne { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphique .cible { fill: transparent; }
.graphique .marqueur { stroke: var(--surface); stroke-width: 2; }
.graphique .ligne.serie-1 { stroke: var(--serie-1); }
.graphique .ligne.serie-2 { stroke: var(--serie-2); }
.graphique .ligne.serie-3 { stroke: var(--serie-3); }
.graphique .ligne.serie-4 { stroke: var(--serie-4); }
.graphique .marqueur.serie-1, .pastille.serie-1 { fill: var(--serie-1); background: var(--serie-1); }
.graphique .marqueur.serie-2, .pastille.serie-2 { fill: var(--serie-2); background: var(--serie-2); }
.graphique .marqueur.serie-3, .pastille.serie-3 { fill: var(--serie-3); background: var(--serie-3); }
.graphique .marqueur.serie-4, .pastille.serie-4 { fill: var(--serie-4); background: var(--serie-4); }
.graphique .point:hover .marqueur { stroke: var(--texte); }
.legende { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.5rem 0 0; padding: 0; font-size: 0.9rem; }
.pastille { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; margin-right: 0.35rem; vertical-align: -0.05rem; }
