/* ==========================================================
   Gestion SAF · page de connexion et de création de compte (AML_V_104)
   S'ajoute à saf-ui.css (charte, champs, boutons, case à cocher, segmenté).
   Page sans Bootstrap : les règles de base nécessaires sont reprises ici.
   Panneau de gauche en teal profond, textes de l'accueil tirés de t_texteaccueil.
   Préfixe : saf-auth-.
   ========================================================== */

/* ---------- Base ---------- */
.saf-auth,
.saf-auth *,
.saf-auth *::before,
.saf-auth *::after {
  box-sizing: border-box;
}

.saf-auth [hidden] {
  display: none !important;
}

.saf-auth h1,
.saf-auth h2,
.saf-auth h3,
.saf-auth h4,
.saf-auth h5,
.saf-auth p,
.saf-auth ul {
  margin: 0;
}

.saf-auth button {
  font: inherit;
}

.saf-auth {
  display: grid;
  grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
  min-height: 100vh;
  font-size: var(--saf-fs-base);
  line-height: 1.4;
}

/* ---------- Présentation du programme ---------- */
.saf-auth-side {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 32px 48px 28px;
  background: linear-gradient(160deg, #1d6f71 0%, #134f51 55%, #0f4244 100%);
  color: #eaf6f6;
}

.saf-auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.saf-auth-brand img {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
}

.saf-auth-brand-sep {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, .3);
}

.saf-auth-brand-txt {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.saf-auth-brand-txt strong {
  font-size: 14px;
  font-weight: 650;
  color: #fff;
}

.saf-auth-brand-txt small {
  font-size: 12px;
  color: rgba(234, 246, 246, .7);
}

.saf-auth-intro {
  max-width: 560px;
  margin: auto 0;
}

.saf-auth-intro h1 {
  font-size: clamp(30px, 3.2vw, 44px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.03em;
  color: #fff;
}

.saf-auth-intro h1 em {
  display: block;
  font-style: normal;
}

/* Textes de l'accueil (HTML de t_texteaccueil) : mise en page de texte simple, styles en ligne neutralisés */
.saf-auth-textes > * {
  margin-top: 20px !important;
  padding: 0 !important;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(234, 246, 246, .9);
}

.saf-auth-textes b,
.saf-auth-textes strong {
  font-weight: 650;
  color: #fff;
}

.saf-auth-textes .divTextImportant h2 {
  margin-top: 32px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.01em;
  color: #fff;
}

.saf-auth-textes ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-left: 20px;
  font-size: 15px;
}

.saf-auth-textes a {
  color: #fff;
}

.saf-auth-foot {
  font-size: 12px;
  color: rgba(234, 246, 246, .6);
}

.saf-auth-foot a {
  color: rgba(234, 246, 246, .85);
}

/* ---------- Formulaires ---------- */
.saf-auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 32px 28px;
  background: radial-gradient(90% 60% at 100% 0%, var(--saf-accent-soft), transparent 60%), var(--saf-bg);
}

.saf-auth-top {
  align-self: stretch;
  display: flex;
  justify-content: flex-end;
}

.saf-auth-card {
  width: min(460px, 100%);
  margin: auto 0;
  padding-top: 8px;
}

.saf-auth-card.saf-auth-shake {
  animation: saf-auth-shake .38s;
}

@keyframes saf-auth-shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.saf-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 26px;
  padding: 4px;
  border: 1px solid var(--saf-line);
  border-radius: 12px;
  background: var(--saf-side);
}

.saf-auth-tabs button {
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--saf-muted);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}

.saf-auth-tabs button[aria-selected="true"] {
  background: var(--saf-bg);
  color: var(--saf-text);
  box-shadow: 0 1px 3px rgba(44, 43, 40, .12);
}

.saf-auth-tabs button:focus {
  outline: none;
}

.saf-auth-tabs button:focus-visible {
  box-shadow: 0 0 0 3px var(--saf-accent-ring);
}

.saf-auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: saf-auth-in .3s cubic-bezier(.2, .8, .2, 1);
}

@keyframes saf-auth-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.saf-auth-form h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--saf-text);
}

.saf-auth-sub {
  margin-top: -6px !important;
  font-size: 14px;
  line-height: 1.5;
  color: var(--saf-muted);
}

.saf-auth-sub strong {
  color: var(--saf-text);
}

.saf-auth-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px 10px;
}

.saf-auth-c4 { grid-column: span 4; }
.saf-auth-c6 { grid-column: span 6; }
.saf-auth-c8 { grid-column: span 8; }
.saf-auth-c12 { grid-column: span 12; }

.saf-auth-form .saf-field input {
  height: 42px;
  border-radius: 10px;
  font-size: 14.5px;
}

.saf-auth-lab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Mot de passe : bouton « afficher » dans le champ */
.saf-auth-pwd {
  position: relative;
  display: flex;
}

.saf-auth-pwd input {
  padding-right: 44px !important;
}

.saf-auth-pwd input::-ms-reveal,
.saf-auth-pwd input::-ms-clear {
  display: none;
}

.saf-auth-eye {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--saf-muted);
  transform: translateY(-50%);
  cursor: pointer;
}

.saf-auth-eye:hover {
  background: var(--saf-neutral-bg);
  color: var(--saf-text);
}

.saf-auth-eye i {
  font-size: 17px;
}

.saf-auth-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--saf-accent-hover);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.saf-auth-link:hover {
  text-decoration: underline;
}

.saf-auth-submit {
  justify-content: center;
  height: 44px;
  margin-top: 4px;
  border-radius: 10px;
  font-size: 14.5px;
}

.saf-auth-submit i {
  transition: transform .15s;
}

.saf-auth-submit:hover i {
  transform: translateX(3px);
}

.saf-auth-switch {
  font-size: 13px;
  text-align: center;
  color: var(--saf-muted);
}

.saf-auth-switch .saf-auth-link {
  font-size: 13px;
}

/* Message en tête de formulaire : erreur ou succès, avec une action éventuelle */
.saf-auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--saf-neg-bg);
  color: var(--saf-neg);
  font-size: 13px;
  font-weight: 500;
}

.saf-auth-alert i {
  margin-top: 1px;
  font-size: 16px;
}

.saf-auth-alert.ok {
  background: var(--saf-pos-bg);
  color: var(--saf-pos);
}

.saf-auth-alert .saf-auth-link {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: inherit;
  text-decoration: underline;
}

/* Règles du mot de passe, cochées au fil de la saisie */
.saf-auth-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--saf-muted);
}

.saf-auth-rules li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color .15s;
}

.saf-auth-rules li i {
  font-size: 13px;
}

.saf-auth-rules li.ok {
  color: var(--saf-pos);
}

.saf-auth-rules.is-err li:not(.ok) {
  color: var(--saf-neg);
}

.saf-auth-ck {
  font-size: 13px;
  line-height: 1.5;
  color: var(--saf-text);
}

.saf-auth-ck a {
  color: var(--saf-accent-hover);
  font-weight: 600;
}

.saf-auth-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--saf-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.saf-auth-back:hover {
  color: var(--saf-text);
}

.saf-auth-done {
  align-items: center;
  text-align: center;
}

.saf-auth-done-ic {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--saf-accent-soft);
  color: var(--saf-accent-hover);
}

.saf-auth-done-ic i {
  font-size: 30px;
}

.saf-auth-done .saf-auth-sub {
  margin-top: 0 !important;
}

.saf-auth-done .saf-auth-submit {
  align-self: stretch;
}

.saf-auth-mail {
  font-weight: 600;
  color: var(--saf-text);
  word-break: break-all;
}

/* ---------- Petits écrans ---------- */
@media (prefers-reduced-motion: reduce) {
  .saf-auth-form,
  .saf-auth-card.saf-auth-shake {
    animation: none;
  }
}

@media (max-width: 1000px) {
  .saf-auth {
    grid-template-columns: 1fr;
  }

  .saf-auth-side {
    gap: 20px;
    padding: 24px 22px;
  }

  .saf-auth-intro {
    margin: 12px 0;
  }

  /* Formulaire d'abord : sur un téléphone, on vient pour se connecter */
  .saf-auth-main {
    order: -1;
    padding: 20px 16px 28px;
  }
}

@media (max-width: 480px) {
  .saf-auth-c4,
  .saf-auth-c6,
  .saf-auth-c8 {
    grid-column: span 12;
  }
}
