:root {
  --bg-1: #06111f;
  --bg-2: #0b1830;
  --bg-3: #10284d;

  --card: rgba(8, 18, 34, 0.92);
  --card-border: rgba(255, 255, 255, 0.08);

  --text: #f8fbff;
  --muted: #97a6ba;
  --muted-soft: #73839a;

  --field-bg: rgba(255, 255, 255, 0.06);
  --field-border: rgba(255, 255, 255, 0.10);
  --field-border-focus: rgba(59, 130, 246, 0.85);

  --primary: #2563eb;
  --primary-hover: #1d4ed8;

  --success: #22c55e;
  --danger: #ef4444;

  --shadow-card: 0 30px 90px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 18px 45px rgba(37, 99, 235, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.auth-body {
  margin: 0;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 24%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 44%, var(--bg-3) 100%);
  background-attachment: fixed;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-page-centered {
  width: 100%;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  border-radius: 28px;
  padding: 32px;
}

.auth-card-dark {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
}

.auth-card-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

.auth-logo {
  width: 190px;
  max-width: 80%;
  height: auto;
  display: block;
}

.auth-title-block h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--text);
}

.auth-title-block p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

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

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.auth-form input {
  width: 100%;
  height: 50px;
  border-radius: 14px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  padding: 0 15px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.auth-form input::placeholder {
  color: var(--muted-soft);
}

.auth-form input:focus {
  border-color: var(--field-border-focus);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

.auth-link-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
  margin-bottom: 2px;
}

.auth-link,
.auth-bottom-link a {
  color: #8ab4ff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: color 0.16s ease, opacity 0.16s ease;
}

.auth-link:hover,
.auth-bottom-link a:hover {
  color: #b9d2ff;
}

.auth-form button {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 14px;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.auth-form button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.auth-form button:active {
  transform: translateY(0);
}

.auth-form button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.login-message {
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.login-message.error {
  color: var(--danger);
}

.login-message.success {
  color: var(--success);
}

.auth-bottom-link {
  margin-top: 10px;
  text-align: center;
}

.auth-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 520px) {
  html,
  body,
  body.auth-body {
    min-height: 100%;
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
      radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 24%),
      linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 44%, var(--bg-3) 100%);
    background-attachment: fixed;
  }

  .auth-page {
    min-height: 100dvh;
    padding: 16px;
  }

  .auth-card {
    padding: 24px;
    border-radius: 22px;
    max-width: 100%;
  }

  .auth-logo {
    width: 170px;
    margin-left: auto;
    margin-right: auto;
  }

  .auth-title-block h1 {
    font-size: 28px;
  }

  .auth-footer {
    flex-direction: column;
    gap: 6px;
  }
}

/* Logo centré sur les pages d’authentification */
.auth-logo {
  margin-left: auto;
  margin-right: auto;
}

/* =========================================================
   Ajustements finaux auth pages
   ========================================================= */

/* Fond mobile jusqu'en haut, y compris zone safe-area iPhone */
html {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 24%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 44%, var(--bg-3) 100%);
}

body.auth-body {
  min-height: 100svh;
}

/* Centrage des titres, textes et libellés sur les pages auth */
.auth-card-header,
.auth-title-block,
.auth-title-block h1,
.auth-title-block p,
.auth-form label,
.auth-link-row {
  text-align: center;
}

.auth-link-row {
  justify-content: center;
}

/* Garde les champs eux-mêmes propres et lisibles */
.auth-form input {
  text-align: center;
}

/* Footer toujours côte à côte */
.auth-footer {
  flex-direction: row;
  align-items: center;
}

.auth-footer span {
  white-space: nowrap;
}

@media (max-width: 520px) {
  html,
  body,
  body.auth-body {
    min-height: 100svh;
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
      radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 24%),
      linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 44%, var(--bg-3) 100%);
    background-attachment: fixed;
  }

  body.auth-body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
      radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 24%),
      linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 44%, var(--bg-3) 100%);
  }

  .auth-page {
    min-height: 100svh;
  }

  .auth-footer {
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
  }

  .auth-footer span {
    font-size: 12px;
    white-space: nowrap;
  }
}