/* =====================================================================
   modules/auth.css — Module Authentification, côté front
   ---------------------------------------------------------------------
   Chargé par les seules pages du module : connexion, création de compte,
   mot de passe oublié, réinitialisation, espace « Mon compte ».

   Ne contient que ce qui est propre à ces écrans : les cartes, badges,
   formulaires et tableaux viennent de theme.css.
   ===================================================================== */

/* --- Mise en page centrée des écrans d'accès ------------------------- */
.auth-page {
  display: flex;
  justify-content: center;
  padding-block: 1rem 2rem;
}

@media (min-width: 768px) {
  .auth-page { padding-block: 2.5rem 3.5rem; }
}

.auth-card {
  width: 100%;
  max-width: 27rem;
  background: var(--irp-surface);
  border: 1px solid var(--irp-border-soft);
  border-radius: var(--irp-radius-lg);
  box-shadow: var(--irp-shadow);
  padding: 1.5rem;
}

@media (min-width: 576px) {
  .auth-card { padding: 2rem; }
}

/* Formulaire de création de compte : plus large, sur deux colonnes. */
.auth-card--large { max-width: 44rem; }

.auth-card__head { margin-bottom: 1.25rem; }

.auth-card__title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--irp-heading);
  margin: 0 0 .35rem;
}

.auth-card__subtitle {
  font-size: .88rem;
  color: var(--irp-text-muted);
  margin: 0;
}

.auth-card__foot {
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--irp-border-soft);
  font-size: .86rem;
  color: var(--irp-text-muted);
  text-align: center;
}

/* --- Pastille d'état (succès, erreur) -------------------------------- */
.auth-card__icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  font-size: 1.5rem;
}

.auth-card__icon--succes {
  background: var(--irp-valide-bg);
  color: var(--irp-valide-text);
}

.auth-card__icon--erreur {
  background: var(--irp-rejete-bg);
  color: var(--irp-rejete-text);
}

/* --- Jauge de robustesse du mot de passe ----------------------------- */
/* Indicative seulement : la règle qui fait foi est appliquée côté serveur
   par App\Modules\Auth\Service\PasswordPolicy. */
.auth-strength {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .45rem;
}

.auth-strength__bar {
  flex: 1;
  height: 4px;
  border-radius: var(--irp-radius-pill);
  background: var(--irp-surface-3);
  overflow: hidden;
}

.auth-strength__bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--irp-rejete);
  transition: width var(--irp-transition), background-color var(--irp-transition);
}

.auth-strength__label {
  font-size: .74rem;
  font-weight: 600;
  color: var(--irp-text-muted);
  white-space: nowrap;
  min-width: 5.5rem;
  text-align: right;
}

.auth-strength[data-niveau='1'] .auth-strength__bar > span { width: 25%; background: var(--irp-rejete); }
.auth-strength[data-niveau='2'] .auth-strength__bar > span { width: 50%; background: var(--irp-retard); }
.auth-strength[data-niveau='3'] .auth-strength__bar > span { width: 75%; background: var(--irp-attente); }
.auth-strength[data-niveau='4'] .auth-strength__bar > span { width: 100%; background: var(--irp-valide); }

.auth-strength[data-niveau='1'] .auth-strength__label { color: var(--irp-rejete-text); }
.auth-strength[data-niveau='2'] .auth-strength__label { color: var(--irp-retard-text); }
.auth-strength[data-niveau='3'] .auth-strength__label { color: var(--irp-attente-text); }
.auth-strength[data-niveau='4'] .auth-strength__label { color: var(--irp-valide-text); }

/* --- Espace « Mon compte » -------------------------------------------- */
.compte-entete {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Aperçu de l'avatar dans le formulaire de profil. */
.auth-avatar-apercu {
  width: 6rem;
  height: 6rem;
  font-size: 1.6rem;
}

.auth-avatar-apercu img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Champ IBAN ------------------------------------------------------- */
/* Le retour de validation immédiate est purement indicatif : la clé de
   contrôle est revérifiée côté serveur à l'enregistrement. */
.auth-iban--valide { border-color: var(--irp-valide) !important; }
.auth-iban--invalide { border-color: var(--irp-rejete) !important; }

.auth-iban-message--valide { color: var(--irp-valide-text); }
.auth-iban-message--invalide { color: var(--irp-rejete-text); }

/* --- Pages légales ---------------------------------------------------- */
/* Accessibles sans connexion : leur mise en page reste volontairement
   sobre et lisible, sur une largeur de lecture confortable. */
.page-legale { max-width: 48rem; }

.page-legale__contenu {
  font-size: .92rem;
  line-height: 1.65;
  color: var(--irp-text);
}

.page-legale__contenu strong { color: var(--irp-heading); }

/* =====================================================================
   CARTE CSE
   ---------------------------------------------------------------------
   La carte que le salarié présente chez un partenaire, depuis son
   téléphone. Elle reprend le dessin de la carte que le CSE distribuait :
   le fond bleu en dégradé, le filet cyan, le numéro à la verticale dans
   son onglet clair.

   LA PROPORTION EST CELLE D'UNE VRAIE CARTE (1,586 — 85,6 × 54 mm). Ce
   n'est pas un détail de style : c'est ce qui la fait reconnaître pour ce
   qu'elle est en un coup d'œil, au comptoir, par quelqu'un qui en voit
   vingt par jour.

   Aucune des valeurs affichées n'est ici : nom, numéro et date viennent
   du contrôleur. Les couleurs ne sont pas celles du thème — une carte ne
   bascule pas en thème sombre, elle garde son bleu dans les deux cas,
   comme une carte imprimée.
   ===================================================================== */

.carte-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.carte-page__pied {
  font-size: 0.85rem;
}

.carte-cse {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 26rem;
  /* Proportion d'une carte bancaire : 85,6 × 54 mm. */
  aspect-ratio: 1.586;
  padding: 1.35rem 1.45rem;
  border-radius: 1.1rem;
  overflow: hidden;
  text-align: left;
  color: #fff;
  background:
    radial-gradient(120% 140% at 88% 8%, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg, #1b5fb5 0%, #15418a 55%, #10336d 100%);
  box-shadow: 0 18px 40px -18px rgba(16, 51, 109, 0.75);
  /* Chiffres de même largeur : le numéro et la date ne dansent pas d'une
     carte à l'autre. */
  font-feature-settings: "tnum";
}

.carte-cse__entete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.carte-cse__cse {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.carte-cse__filet {
  width: 3.2rem;
  height: 0.25rem;
  margin: 0.5rem 0 1rem;
  border-radius: 0.125rem;
  background: #45c4f0;
}

.carte-cse__logo {
  flex: 0 0 auto;
  width: 6.2rem;
  height: auto;
}

.carte-cse__nom {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  /* Le numéro occupe la droite de la carte : le nom s'arrête avant. */
  padding-right: 2.2rem;
  overflow-wrap: anywhere;
}

.carte-cse__prenom {
  font-weight: 500;
}

/* Ce que la carte atteste : c'est un contenu éditable, donc il peut
   arriver enveloppé dans un paragraphe — ses marges sont annulées, la
   carte n'en a pas la place. Deux lignes, et au-delà on coupe : une
   mention trop longue déborderait sur la date. */
.carte-cse__mention {
  margin-top: 0.5rem;
  padding-right: 2.2rem;
  font-size: 0.74rem;
  font-style: italic;
  line-height: 1.45;
  opacity: 0.9;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.carte-cse__mention p {
  margin: 0;
}

.carte-cse__validite {
  margin: auto 0 0;
  padding-right: 2.2rem;
  text-align: right;
  font-size: 0.76rem;
  font-weight: 600;
}

/* Le numéro, à la verticale dans son onglet clair, comme sur la carte
   d'origine. Il ne sert qu'à reconnaître la carte : il n'ouvre aucun
   droit et ne se vérifie nulle part. */
.carte-cse__numero {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  margin: 0;
  padding: 0.5rem 0.28rem;
  border-radius: 0.45rem 0 0 0.45rem;
  background: rgba(255, 255, 255, 0.92);
  color: #15418a;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
}

@media (min-width: 576px) {
  .carte-cse {
    max-width: 27rem;
    padding: 1.5rem 1.6rem;
  }

  .carte-cse__cse { font-size: 1.5rem; }
  .carte-cse__nom { font-size: 1.35rem; }
}

/* =====================================================================
   INSTALLER SUR MON TÉLÉPHONE (/installer)
   Deux marches à suivre côte à côte sur un écran large, l'une sous l'autre
   sur un téléphone. auth.js ne garde que celle de l'appareil ; sans lui,
   les deux restent, et chacun lit la sienne.
   ===================================================================== */

.installer__head {
  margin-bottom: 1.25rem;
}

.installer__choix {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
  .installer__choix {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.installer__mode-titre {
  display: flex;
  align-items: center;
  margin-bottom: 0.9rem;
}

.installer__etapes {
  margin: 0;
  padding-left: 1.2rem;
}

.installer__etapes li + li {
  margin-top: 0.5rem;
}

.installer__bouton {
  margin-bottom: 0.25rem;
}

.installer__note {
  margin-top: 1.25rem;
}

.installer__ok {
  color: var(--bs-success);
}

/* Le message « déjà installée » ne se montre que DANS l'application :
   `display-mode: standalone` (Android, iPhone récent) ou la classe posée par
   app.js (iPhone plus ancien, qui ne connaît que navigator.standalone). */
.installer__deja {
  display: none;
  margin-bottom: 1rem;
}

@media (display-mode: standalone) {
  .installer__deja { display: block; }
  .installer__choix,
  .installer__note { display: none; }
}

.irp-appli .installer__deja { display: block; }
.irp-appli .installer__choix,
.irp-appli .installer__note { display: none; }
