/* ==========================================================================
   ÉCRANS D'AUTHENTIFICATION (connexion, appairage 2FA, code 2FA)
   Maquette Figma : formulaire à gauche, panneau bleu marine arrondi à droite.
   ========================================================================== */

:root {
  --evo-marine: #001470;
  --evo-bleu: #5980ff;
  --evo-champ: #f2f5fc;
  --evo-bordure: #e3e8f4;
  --evo-texte: #001470;
  --evo-texte-doux: #8a95bf;
  --evo-orange: #e2462b;
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body.evo-auth {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  color: var(--evo-texte);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

#execution {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 20, 112, 0.45);
}

#execution img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 90px;
  transform: translate(-50%, -50%);
}

/* --------------------------------------------------------------------------
   Structure
   -------------------------------------------------------------------------- */

.evo-auth__ecran {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.evo-auth__formulaire {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

.evo-auth__marque {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 48px 32px;
  background: var(--evo-marine);
  border-bottom-left-radius: 160px;
  color: #fff;
  transition: border-radius 0.3s ease;
}

.evo-auth__logo .evo-logo {
  width: 280px;
  height: auto;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
}

.evo-auth__partenaire {
  max-width: 140px;
  padding: 8px 14px;
  background: #fff;
  border-radius: 12px;
}

.evo-auth__pied {
  position: fixed;
  left: 24px;
  bottom: 14px;
  font-size: 11px;
  color: var(--evo-texte-doux);
}

/* --------------------------------------------------------------------------
   Formulaire de connexion
   -------------------------------------------------------------------------- */

.evo-auth__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 320px;
}

.evo-champ {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  font-weight: 400;
}

.evo-champ__libelle {
  font-size: 12px;
  color: var(--evo-texte);
}

.evo-champ__ligne {
  position: relative;
  display: flex;
  align-items: center;
}

.evo-champ__saisie {
  width: 100%;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--evo-bordure);
  border-radius: 999px;
  background: var(--evo-champ);
  color: var(--evo-texte);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.evo-champ__saisie:focus {
  border-color: var(--evo-bleu);
  box-shadow: 0 0 0 3px rgba(89, 128, 255, 0.18);
}

.evo-champ__oeil {
  position: absolute;
  right: -34px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--evo-bleu);
  cursor: pointer;
}

.evo-champ__oeil:hover,
.evo-champ__oeil:focus-visible {
  background: var(--evo-champ);
}

.evo-auth__bouton {
  width: 100%;
  height: 44px;
  margin-top: 18px;
  border: none;
  border-radius: 999px;
  background: var(--evo-bleu);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.evo-auth__bouton:hover,
.evo-auth__bouton:focus-visible {
  background: #4669e8;
}

.evo-auth__erreur {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fdece8;
  color: var(--evo-orange);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Écrans double authentification : le panneau bleu couvre tout l'écran,
   le logo reste à gauche et le contenu passe à droite (maquette).
   ========================================================================== */

.evo-auth--2fa .evo-auth__formulaire {
  display: none;
}

.evo-auth--2fa .evo-auth__marque {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  border-bottom-left-radius: 160px;
}

.evo-auth--2fa .evo-auth__logo {
  grid-column: 1;
  grid-row: 1 / span 2;
  justify-self: center;
  align-self: center;
}

.evo-auth--2fa .evo-auth__partenaire {
  grid-column: 1;
  justify-self: center;
}

.evo-auth__2fa {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  max-width: 560px;
  justify-self: center;
  text-align: center;
}

.evo-auth__titre {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.35;
}

.evo-auth__aide {
  margin: 0;
  font-size: 14px;
  color: var(--evo-bleu);
}

.evo-auth__texte {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.evo-auth__qr {
  padding: 14px;
  border-radius: 24px;
  background: #fff;
}

.evo-auth__qr img {
  display: block;
  width: 150px;
  height: 150px;
}

.evo-auth__stores {
  display: flex;
  gap: 48px;
}

/* Les visuels des stores sont carrés avec de grandes marges : on recadre au centre */
.evo-auth__stores img {
  width: 170px;
  height: 56px;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.evo-auth__stores a:hover img,
.evo-auth__stores a:focus-visible img {
  transform: scale(1.04);
}

.evo-auth__2fa form {
  width: 100%;
  max-width: 280px;
}

/* Cases du code à usage unique */
#otp-form {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.otp-input {
  width: 46px;
  height: 52px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--evo-champ);
  color: var(--evo-texte);
  font: inherit;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  outline: none;
}

.otp-input:focus {
  border-color: var(--evo-bleu);
}

.otp-input.filled {
  background: #fff;
}

.evo-auth--2fa .evo-auth__erreur {
  width: 100%;
  max-width: 360px;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Écrans étroits
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .evo-auth__ecran,
  .evo-auth--2fa .evo-auth__marque {
    grid-template-columns: 1fr;
  }

  .evo-auth__marque {
    grid-row: 1;
    min-height: 220px;
    border-bottom-left-radius: 64px;
  }

  .evo-auth__logo .evo-logo {
    width: 200px;
  }

  .evo-auth--2fa .evo-auth__2fa,
  .evo-auth--2fa .evo-auth__partenaire {
    grid-column: 1;
    grid-row: auto;
  }

  .evo-auth__pied {
    position: static;
    padding: 16px 24px;
  }
}

/* --------------------------------------------------------------------------
   Transitions entre étapes (maquette Figma, voir js/connexion/evo-transition.js)
   L'état de départ est posé par html[data-evo-depuis] avant le premier affichage,
   puis html.evo-auth-anime fait jouer les transitions vers l'état normal.
   -------------------------------------------------------------------------- */

.evo-auth--2fa .evo-auth__marque {
  clip-path: inset(0 0 0 0 round 0 0 0 160px);
}

/* Depuis la connexion : le panneau ne couvre que la moitié droite et le logo y est centré */
html[data-evo-depuis="connexion"] .evo-auth--2fa .evo-auth__marque {
  clip-path: inset(0 0 0 50% round 0 0 0 160px);
}

html[data-evo-depuis="connexion"] .evo-auth--2fa .evo-auth__logo {
  transform: translateX(50vw);
}

html[data-evo-depuis] .evo-auth--2fa .evo-auth__2fa {
  opacity: 0;
  transform: translateY(14px);
}

/* Panneau et logo partagent la même courbe (léger dépassement en fin de course, comme le
   ressort du prototype) : le logo reste ainsi toujours à l'intérieur du panneau qui s'étend */
html.evo-auth-anime .evo-auth--2fa .evo-auth__marque {
  transition: clip-path 0.7s cubic-bezier(0.6, 0, 0.25, 1.15);
}

html.evo-auth-anime .evo-auth--2fa .evo-auth__logo {
  transition: transform 0.7s cubic-bezier(0.6, 0, 0.25, 1.15);
}

html.evo-auth-anime .evo-auth--2fa .evo-auth__2fa {
  transition: opacity 0.45s ease 0.2s, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}

html[data-evo-depuis="appairage"] .evo-auth--2fa .evo-auth__2fa {
  transform: translateX(24px);
}

html.evo-auth-sortie .evo-auth--2fa .evo-auth__2fa,
html.evo-auth-sortie .evo-auth--2fa .evo-auth__logo {
  opacity: 0;
  transition: opacity 0.25s ease;
}
