/* LosRadinos — interface de téléphone, sobre et lisible.
   Colonne de lecture : 390 px, marges : 16 px, aucun défilement horizontal. */

:root {
  color-scheme: light dark;
  --largeur: 390px;
  --marge: 16px;

  --vert: #1f6f50;
  --vert-appuye: #17573f;
  --accent: #1f6f50;
  --fond: #f3f7f4;
  --surface: #ffffff;
  --surface-douce: #e8f1eb;
  --texte: #14201a;
  --texte-doux: #50635a;
  --bord: #d6e2db;
  --erreur: #a12b20;
  --ombre: 0 1px 2px rgba(20, 32, 26, 0.07);
  --voile-haut: rgba(243, 247, 244, 0.45);
  --couleur-prix: #1f6f50;
  --couleur-conseil: #a4502a;
  --voile-bas: rgba(243, 247, 244, 0.82);

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --vert: #1f6f50;
    --vert-appuye: #278660;
    --accent: #7ccfa9;
    --fond: #0f1512;
    --surface: #17211c;
    --surface-douce: #203029;
    --texte: #edf3ef;
    --texte-doux: #a9b8b0;
    --bord: #2c3c33;
    --erreur: #ff9a8f;
    --ombre: none;
    --voile-haut: rgba(15, 21, 18, 0.55);
    --couleur-prix: #7ccfa9;
    --couleur-conseil: #f2a27a;
    --voile-bas: rgba(15, 21, 18, 0.86);
  }
}

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

[hidden] {
  display: none !important;
}

html {
  background: var(--fond);
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: calc(var(--largeur) + 2 * var(--marge));
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--marge);
  padding-top: calc(78px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  background: transparent;
  color: var(--texte);
  font-family: inherit;
  font-size: 17px;
  line-height: 1.55;
}

/* Fond : la photo du village, sous un voile qui garde le texte lisible.
   Couche fixe plutôt que background-attachment: fixed, ignoré sur iPhone. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(var(--voile-haut), var(--voile-bas)),
    url("/icones/fond.jpg") center / cover no-repeat,
    var(--fond);
}

body.sans-entete {
  padding-top: calc(28px + env(safe-area-inset-top));
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ en-tête */

.entete {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: var(--surface);
  border-bottom: 1px solid var(--bord);
}

.entete-contenu {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(var(--largeur) + 2 * var(--marge));
  min-height: 60px;
  margin: 0 auto;
  padding: 6px var(--marge);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin-right: auto;
  color: var(--texte);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.logo img {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.signature {
  font-size: 0.62em;
  font-weight: 600;
  color: var(--texte-doux);
  letter-spacing: 0;
  white-space: nowrap;
}

.entete-navigation {
  display: flex;
  align-items: center;
  gap: 2px;
}

.lien-entete {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.lien-entete:hover {
  background: var(--surface-douce);
}

@media (max-width: 359px) {
  .logo span {
    display: none;
  }
}

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

.titre-ecran {
  margin: 4px 0 18px;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.demarrage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60vh;
  color: var(--texte-doux);
}

.marque {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-align: center;
}

.sous-titre {
  margin: 0;
  color: var(--texte-doux);
  text-align: center;
}

.accueil-connexion {
  margin: 0 0 24px;
  text-align: center;
}

.icone-connexion {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 20px;
  box-shadow: var(--ombre);
}

.ecran-connexion {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding-bottom: 24px;
}

/* -------------------------------------------------------------------- cartes */

.carte {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--bord);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--ombre);
}

label {
  display: block;
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1.5px solid var(--bord);
  border-radius: 14px;
  background: var(--fond);
  color: var(--texte);
  font: inherit;
  font-size: 17px;
}

input:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.aide {
  margin: 0;
  color: var(--texte-doux);
  font-size: 0.94rem;
  line-height: 1.45;
}

/* Les deux usages de la recherche : vert = meilleur prix, terre cuite = conseil. */
.aide-prix {
  color: var(--couleur-prix);
  font-weight: 600;
}

.aide-conseil {
  color: var(--couleur-conseil);
  font-weight: 600;
}

.erreur {
  margin: 0;
  color: var(--erreur);
  font-size: 0.95rem;
  font-weight: 600;
}

.attente {
  margin: 16px 4px 4px;
  color: var(--texte-doux);
  font-size: 0.95rem;
  text-align: center;
}

/* ------------------------------------------------------------------- boutons */

.bouton-principal,
.bouton-secondaire {
  min-height: 48px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 650;
}

.bouton-principal {
  border: 0;
  background: var(--vert);
  color: #ffffff;
  box-shadow: var(--ombre);
}

.bouton-principal:hover {
  background: var(--vert-appuye);
}

.bouton-secondaire {
  border: 1.5px solid var(--bord);
  background: var(--surface);
  color: var(--accent);
}

.bouton-secondaire:hover {
  background: var(--surface-douce);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.carte .bouton-principal {
  margin-top: 4px;
}

.lien-bouton {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.lien-secondaire {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.lien-secondaire:hover {
  text-decoration: underline;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.actions .bouton-secondaire {
  flex: 1;
  width: auto;
}

/* --------------------------------------------------------------------- suivi */

.demande-affichee {
  margin: 0 0 6px;
  font-size: 1.08rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.ligne-etat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
  margin: 6px 0 16px;
}

.etat {
  margin: 0;
  color: var(--texte-doux);
}

.tourbillon {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border: 3px solid var(--bord);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tourner 0.9s linear infinite;
}

@keyframes tourner {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tourbillon {
    animation-duration: 2.5s;
  }
}

/* Indicateur de recherche : un boucher à moto, un cochon en passager.
   Dessin intégré à la page, animé ici : roues qui tournent, léger rebond, traits de vitesse. */
.moto {
  display: inline-block;
  flex: none;
  width: 56px;
  height: 35px;
  color: var(--texte);
}

.moto svg {
  display: block;
  overflow: visible;
}

.moto-roue circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

.moto-roue line {
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.7;
}

.moto-roue {
  transform-box: fill-box;
  transform-origin: center;
  animation: tourner 0.6s linear infinite;
}

.moto-corps {
  animation: rebondir 0.36s ease-in-out infinite alternate;
}

.moto-rouge {
  fill: none;
  stroke: #d62828;
  stroke-width: 2.6;
  stroke-linejoin: round;
}

.moto-carrosserie {
  fill: #d62828;
}

.moto-fourche,
.moto-pot {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  fill: #8a8f8c;
}

.cochon {
  fill: #f4a6b8;
}

.cochon-groin {
  fill: #e07a93;
}

.cochon-queue {
  fill: none;
  stroke: #e07a93;
  stroke-width: 1.2;
  stroke-linecap: round;
}

.moto-oeil {
  fill: #222;
}

.boucher-tablier {
  fill: #ffffff;
  stroke: #9aa3a0;
  stroke-width: 0.7;
}

.boucher-rayure {
  stroke: #d62828;
  stroke-width: 1;
}

.boucher-chapeau {
  fill: #ffffff;
  stroke: #9aa3a0;
  stroke-width: 0.7;
}

.boucher-peau {
  fill: #f1c27d;
}

.boucher-bras {
  stroke: #f1c27d;
  stroke-width: 2;
  stroke-linecap: round;
}

.boucher-jambe {
  fill: none;
  stroke: #2f3e55;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.moto-vitesse line {
  stroke: var(--texte-doux);
  stroke-width: 1.4;
  stroke-linecap: round;
  animation: vitesse 0.5s linear infinite;
}

.moto-vitesse line:nth-child(2) {
  animation-delay: 0.17s;
}

.moto-vitesse line:nth-child(3) {
  animation-delay: 0.33s;
}

@keyframes rebondir {
  to {
    transform: translateY(-1px);
  }
}

@keyframes vitesse {
  from {
    opacity: 0.9;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .moto-roue {
    animation-duration: 2s;
  }

  .moto-corps,
  .moto-vitesse line {
    animation: none;
  }
}

.etapes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.etapes:empty {
  display: none;
}

.etapes li {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--bord);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.etape-heure {
  flex: none;
  padding-top: 2px;
  color: var(--texte-doux);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ résultat */

.contenu-resultat {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--bord);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--ombre);
  overflow-wrap: anywhere;
}

.contenu-resultat:empty {
  display: none;
}

.contenu-resultat p {
  margin: 0 0 12px;
}

.contenu-resultat p:last-child {
  margin-bottom: 0;
}

.contenu-resultat ol {
  margin: 0 0 12px;
  padding-left: 1.4em;
}

.contenu-resultat ol:last-child {
  margin-bottom: 0;
}

.contenu-resultat li {
  margin-bottom: 10px;
}

.contenu-resultat li:last-child {
  margin-bottom: 0;
}

.contenu-resultat strong {
  font-weight: 700;
}

.contenu-resultat a {
  color: var(--accent);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.resultat-message {
  color: var(--texte-doux);
  font-weight: 600;
}

.meta-resultat {
  margin: 12px 4px 16px;
  color: var(--texte-doux);
  font-size: 0.9rem;
}

.meta-resultat:empty {
  display: none;
}

/* ---------------------------------------------------------------- historique */

.liste-historique {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.element-historique {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--bord);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--ombre);
  color: inherit;
  text-decoration: none;
}

.element-historique:hover {
  border-color: var(--accent);
}

.element-demande {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.element-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--texte-doux);
  font-size: 0.86rem;
}

.element-nom {
  color: var(--texte);
  font-weight: 600;
}

.badge {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-douce);
  color: var(--texte-doux);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-terminee,
.badge-en-attente,
.badge-en-cours {
  color: var(--accent);
}

.badge-erreur {
  color: var(--erreur);
}

/* ------------------------------------------------------- page hors connexion */

.hors-ligne {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: calc(100vh - 56px);
  text-align: center;
}

.hors-ligne h1 {
  color: var(--accent);
}

.hors-ligne p {
  max-width: 30ch;
  color: var(--texte-doux);
}
