/* ==========================================================================
   Page de connexion - Style Sourhce "Brume" uniquement
   ========================================================================== */

:root {
  --brand-700: #00537a;
  --brand-600: #00699b;
  --brand-500: #008bcc;
  --brand-400: #2bc1d4;
  --brand-300: #7fdce7;
  --brand-100: #e5f6fa;
  --brand-gradient: linear-gradient(135deg, var(--brand-500), var(--brand-400));

  --navy-900: #071c2b;
  --navy-800: #0d2b3f;

  --bg-app: #f5f8fa;
  --card-bg: #ffffff;
  --card-alt: #eef6f9;
  --border: #e0e9ee;

  --text-primary: #0d2b3f;
  --text-secondary: #5b7280;
  --text-muted: #8ba0ac;
  --text-inverse: #ffffff;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 20px;

  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 6px rgba(16, 24, 40, .05);
  --shadow-card-hover: 0 8px 24px rgba(16, 24, 40, .10);
}

/* Mode d'authentification (switché par auth.js) */
.auth-mode {
  display: none;
}

.auth-mode.active {
  display: block;
  animation: fadeInMode 0.3s ease;
}

@keyframes fadeInMode {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Page */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 32px 16px 24px;
  background: linear-gradient(180deg, #ffffff 0%, #eef8fb 100%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
}

/* Décors d'arrière-plan - UNIQUEMENT BRUME */
.auth-bg-el {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.auth-page[data-bg="brume"] .bg-brume {
  display: block;
}

.bg-brume.b1 {
  width: 60vw;
  height: 60vw;
  max-width: 460px;
  max-height: 460px;
  top: -12%;
  left: -15%;
  border-radius: 50%;
  filter: blur(70px);
  background: radial-gradient(circle, var(--brand-300), transparent 70%);
  opacity: .55;
  animation: driftA 24s ease-in-out infinite;
}

.bg-brume.b2 {
  width: 55vw;
  height: 55vw;
  max-width: 420px;
  max-height: 420px;
  bottom: -16%;
  right: -12%;
  border-radius: 50%;
  filter: blur(70px);
  background: radial-gradient(circle, var(--brand-400), transparent 70%);
  opacity: .35;
  animation: driftB 28s ease-in-out infinite;
}

.bg-brume.b3 {
  width: 38vw;
  height: 38vw;
  max-width: 300px;
  max-height: 300px;
  top: 38%;
  right: 18%;
  border-radius: 50%;
  filter: blur(70px);
  background: radial-gradient(circle, var(--brand-100), transparent 70%);
  opacity: .9;
  animation: driftA 32s ease-in-out infinite reverse;
}

@keyframes driftA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4%, 6%) scale(1.08); }
}

@keyframes driftB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5%, -5%) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-brume { animation: none !important; }
}

/* Conteneur central */
.auth-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* Marque / logo */
.auth-brand {
  width: 100%;
  text-align: center;
  padding: 4px 20px 0;
}

.auth-brand-logo {
  height: 100px;
  width: auto;
  margin: 0 auto 10px;
}

.auth-brand-name {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-secondary);
}

/* Carte */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-m);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.auth-card {
  width: 100%;
  padding: 26px 22px 24px;
  border-radius: var(--radius-l);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 139, 204, .25);
}

.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(0, 139, 204, .35);
}

.btn-block {
  width: 100%;
}

.auth-submit {
  margin-top: 2px;
  padding: 14px;
  font-size: .98rem;
}

/* Champs */
.auth-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 13px 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-field:focus-within {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.auth-field .icon {
  flex: 0 0 auto;
  width: 1em;
  height: 1em;
  font-size: 1rem;
  line-height: 1;
  color: var(--brand-500);
}

.auth-field input {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: .95rem;
  color: var(--text-primary);
}

.auth-field input::placeholder {
  color: var(--text-muted);
}

/* Supprimer la surbrillance jaune de l'autocomplétion */
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus,
.auth-field input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-app) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: var(--text-primary);
}

.auth-toggle-pw {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 2px;
}

.auth-toggle-pw:hover {
  color: var(--brand-500);
}

/* Checkbox "Se souvenir de moi" */
.auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  color: var(--text-secondary);
  cursor: pointer;
  margin: -2px 0 2px;
}

.auth-remember input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #fff;
  position: relative;
  cursor: pointer;
}

.auth-remember input[type="checkbox"]:checked {
  background: var(--brand-gradient);
  border-color: transparent;
}

.auth-remember input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
}

/* Liens */
.auth-link {
  display: block;
  text-align: center;
  font-weight: 600;
  font-size: .92rem;
  color: var(--brand-500);
  margin-top: 16px;
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-link-muted {
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Textes d'info */
.info-text,
.success-text {
  font-size: .9rem;
  color: var(--text-secondary);
  margin: 0 0 14px;
  line-height: 1.5;
}

.success-text {
  color: var(--brand-600);
  font-weight: 500;
}

.success-box {
  background: var(--brand-100);
  border: 1px solid var(--brand-300);
  border-radius: var(--radius-s);
  padding: 14px;
}

/* Footer */
.auth-footer {
  position: relative;
  z-index: 1;
  margin: 28px 0 0;
  font-size: .78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Responsive */
@media (min-width: 480px) {
  .auth-wrap { max-width: 420px; }
  .auth-card { padding: 30px 26px 26px; }
}

/* ==========================================================================
   Tuile d'expiration de session (redirection automatique après 401)
   ========================================================================== */
.auth-notice-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-m);
  background: var(--brand-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px rgba(0, 105, 155, 0.35);
  text-align: left;
}

.auth-notice-tile[hidden] {
  display: none;
}

.auth-notice-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.auth-notice-icon svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
}

.auth-notice-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.auth-notice-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.auth-notice-text {
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0.92;
}
