/* ATAVITI · Auth styles — Direction 3 (Vert immersif)
   Charge tokens.css en amont. Markup attendu : voir Views/ATAVITI/Test/*.cshtml. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.at-auth {
  font-family: var(--at-font-text);
  color: var(--at-blanc);
  background: var(--at-vert);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}
body.at-auth::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%,   rgba(47,125,107,.35) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(20,56,56,.5)    0%, transparent 50%);
}

/* === Losanges flottants en arrière-plan (motif brandbook) === */
.at-floaters { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.at-lozenge {
  position: absolute; background: var(--at-jaune);
  width: 80px; height: 180px; border-radius: 6px;
  opacity: .04;
  animation: at-drift 18s ease-in-out infinite;
  will-change: transform;
}
.at-lozenge.l1 { top: 12%; left: 6%;  transform: rotate(18deg);  animation-delay: 0s; }
.at-lozenge.l2 { top: 70%; left: 14%; transform: rotate(-22deg); animation-delay: 3s; opacity: .03; width: 60px; height: 140px; }
.at-lozenge.l3 { top: 22%; right: 8%; transform: rotate(38deg);  animation-delay: 6s; opacity: .035; width: 70px; height: 160px; }
.at-lozenge.l4 { top: 78%; right: 6%; transform: rotate(-12deg); animation-delay: 9s; opacity: .03; }
.at-lozenge.l5 { top: 45%; right: 38%; transform: rotate(8deg);  animation-delay: 12s; opacity: .025; width: 50px; height: 110px; }
@keyframes at-drift {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 18deg)); }
  50%      { transform: translateY(-26px) rotate(calc(var(--rot, 18deg) + 4deg)); }
}

/* === Layout === */
.at-page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: var(--at-space-6) var(--at-space-5);
}
.at-topbar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1200px; width: 100%; margin: 0 auto;
  animation: at-rise .5s var(--at-motion) both;
}
.at-brand { display: flex; align-items: center; gap: var(--at-space-3); text-decoration: none; color: inherit; }
.at-emblem { width: 32px; height: 32px; color: var(--at-blanc); flex-shrink: 0; }
.at-brand-name { font-family: var(--at-font-display); font-size: var(--at-text-xl); color: var(--at-blanc); line-height: 1; }

.at-lang { display: flex; gap: 4px; background: rgba(255,255,255,.08); padding: 4px; border-radius: var(--at-radius-full); font-size: var(--at-text-xs); }
.at-lang button {
  background: none; border: none; color: rgba(255,255,255,.6);
  padding: 4px 10px; border-radius: var(--at-radius-full); cursor: pointer; font-family: inherit;
  transition: background var(--at-motion), color var(--at-motion);
}
.at-lang button[aria-pressed="true"] { background: var(--at-blanc); color: var(--at-vert); font-weight: 600; }
.at-lang button:hover:not([aria-pressed="true"]) { color: var(--at-blanc); }

/* === Hero === */
.at-hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--at-space-7) 0; max-width: 520px; margin: 0 auto; width: 100%;
}
.at-hero--wide { max-width: 560px; }
.at-compass-hero {
  width: 96px; height: 96px; color: var(--at-blanc);
  margin-bottom: var(--at-space-6);
  animation: at-gentle 12s ease-in-out infinite, at-fade-in .8s var(--at-motion) both;
  filter: drop-shadow(0 0 30px rgba(252,245,166,.18));
  transition: transform var(--at-motion-slow);
}
.at-compass-hero--success { animation: at-pulse-success 1.6s ease-out 1, at-gentle 12s ease-in-out 1.6s infinite; }
@keyframes at-gentle { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(8deg); } }
@keyframes at-pulse-success {
  0%   { transform: scale(1) rotate(0deg);   filter: drop-shadow(0 0 0 rgba(252,245,166,0)); }
  40%  { transform: scale(1.12) rotate(45deg); filter: drop-shadow(0 0 40px rgba(252,245,166,.6)); }
  100% { transform: scale(1) rotate(0deg);   filter: drop-shadow(0 0 30px rgba(252,245,166,.18)); }
}
@keyframes at-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.at-tagline {
  display: inline-block; font-size: var(--at-text-xs); font-weight: 600;
  color: var(--at-jaune); letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: var(--at-space-4);
  animation: at-rise .5s var(--at-motion) both .15s;
}
.at-tagline--error {
  color: var(--at-error); background: rgba(216,65,42,.15);
  padding: 4px 12px; border-radius: var(--at-radius-full);
}
.at-title {
  font-family: var(--at-font-display); font-size: clamp(28px, 8vw, 52px); line-height: 1.08;
  text-align: center; margin: 0 0 var(--at-space-4); font-weight: 400; letter-spacing: -.01em;
  max-width: 100%; overflow-wrap: break-word;
  animation: at-rise .55s var(--at-motion) both .2s;
}
.at-title em { font-style: italic; color: var(--at-jaune); }
.at-sub {
  font-size: var(--at-text-base); color: rgba(255,255,255,.7);
  text-align: center; line-height: 1.5; margin: 0 0 var(--at-space-7); max-width: 420px;
  animation: at-rise .6s var(--at-motion) both .3s;
}
.at-sub b { font-weight: 500; color: rgba(255,255,255,.92); }

/* === Auth zone === */
.at-auth-zone { width: 100%; max-width: 380px; animation: at-rise .6s var(--at-motion) both .35s; }
.at-auth-zone--wide { max-width: 480px; }

/* SSO buttons */
.at-sso-list { display: flex; flex-direction: column; gap: var(--at-space-3); }
.at-sso-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--at-space-3);
  width: 100%; height: 58px;
  background: var(--at-jaune); color: var(--at-vert);
  border: none; border-radius: var(--at-radius-md);
  font-family: var(--at-font-text); font-size: var(--at-text-base); font-weight: 700;
  cursor: pointer; text-decoration: none; position: relative; overflow: hidden;
  transition: transform 120ms var(--at-motion), background var(--at-motion), box-shadow var(--at-motion);
}
.at-sso-btn::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.4) 0%, transparent 70%);
  opacity: 0; transition: opacity var(--at-motion-slow);
}
.at-sso-btn:hover { background: #fff7b8; transform: translateY(-2px); box-shadow: 0 12px 32px rgba(252,245,166,.22); }
.at-sso-btn:hover::before { opacity: 1; }
.at-sso-btn:active { transform: translateY(0); }
.at-sso-btn:focus-visible { outline: 3px solid var(--at-blanc); outline-offset: 3px; }
.at-sso-btn svg { width: 20px; height: 20px; flex-shrink: 0; position: relative; z-index: 1; }
.at-sso-btn span { position: relative; z-index: 1; }

.at-sso-btn--secondary {
  background: transparent; color: var(--at-blanc);
  border: 1.5px solid rgba(255,255,255,.3);
}
.at-sso-btn--secondary:hover { background: rgba(255,255,255,.06); border-color: var(--at-blanc); box-shadow: none; }

/* Subtle pulse on primary SSO to invite the click (under reduced-motion: disabled) */
.at-sso-btn--invite { animation: at-pulse 4s ease-in-out infinite 1.5s; }
@keyframes at-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(252,245,166,.45); }
  50%      { box-shadow: 0 0 0 12px rgba(252,245,166,0); }
}

.at-sso-hint {
  display: block; text-align: center;
  font-size: var(--at-text-sm); color: rgba(255,255,255,.6);
  margin-top: var(--at-space-3); min-height: 1.4em;
  transition: opacity var(--at-motion);
}
.at-sso-hint b { font-weight: 500; color: rgba(255,255,255,.88); }
.at-sso-hint[hidden] { display: none; }

/* === Divider === */
.at-divider {
  display: flex; align-items: center; gap: var(--at-space-3);
  margin: var(--at-space-6) 0 var(--at-space-5);
  color: rgba(255,255,255,.5); font-size: var(--at-text-xs);
  text-transform: uppercase; letter-spacing: .08em;
}
.at-divider::before, .at-divider::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.15); }

/* === Toggle form local === */
.at-pwd-toggle {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 6px;
  background: none; border: 1px solid rgba(255,255,255,.2);
  color: var(--at-blanc); font-family: var(--at-font-text);
  font-size: var(--at-text-sm); font-weight: 500; cursor: pointer;
  padding: var(--at-space-3) var(--at-space-4); border-radius: var(--at-radius-sm);
  transition: background var(--at-motion), border-color var(--at-motion);
}
.at-pwd-toggle:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.4); }
.at-pwd-toggle:focus-visible { outline: 3px solid var(--at-jaune); outline-offset: 2px; }
.at-pwd-toggle .at-chev { width: 12px; height: 12px; transition: transform var(--at-motion); }
.at-pwd-toggle[aria-expanded="true"] .at-chev { transform: rotate(180deg); }

/* === Form === */
.at-form { display: none; margin-top: var(--at-space-4); animation: at-fade-in .3s var(--at-motion); }
.at-form.is-open, .at-form--always { display: block; }

.at-field { margin-bottom: var(--at-space-4); }
.at-field-label {
  display: block; font-size: var(--at-text-xs); color: rgba(255,255,255,.65);
  margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
}
.at-field-input {
  width: 100%; height: 48px; padding: 0 var(--at-space-4);
  background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.16);
  border-radius: var(--at-radius-sm);
  font-family: inherit; font-size: var(--at-text-base); color: var(--at-blanc);
  transition: border-color var(--at-motion), background var(--at-motion), box-shadow var(--at-motion);
}
.at-field-input::placeholder { color: rgba(255,255,255,.35); }
.at-field-input:focus {
  outline: none; background: rgba(255,255,255,.12);
  border-color: var(--at-jaune); box-shadow: 0 0 0 4px rgba(252,245,166,.18);
}
.at-field-input[aria-invalid="true"] { border-color: var(--at-error); }
.at-field-error {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--at-text-xs); color: #ffb4a4; margin-top: 6px;
  animation: at-shake .4s var(--at-motion);
}
.at-field-error svg { width: 14px; height: 14px; flex-shrink: 0; }
@keyframes at-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.at-field-row { display: flex; justify-content: flex-end; margin: -2px 0 var(--at-space-4); }
.at-field-row a { color: var(--at-jaune); font-size: var(--at-text-sm); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 120ms; }
.at-field-row a:hover { border-bottom-color: var(--at-jaune); }

.at-remember { display: flex; align-items: center; gap: var(--at-space-2); margin: -2px 0 var(--at-space-4); font-size: var(--at-text-sm); color: rgba(255,255,255,.78); cursor: pointer; }
.at-remember input { width: 16px; height: 16px; accent-color: var(--at-jaune); flex-shrink: 0; }

/* === Buttons === */
.at-btn-primary {
  display: flex; align-items: center; justify-content: center; gap: var(--at-space-2);
  width: 100%; height: 50px; text-decoration: none;
  background: var(--at-blanc); color: var(--at-vert);
  border: none; border-radius: var(--at-radius-sm);
  font-family: inherit; font-size: var(--at-text-base); font-weight: 600; cursor: pointer;
  transition: background var(--at-motion), color var(--at-motion), transform 120ms var(--at-motion);
}
.at-btn-primary:hover { background: rgba(255,255,255,.92); transform: translateY(-1px); }
.at-btn-primary:active { transform: translateY(0); }
.at-btn-primary:focus-visible { outline: 3px solid var(--at-jaune); outline-offset: 2px; }
.at-btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.at-btn-ghost {
  flex: 1; height: 50px; text-decoration: none; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: var(--at-space-2);
  background: transparent; color: var(--at-blanc);
  border: 1.5px solid rgba(255,255,255,.3); border-radius: var(--at-radius-sm);
  font-family: inherit; font-size: var(--at-text-base); font-weight: 600; cursor: pointer;
  transition: background var(--at-motion), border-color var(--at-motion);
}
.at-btn-ghost:hover { background: rgba(255,255,255,.06); border-color: var(--at-blanc); }
.at-btn-ghost:focus-visible { outline: 3px solid var(--at-jaune); outline-offset: 2px; }

.at-btn-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: var(--at-space-2) var(--at-space-3); background: none; border: none; text-decoration: none;
  color: var(--at-jaune); font-family: inherit; font-size: var(--at-text-sm); cursor: pointer;
  border-radius: var(--at-radius-sm);
  transition: background var(--at-motion);
}
.at-btn-link:hover { background: rgba(252,245,166,.08); }
.at-btn-link:focus-visible { outline: 2px solid var(--at-jaune); outline-offset: 2px; }

.at-actions-row { display: flex; gap: var(--at-space-3); margin-top: var(--at-space-5); }
.at-actions-row > * { flex: 1; }

/* === Scope list (consent) === */
.at-scope-list { list-style: none; padding: 0; margin: 0 0 var(--at-space-5); display: flex; flex-direction: column; gap: var(--at-space-3); }
.at-scope {
  display: flex; gap: var(--at-space-3); padding: var(--at-space-3) var(--at-space-4);
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--at-radius-sm);
  transition: border-color var(--at-motion), background var(--at-motion);
}
.at-scope:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.2); }
.at-scope input[type="checkbox"] { width: 18px; height: 18px; margin-top: 3px; flex-shrink: 0; accent-color: var(--at-jaune); }
.at-scope-text { flex: 1; }
.at-scope-name { font-weight: 600; color: var(--at-blanc); font-size: var(--at-text-base); }
.at-scope-desc { font-size: var(--at-text-sm); color: rgba(255,255,255,.65); margin-top: 2px; line-height: 1.5; }

/* === Panel (success/error info card) === */
.at-panel {
  display: flex; gap: var(--at-space-4);
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--at-radius-md); padding: var(--at-space-5);
  animation: at-rise .5s var(--at-motion) both .4s;
}
.at-panel-icon {
  width: 40px; height: 40px; border-radius: var(--at-radius-full);
  background: var(--at-jaune); color: var(--at-vert);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.at-panel-icon svg { width: 20px; height: 20px; }
.at-panel--error { background: rgba(216,65,42,.08); border-color: rgba(216,65,42,.3); }
.at-panel--error .at-panel-icon { background: var(--at-error); color: var(--at-blanc); }
.at-panel-title { font-family: var(--at-font-display); font-size: var(--at-text-xl); margin: 0 0 6px; color: var(--at-blanc); font-weight: 400; }
.at-panel-body { font-size: var(--at-text-sm); color: rgba(255,255,255,.75); line-height: 1.55; margin: 0; }
.at-panel-body code { background: rgba(0,0,0,.3); padding: 2px 6px; border-radius: 3px; font-size: var(--at-text-xs); color: var(--at-jaune); }

/* === Inline alert (validation summary) === */
.at-alert {
  display: flex; gap: var(--at-space-3); padding: var(--at-space-3) var(--at-space-4);
  background: rgba(216,65,42,.12); border: 1px solid rgba(216,65,42,.35);
  border-radius: var(--at-radius-sm); margin-bottom: var(--at-space-4);
  font-size: var(--at-text-sm); color: #ffcfc2; line-height: 1.5;
  animation: at-shake .4s var(--at-motion);
}
.at-alert ul { margin: 0; padding-left: var(--at-space-4); }

/* === Password rules === */
.at-pwd-rules {
  list-style: none; padding: 0; margin: -8px 0 var(--at-space-4);
  font-size: var(--at-text-xs); color: rgba(255,255,255,.55);
  display: grid; gap: 4px;
}
.at-pwd-rules li { display: flex; align-items: center; gap: 6px; }
.at-pwd-rules li.is-ok { color: var(--at-jaune); }
.at-pwd-rules svg { width: 12px; height: 12px; flex-shrink: 0; }

/* === 2FA code input === */
.at-otp-input {
  width: 100%; height: 64px; text-align: center;
  font-family: var(--at-font-display); font-size: 32px; letter-spacing: .35em;
  background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.16);
  border-radius: var(--at-radius-md);
  color: var(--at-blanc);
  transition: border-color var(--at-motion), background var(--at-motion), box-shadow var(--at-motion);
}
.at-otp-input:focus {
  outline: none; background: rgba(255,255,255,.12);
  border-color: var(--at-jaune); box-shadow: 0 0 0 4px rgba(252,245,166,.18);
}

/* === Footer === */
.at-foot {
  display: flex; justify-content: center; gap: var(--at-space-5);
  font-size: var(--at-text-sm); color: rgba(255,255,255,.5);
  padding: var(--at-space-5) 0; text-align: center; flex-wrap: wrap;
  animation: at-rise .5s var(--at-motion) both .45s;
}
.at-foot a { color: inherit; text-decoration: none; transition: color var(--at-motion); }
.at-foot a:hover { color: var(--at-blanc); text-decoration: underline; }

/* === Generic animations === */
@keyframes at-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* === Responsive === */
@media (max-width: 480px) {
  .at-title { font-size: 36px; line-height: 1.1; }
  .at-compass-hero { width: 72px; height: 72px; margin-bottom: var(--at-space-5); }
  .at-topbar { flex-wrap: wrap; gap: var(--at-space-3); }
  .at-page { padding: var(--at-space-5) var(--at-space-4); }
  .at-actions-row { flex-direction: column; }
  .at-sso-btn { font-size: 14px; padding: 0 var(--at-space-3); gap: var(--at-space-2); }
  .at-sso-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
}
@media (max-width: 380px) {
  .at-title { font-size: 30px; }
  .at-hero { padding: var(--at-space-5) 0; }
  .at-sub { font-size: var(--at-text-sm); }
  .at-sso-hint b { word-break: break-all; }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .at-compass-hero, .at-lozenge, .at-sso-btn--invite { animation: none !important; }
}
