/*
 * IMMGO — Écrans : mise en page commune (barre d'outils des listes, fiche d'informations, assistant de page,
 * notes, compléments des écrans d'authentification)
 * Auteur : Jacks Ngalangala
 */

/* ─── Listes : barre d'outils et résultats ─── */
.outils {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--e-3) var(--e-4);
}
.outils-recherche {
  flex: 1 1 280px;
  max-width: 420px;
}
.outils .onglets {
  flex: none;
}
.outils .puces {
  flex: 1 1 auto;
  min-width: 0;
}
.resultats {
  display: flex;
  flex-direction: column;
  gap: var(--e-4);
}
.resultats-compte {
  font-size: var(--taille-petit);
  color: var(--texte-second);
}
.resultats-plus {
  display: flex;
  justify-content: center;
}
.resultats-erreur {
  text-align: center;
}

/* ─── Fiche : grille de cartes et lignes d'informations ─── */
.fiche-grille {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--e-6);
  align-items: start;
}
.fiche-colonne {
  display: flex;
  flex-direction: column;
  gap: var(--e-6);
  min-width: 0;
}
.fiche-infos {
  display: flex;
  flex-direction: column;
}
.fiche-ligne {
  display: grid;
  grid-template-columns: minmax(120px, 38%) minmax(0, 1fr) 36px;
  align-items: center;
  gap: var(--e-3);
  min-height: 52px;
  padding: var(--e-2) 0;
  border-bottom: 1px solid var(--trait);
}
.fiche-ligne:last-child {
  border-bottom: 0;
}
.fiche-ligne dt {
  font-size: var(--taille-petit);
  color: var(--texte-second);
}
.fiche-ligne dd {
  margin: 0;
  font-weight: var(--graisse-moyenne);
  overflow-wrap: anywhere;
}
.fiche-ligne dd.fiche-vide {
  color: var(--texte-faible);
  font-weight: var(--graisse-normale);
}
.fiche-entete {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--e-3);
}
.fiche-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--r-moyen);
  background: var(--surface-douce);
}

/* ─── Assistant en pleine page et en fenêtre ─── */
.page-assistant {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--e-8);
}
.modale-assistant {
  width: min(600px, calc(100vw - 32px));
}
.modale-assistant .assistant {
  gap: var(--e-6);
}
/* Sur téléphone, l'assistant reste une feuille bord à bord, comme toute fenêtre (charte-fenetres.css) */
@media (max-width: 599px) {
  .modale-assistant {
    width: 100vw;
  }
}

/* ─── Note d'information (règle métier dite à l'écran) ─── */
.note {
  display: flex;
  align-items: flex-start;
  gap: var(--e-3);
  padding: var(--e-3) var(--e-4);
  border-radius: var(--r-moyen);
  font-size: var(--taille-petit);
  background: var(--info-pale);
  color: var(--texte);
}
.note svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--info);
}
.note-attention {
  background: var(--attention-pale);
}
.note-attention svg {
  color: var(--attention);
}

/* ─── Lien qui agit comme un bouton (authentification) ─── */
.lien-bouton {
  padding: 0;
  border: 0;
  background: none;
  color: var(--or-texte);
  font: inherit;
  font-size: var(--taille-petit);
  cursor: pointer;
}
.lien-bouton:hover {
  text-decoration: underline;
}

/* ─── Authentification : œil du mot de passe, progression, icône de message ─── */
.champ-oeil {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-right: calc(var(--e-2) * -1);
  border: 0;
  border-radius: var(--r-petit);
  background: none;
  color: var(--texte-second);
  cursor: pointer;
}
.champ-oeil[aria-pressed='true'] {
  color: var(--or);
}
.champ-oeil svg {
  width: 20px;
  height: 20px;
}
.auth-progression {
  margin-bottom: calc(var(--e-4) * -1);
}
.auth-icone {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-grand);
  background: rgba(187, 164, 96, 0.14);
  color: var(--or);
}
.auth-icone svg {
  width: 28px;
  height: 28px;
}
.auth .interrupteur {
  padding: var(--e-2) 0 0;
}

/* ─── Petites pièces de page ─── */
.compteur-section {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--e-3);
}
.ligne-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--e-3);
  flex-wrap: wrap;
}

@media (max-width: 1023px) {
  .fiche-grille {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 599px) {
  .outils-recherche {
    max-width: none;
    flex-basis: 100%;
  }
  .fiche-ligne {
    grid-template-columns: minmax(0, 1fr) 36px;
    row-gap: 2px;
  }
  .fiche-ligne dt {
    grid-column: 1;
  }
  .fiche-ligne dd {
    grid-column: 1;
    grid-row: 2;
  }
  .fiche-ligne > :last-child {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .page-assistant {
    gap: var(--e-6);
  }
}

/* ─── Notes libres (clients) : retours à la ligne conservés ─── */
.cl-notes {
  white-space: pre-line;
}

/* ─── Profil : en-tête de la carte d'identité ─── */
.pr-tete {
  display: flex;
  align-items: center;
  gap: var(--e-4);
  padding-bottom: var(--e-4);
}
.pr-tete .avatar {
  width: 56px;
  height: 56px;
  font-size: var(--taille-grand);
}

/* ─── Téléphone : indicateurs deux par deux pour garder le contenu visible sans défiler longtemps ─── */
@media (max-width: 599px) {
  .contenu .tuiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--e-3);
  }
  .contenu .tuile {
    padding: var(--e-4);
  }
  .contenu .tuile-detail {
    font-size: var(--taille-legende);
  }
  .contenu .tuile-valeur {
    font-size: var(--taille-titre-2);
  }
  /* La valeur garde sa largeur (jusqu'à la moitié de la ligne) : le titre passe à la ligne avant elle. Une valeur
     plus longue (plusieurs monnaies) ne se coupe qu'entre deux montants, jamais au milieu (espaces insécables). */
  .contenu .ligne-texte {
    flex: 1 1 50%;
  }
  .contenu .ligne-fin {
    flex: 0 0 auto;
    max-width: 50%;
  }
  .contenu .ligne-valeur {
    white-space: normal;
  }
}

/* ─── Cases du code reçu : elles se partagent la largeur, sans jamais déborder ─── */
.code-cases {
  min-width: 0;
}
.code-case {
  width: 100%;
  min-width: 0;
  padding: 0;
  text-align: center;
}

/* Code reçu saisi hors des écrans d'entrée (fenêtre claire) : cases claires */
.modale .code-case {
  border-color: var(--trait-fort);
  background: var(--surface);
  color: var(--texte);
}

/* ─── Texte secondaire lisible sur une carte sombre (accueil des clients) ─── */
.carte-sombre .texte-second,
.carte-sombre .surtitre {
  color: var(--nuit-texte-second);
}
