/* ==========================================================================
   LSPD Intranet — pages d'accès (connexion, validation, accès refusé)
   L'image de fond est définie par chaque page sur le <body>.
   ========================================================================== */
:root {
  --lspd-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --lspd-font-display: 'Rajdhani', 'Inter', system-ui, sans-serif;
  --lspd-primary: #4a7dff;
  --lspd-primary-hover: #2f63e8;
  --lspd-gold: #f0b429;
  --lspd-danger: #ef4444;
  --lspd-text: #e9eef8;
  --lspd-text-muted: #9aa7c2;
  --lspd-border: rgba(148, 170, 230, 0.16);
  --lspd-border-strong: rgba(148, 170, 230, 0.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  font-family: var(--lspd-font);
  color: var(--lspd-text);
  background-color: #070c18;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(70% 60% at 50% 45%, rgba(4, 9, 20, 0.12) 0%, rgba(4, 9, 20, 0.5) 100%);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 40px 36px 32px;
  border-radius: 22px;
  background: rgba(9, 15, 30, 0.78);
  border: 1px solid var(--lspd-border);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: center;
  overflow: hidden;
  animation: auth-in .5s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--lspd-primary), var(--lspd-gold));
}
.auth-card.is-wide { max-width: 560px; }

.auth-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  margin: 0 auto 14px;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
}
.auth-eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lspd-gold);
}
.auth-card h1 {
  font-family: var(--lspd-font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: #fff;
  margin-bottom: 10px;
}
.auth-card h1 i { color: var(--lspd-primary); margin-right: 8px; font-size: 0.85em; }
.auth-lead {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--lspd-text-muted);
}
.auth-lead strong { color: var(--lspd-text); font-weight: 600; }

.auth-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 24px 0;
  padding: 14px 16px;
  border-radius: 14px;
  text-align: left;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.auth-notice i { color: #f87171; margin-top: 3px; flex-shrink: 0; }
.auth-notice strong { color: #fff; }
.auth-notice.is-info { color: #c9d6f5; background: rgba(74, 125, 255, 0.1); border-color: rgba(74, 125, 255, 0.3); }
.auth-notice.is-info i { color: #9db8ff; }

.auth-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.auth-actions.is-row { flex-direction: row; flex-wrap: wrap; }
.auth-actions.is-row > * { flex: 1 1 180px; }

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--lspd-font);
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  background: linear-gradient(180deg, #5a89ff 0%, var(--lspd-primary) 100%);
  box-shadow: 0 10px 26px rgba(74, 125, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.auth-btn:hover { transform: translateY(-1px); background: linear-gradient(180deg, var(--lspd-primary) 0%, var(--lspd-primary-hover) 100%); box-shadow: 0 14px 32px rgba(74, 125, 255, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.auth-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.auth-btn i { font-size: 1.1em; }
.auth-btn.is-discord { background: linear-gradient(180deg, #6b77f5 0%, #5865f2 100%); box-shadow: 0 10px 26px rgba(88, 101, 242, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.auth-btn.is-discord:hover { background: linear-gradient(180deg, #5865f2 0%, #4752c4 100%); }
.auth-btn.is-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--lspd-border-strong); box-shadow: none; color: var(--lspd-text); }
.auth-btn.is-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.auth-btn.is-danger:hover { background: rgba(239, 68, 68, 0.9); border-color: transparent; color: #fff; box-shadow: 0 12px 28px rgba(239, 68, 68, 0.35); }

.auth-error {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.auth-meta {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--lspd-border);
  display: grid;
  gap: 8px;
  text-align: left;
  font-size: 0.88rem;
}
.auth-meta-row { display: flex; justify-content: space-between; gap: 12px; }
.auth-meta-row span:first-child { color: var(--lspd-text-muted); }
.auth-meta-row span:last-child { font-weight: 600; text-align: right; word-break: break-word; }
.auth-status { display: inline-flex; align-items: center; gap: 8px; color: var(--lspd-gold); }
.auth-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: auth-ping 1.6s ease-out infinite; }

.auth-loader {
  width: 44px;
  height: 44px;
  margin: 22px auto 6px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--lspd-primary);
  border-right-color: var(--lspd-gold);
  animation: auth-spin 1s linear infinite;
}
.auth-hint { margin-top: 10px; font-size: 0.8rem; color: var(--lspd-text-muted); }
.auth-reason { font-size: 0.98rem; line-height: 1.65; color: #d3dbec; word-break: break-word; }
.auth-reason strong { color: #fff; }
.auth-reason em { color: var(--lspd-text-muted); }

.auth-footer {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--lspd-border);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #66748f;
}

@keyframes auth-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@keyframes auth-ping { 0% { box-shadow: 0 0 0 0 rgba(240, 180, 41, .6); } 100% { box-shadow: 0 0 0 9px rgba(240, 180, 41, 0); } }

@media (max-width: 480px) {
  .auth-card { padding: 32px 22px 26px; border-radius: 18px; }
  .auth-card h1 { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-card, .auth-loader, .auth-status::before { animation: none; }
}

/* ==========================================================================
   Mise en scène partagée : fond animé, carte vitrée à cadre lumineux
   Chaque page définit .auth-bg { background-image: url(...) }
   ========================================================================== */
/* ---------- Fond : l'image d'origine, mise en scène ---------- */
body { background: #050913; overflow-x: hidden; }
body::before { display: none; }
.auth-scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.auth-scene > * { position: absolute; inset: 0; }

/* Image de fond avec un zoom très lent */
.auth-bg {
  inset: -2%;
  background: center / cover no-repeat;
  filter: saturate(1.08) contrast(1.06);
  transform-origin: 40% 45%;
  animation: auth-kenburns 38s ease-in-out infinite alternate;
}
@keyframes auth-kenburns {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to   { transform: scale(1.08) translate3d(-1%, -1%, 0); }
}

/* Étalonnage bleu nuit */
.auth-grade {
  background:
    linear-gradient(160deg, rgba(30, 58, 138, 0.28) 0%, rgba(5, 9, 19, 0.15) 45%, rgba(5, 9, 19, 0.55) 100%);
  mix-blend-mode: multiply;
}

/* Lueurs de gyrophare rouge / bleu qui alternent */
.auth-lights span {
  position: absolute;
  top: -25%;
  width: 70vw;
  height: 70vh;
  border-radius: 50%;
  filter: blur(90px);
  mix-blend-mode: screen;
  opacity: 0;
}
.auth-lights .is-red  { left: -20vw; background: radial-gradient(closest-side, rgba(239, 68, 68, .7), transparent); animation: auth-siren 3.2s ease-in-out infinite; }
.auth-lights .is-blue { right: -20vw; background: radial-gradient(closest-side, rgba(59, 110, 255, .8), transparent); animation: auth-siren 3.2s ease-in-out infinite; animation-delay: -1.6s; }
@keyframes auth-siren {
  0%, 100% { opacity: 0.08; }
  18%      { opacity: 0.55; }
  26%      { opacity: 0.25; }
  34%      { opacity: 0.5; }
  55%      { opacity: 0.08; }
}

/* Lumière douce derrière la carte + vignettage */
.auth-vignette {
  background:
    radial-gradient(40% 50% at 50% 50%, rgba(74, 125, 255, 0.14) 0%, transparent 70%),
    radial-gradient(85% 75% at 50% 50%, transparent 45%, rgba(3, 6, 14, 0.75) 100%),
    linear-gradient(180deg, rgba(3, 6, 14, 0.35) 0%, transparent 25%, transparent 70%, rgba(3, 6, 14, 0.6) 100%);
}

/* Grain fin */
.auth-grain {
  inset: -50%;
  opacity: .09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: auth-grain 1.2s steps(4) infinite;
}
@keyframes auth-grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -3%); }
  75%  { transform: translate(-2%, -1%); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg, .auth-grain { animation: none; }
  .auth-lights span { animation: none; opacity: .18; }
}

/* ---------- Cadre animé autour de la carte ---------- */
@property --auth-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes auth-rotate { to { --auth-angle: 360deg; } }
@keyframes auth-ring { to { transform: rotate(360deg); } }
@keyframes auth-shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }
@keyframes auth-fade { from { opacity: 0; } }

.auth-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 1.5px;
  border-radius: 26px;
  background: conic-gradient(from var(--auth-angle),
    rgba(74, 125, 255, 0.15) 0deg, #4a7dff 60deg, #f0b429 110deg,
    rgba(74, 125, 255, 0.15) 170deg, rgba(74, 125, 255, 0.15) 220deg,
    #4a7dff 290deg, rgba(74, 125, 255, 0.15) 360deg);
  animation: auth-rotate 7s linear infinite, auth-fade .6s ease both;
  transform-style: preserve-3d;
  transition: transform .25s ease-out;
  will-change: transform;
}
/* Halo lumineux derrière la carte */
.auth-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: -1;
  border-radius: inherit;
  background: inherit;
  filter: blur(28px);
  opacity: .55;
}

.auth-glass {
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 24.5px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(74, 125, 255, 0.16) 0%, transparent 60%),
    rgba(7, 12, 25, 0.9);
  animation: auth-in .6s cubic-bezier(.2, .8, .2, 1) both;
  text-align: center;
}
.auth-glass::before { display: none; }
/* Lumière qui suit la souris */
.auth-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, -20%), rgba(157, 184, 255, 0.12), transparent 70%);
  transition: opacity .3s ease;
}

/* Bandeau supérieur */
.auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--lspd-border);
  background: rgba(255, 255, 255, 0.025);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #7d8aa6;
}
.auth-bar .is-secure { display: inline-flex; align-items: center; gap: 8px; color: #86efac; }
.auth-bar .is-secure::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18), 0 0 10px #22c55e;
}
.auth-bar time { font-variant-numeric: tabular-nums; letter-spacing: .12em; color: #b8c3da; }

.auth-body { position: relative; padding: 30px 34px 26px; }

/* Écusson avec anneau rotatif */
.auth-seal {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
}
.auth-seal::before,
.auth-seal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.auth-seal::before {
  background: repeating-conic-gradient(from 0deg, rgba(240, 180, 41, .85) 0 6deg, transparent 6deg 15deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  animation: auth-ring 30s linear infinite;
}
.auth-seal::after {
  inset: 8px;
  background: radial-gradient(circle, rgba(74, 125, 255, .28) 0%, rgba(74, 125, 255, 0) 70%);
  border: 1px solid rgba(157, 184, 255, .22);
}
.auth-seal .auth-logo { position: relative; z-index: 1; width: 72px; height: 72px; margin: 0; }

.auth-glass .auth-eyebrow { margin-bottom: 6px; }
.auth-glass h1 {
  margin: 0 0 12px;
  font-size: 2.6rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 30%, #a9c0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-wrap: balance;
}
.auth-glass .auth-lead { max-width: 360px; margin: 0 auto 24px; text-wrap: balance; }

.auth-glass .auth-error { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 18px; text-align: left; }
.auth-glass .auth-error i { color: #f87171; margin-top: 3px; }
.auth-glass .auth-error strong { display: block; color: #fff; font-weight: 600; margin-bottom: 2px; }
.auth-glass .auth-error span { color: #fca5a5; font-size: .82rem; line-height: 1.5; }

/* Bouton Discord */
.auth-glass .auth-actions { margin-top: 0; }
.auth-glass .auth-btn { position: relative; overflow: hidden; min-height: 54px; font-size: 1rem; border-radius: 14px; }
.auth-glass .auth-btn::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: translateX(-120%) skewX(-20deg);
}
.auth-glass .auth-btn:hover::after { animation: auth-shine .9s ease; }
.auth-btn .btn-spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: auth-spin .8s linear infinite;
}
.auth-btn.is-loading { pointer-events: none; opacity: .9; }
.auth-btn.is-loading .btn-spinner { display: inline-block; }
.auth-btn.is-loading .fa-discord { display: none; }

.auth-glass .auth-notice { margin: 24px 0 0; font-size: .76rem; padding: 11px 14px; }

.auth-glass .auth-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 14px;
}
.auth-motto { font-style: italic; color: #8a97b2; }

@media (max-width: 480px) {
  .auth-body { padding: 26px 20px 22px; }
  .auth-glass h1 { font-size: 2.1rem; }
  .auth-seal { width: 92px; height: 92px; }
  .auth-seal .auth-logo { width: 62px; height: 62px; }
  .auth-bar { padding: 11px 16px; letter-spacing: .12em; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-frame, .auth-seal::before { animation: none; }
  .auth-bg, .auth-grain { animation: none; }
  .auth-glass .auth-btn:hover::after { animation: none; }
}
