/*
 * Auth pages cinematic — Direction "premium entry".
 * Charge sur /auth/connexion et /auth/register.
 * 100% scopé à .auth-page-container → aucun débordement ailleurs.
 */

.auth-page-container {
  --auth-cin-mx: 50%;
  --auth-cin-my: 50%;
  position: relative;
  isolation: isolate;
}

/* ============================================================
 * Card width override — auth-polish.css avait 440px (trop étroit
 * sur grand écran). On élargit à 560px avec un peu plus de padding.
 * ============================================================ */
.auth-page-container .auth-card {
  width: min(560px, 100%);
  padding: 2rem 2.2rem;
}
@media (max-width: 600px) {
  .auth-page-container .auth-card {
    padding: 1.4rem 1.3rem;
  }
}

/* ============================================================
 * Checkbox "Se souvenir de moi" custom
 * auth-polish.css applique `width:100%` et `min-height:46px` à TOUS
 * les inputs, ce qui rend la checkbox géante et bloc → la pousse
 * sur sa propre ligne. On reset et on stylise proprement.
 * ============================================================ */
.auth-page-container .auth-form input[type="checkbox"] {
  width: auto !important;
  min-height: 0 !important;
}

.auth-page-container .auth-remember,
.auth-page-container .auth-form-remember {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: Cinzel, serif;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(212, 160, 23, 0.85);
  user-select: none;
  margin: 4px 0;
}

.auth-page-container .auth-remember input[type="checkbox"],
.auth-page-container .auth-form-remember input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  border: 1.5px solid rgba(212, 160, 23, 0.55);
  border-radius: 4px;
  background: rgba(5, 10, 26, 0.6);
  cursor: pointer;
  position: relative;
  margin: 0;
  flex-shrink: 0;
  transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.auth-page-container .auth-remember input[type="checkbox"]:hover,
.auth-page-container .auth-form-remember input[type="checkbox"]:hover {
  border-color: #d4a017;
}

.auth-page-container .auth-remember input[type="checkbox"]:checked,
.auth-page-container .auth-form-remember input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #f0c842, #d4a017);
  border-color: #d4a017;
}

.auth-page-container .auth-remember input[type="checkbox"]:checked::after,
.auth-page-container .auth-form-remember input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #0a1424;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.auth-page-container .auth-remember input[type="checkbox"]:focus-visible,
.auth-page-container .auth-form-remember input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.25);
}

[data-theme="light"] .auth-page-container .auth-remember,
[data-theme="light"] .auth-page-container .auth-form-remember {
  color: rgba(168, 111, 18, 0.85);
}
[data-theme="light"] .auth-page-container .auth-remember input[type="checkbox"],
[data-theme="light"] .auth-page-container .auth-form-remember input[type="checkbox"] {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(168, 111, 18, 0.55);
}

/* ============================================================
 * Autofill : empêche Chrome/Edge de forcer un fond blanc sur les
 * inputs (cas password mémorisé). On utilise inset box-shadow large
 * pour repeindre le background, et text-fill-color pour la couleur.
 * ============================================================ */
.auth-page-container .auth-form input:-webkit-autofill,
.auth-page-container .auth-form input:-webkit-autofill:hover,
.auth-page-container .auth-form input:-webkit-autofill:focus,
.auth-page-container .auth-form input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 40px rgba(5, 10, 26, 0.42) inset !important;
  -webkit-text-fill-color: #e8e0d0 !important;
  caret-color: #e8e0d0;
  transition: background-color 9999s ease-in-out 0s;
  font-family: Rajdhani, system-ui, sans-serif !important;
}

[data-theme="light"] .auth-page-container .auth-form input:-webkit-autofill,
[data-theme="light"] .auth-page-container .auth-form input:-webkit-autofill:hover,
[data-theme="light"] .auth-page-container .auth-form input:-webkit-autofill:focus,
[data-theme="light"] .auth-page-container .auth-form input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.94) inset !important;
  -webkit-text-fill-color: #17202a !important;
  caret-color: #17202a;
}

/* ============================================================
 * 5. Particules dorées en fond (canvas plein écran)
 * ============================================================ */
.auth-cin-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.auth-page-container .auth-card {
  position: relative;
  z-index: 1;
}

/* ============================================================
 * 1. Cascade d'entrée du card + stagger des enfants
 * ============================================================ */
.auth-page-container .auth-card {
  opacity: 0;
  transform: translateY(20px);
  filter: blur(8px);
  transition:
    opacity 700ms cubic-bezier(0.22, 1, 0.36, 1) 100ms,
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1) 100ms,
    filter 700ms cubic-bezier(0.22, 1, 0.36, 1) 100ms;
  overflow: hidden;
}
.auth-page-container.is-cin-mounted .auth-card {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.auth-page-container .auth-card > * {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 540ms cubic-bezier(0.22, 1, 0.36, 1) calc(var(--auth-cin-i, 0) * 70ms + 420ms),
    transform 540ms cubic-bezier(0.22, 1, 0.36, 1) calc(var(--auth-cin-i, 0) * 70ms + 420ms);
}
.auth-page-container.is-cin-mounted .auth-card > * {
  opacity: 1;
  transform: translateY(0);
}

/* Garde les enfants au-dessus du spotlight ::after */
.auth-page-container .auth-card > * {
  position: relative;
  z-index: 2;
}

/* ============================================================
 * 2. Spotlight souris doré sur le card
 * ============================================================ */
.auth-page-container .auth-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--auth-cin-mx) var(--auth-cin-my),
    rgba(212, 160, 23, 0.14),
    rgba(212, 160, 23, 0.04) 35%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 420ms ease;
  border-radius: inherit;
  z-index: 1;
}
.auth-page-container .auth-card.is-cin-spotlight::after {
  opacity: 1;
}

/* ============================================================
 * 6. Décoratif ✦ qui tourne en coin du card
 * ============================================================ */
.auth-page-container .auth-card::before {
  content: '✦';
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 14px;
  color: rgba(212, 160, 23, 0.42);
  font-family: serif;
  z-index: 3;
  pointer-events: none;
  animation: auth-cin-ornament-rotate 24s linear infinite;
  transform-origin: center;
  text-shadow: 0 0 8px rgba(212, 160, 23, 0.35);
}
@keyframes auth-cin-ornament-rotate {
  to { transform: rotate(360deg); }
}

/* ============================================================
 * 7. Title shimmer (le gradient existant glisse de gauche à droite)
 * ============================================================ */
.auth-page-container .auth-card-title {
  background-size: 200% 100% !important;
  animation: auth-cin-title-shimmer 7s linear infinite;
}
@keyframes auth-cin-title-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ============================================================
 * 3 + 4. Inputs : hover et focus doré (cohérence vitrine/carte)
 * ============================================================ */
.auth-page-container .auth-form input:not([type="checkbox"]):not([type="hidden"]) {
  transition:
    border-color 240ms ease,
    box-shadow 240ms ease,
    background-color 240ms ease;
}
.auth-page-container .auth-form input:hover:not(:focus):not([type="checkbox"]):not([type="hidden"]) {
  border-color: rgba(212, 160, 23, 0.42);
}
.auth-page-container .auth-form input:focus:not([type="checkbox"]):not([type="hidden"]),
.auth-page-container .auth-form input:focus-visible:not([type="checkbox"]):not([type="hidden"]) {
  outline: none;
  border-color: rgba(212, 160, 23, 0.65);
  box-shadow:
    0 0 0 3px rgba(212, 160, 23, 0.14),
    0 4px 12px rgba(212, 160, 23, 0.08);
  background-color: rgba(5, 10, 26, 0.58);
}
[data-theme="light"] .auth-page-container .auth-form input:focus:not([type="checkbox"]):not([type="hidden"]) {
  background-color: rgba(255, 255, 255, 0.94);
}

/* ============================================================
 * 8. Password show/hide toggle
 * ============================================================ */
.auth-cin-password-wrap {
  position: relative;
}
.auth-cin-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(212, 160, 23, 0.6);
  border-radius: 6px;
  transition: color 200ms ease, background 200ms ease;
  padding: 0;
  z-index: 2;
}
.auth-cin-password-toggle:hover {
  color: #d4a017;
  background: rgba(212, 160, 23, 0.08);
}
.auth-cin-password-toggle:focus-visible {
  outline: 2px solid rgba(212, 160, 23, 0.5);
  outline-offset: 1px;
}
.auth-cin-password-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================================================
 * 9. Submit button : loading spinner pendant submit + hover lift
 * ============================================================ */
.auth-page-container .btn-primary {
  position: relative;
  transition:
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 200ms ease,
    opacity 200ms ease,
    color 200ms ease;
}
.auth-page-container .btn-primary:hover:not(.is-cin-loading):not(:disabled) {
  transform: translateY(-2px);
  filter: drop-shadow(0 6px 18px rgba(212, 160, 23, 0.38));
}
.auth-page-container .btn-primary:active:not(.is-cin-loading) {
  transform: translateY(0);
}
.auth-page-container .btn-primary.is-cin-loading {
  pointer-events: none;
  color: transparent !important;
}
.auth-page-container .btn-primary.is-cin-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(5, 10, 26, 0.2);
  border-top-color: #050a1a;
  border-radius: 50%;
  animation: auth-cin-spin 0.7s linear infinite;
}
@keyframes auth-cin-spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
 * 10. Toast notifications (erreurs / succès)
 * ============================================================ */
.auth-cin-toast {
  position: fixed;
  top: calc(var(--gl-nav-h, 76px) + 16px);
  right: 16px;
  max-width: 360px;
  padding: 14px 18px;
  background: rgba(5, 10, 26, 0.95);
  border: 1px solid rgba(212, 160, 23, 0.42);
  border-radius: 10px;
  color: #e8e0d0;
  font-family: Rajdhani, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
  z-index: 6000;
  opacity: 0;
  transform: translateX(120%);
  transition:
    opacity 320ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.auth-cin-toast.is-cin-visible {
  opacity: 1;
  transform: translateX(0);
}
.auth-cin-toast--error {
  border-color: rgba(238, 92, 110, 0.55);
}
.auth-cin-toast__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Cinzel, serif;
  font-weight: 800;
  font-size: 13px;
  background: rgba(212, 160, 23, 0.18);
  color: #d4a017;
}
.auth-cin-toast--error .auth-cin-toast__icon {
  background: rgba(238, 92, 110, 0.18);
  color: #ee5c6e;
}

[data-theme="light"] .auth-cin-toast {
  background: rgba(255, 250, 240, 0.96);
  color: #17202a;
  border-color: rgba(168, 111, 18, 0.42);
}

@media (max-width: 480px) {
  .auth-cin-toast {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ============================================================
 * 11. Password strength meter (register only)
 * ============================================================ */
.auth-cin-strength {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  height: 4px;
}
.auth-cin-strength__bar {
  flex: 1;
  background: rgba(212, 160, 23, 0.12);
  border-radius: 2px;
  transition: background 300ms ease;
}
.auth-cin-strength.is-strength-1 .auth-cin-strength__bar:nth-child(1) {
  background: #ee5c6e;
}
.auth-cin-strength.is-strength-2 .auth-cin-strength__bar:nth-child(-n+2) {
  background: #e8a13c;
}
.auth-cin-strength.is-strength-3 .auth-cin-strength__bar:nth-child(-n+3) {
  background: #f0c842;
}
.auth-cin-strength.is-strength-4 .auth-cin-strength__bar:nth-child(-n+4) {
  background: #6bcc8e;
}
.auth-cin-strength__label {
  font-family: Cinzel, serif;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 6px;
  color: rgba(232, 224, 208, 0.5);
  min-height: 0.9em;
}
[data-theme="light"] .auth-cin-strength__label {
  color: rgba(23, 32, 42, 0.5);
}

/* ============================================================
 * Mobile responsive
 * ============================================================ */
@media (max-width: 480px) {
  .auth-page-container,
  .modern-auth-container {
    padding: calc(var(--gl-nav-h, 64px) + 1.5rem) 0.8rem 2rem;
  }
  .auth-page-container .auth-card-title {
    font-size: clamp(2rem, 7vw, 2.8rem) !important;
  }
  .auth-page-container .auth-card {
    padding: 1.2rem;
  }
  .auth-page-container .auth-card::before {
    top: 8px;
    right: 12px;
    font-size: 12px;
  }
}

/* ============================================================
 * Reduced motion : tout figé
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .auth-page-container .auth-card,
  .auth-page-container .auth-card > * {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
  .auth-page-container .auth-card::before { animation: none; }
  .auth-page-container .auth-card::after { display: none; }
  .auth-page-container .auth-card-title { animation: none; }
  .auth-cin-particles { display: none; }
  .auth-page-container .btn-primary.is-cin-loading::after { animation: none; }
  .auth-cin-toast { transition: opacity 100ms ease; transform: none; }
}
