/* =============================================================================
   Page de connexion — Ministère de l'Économie Numérique (RDC)
   ============================================================================= */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: var(--app-text);
  background:
    radial-gradient(circle at 85% 10%, rgba(47, 111, 237, 0.12), transparent 32%),
    radial-gradient(circle at 10% 90%, rgba(201, 162, 39, 0.08), transparent 28%),
    linear-gradient(180deg, #eef4ff 0%, #f5f5f5 50%, #ffffff 100%);
}

/* Bandeau institutionnel */
.auth-banner {
  background: linear-gradient(135deg, var(--men-blue-950) 0%, var(--men-blue-800) 100%);
  box-shadow: 0 4px 20px rgba(8, 26, 59, 0.18);
}

.auth-banner__inner {
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-banner__text {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.98);
  text-align: center;
}

.auth-banner__tricolor {
  display: flex;
  width: 100%;
  height: 4px;
}

.auth-banner__tricolor-stripe {
  flex: 1;
}

.auth-banner__tricolor-stripe--blue { background: #007fff; }
.auth-banner__tricolor-stripe--gold { background: #f4c430; }
.auth-banner__tricolor-stripe--red { background: #c41e3a; }

/* Conteneur principal */
.auth-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 32px 20px 24px;
  gap: 24px;
}

.auth-card {
  width: 100%;
  padding: 32px;
  background: #ffffff;
  border: 1px solid var(--app-border);
  border-radius: 16px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 18px 48px rgba(23, 58, 122, 0.12);
}

/* Logo */
.auth-brand {
  display: grid;
  gap: 20px;
  margin-bottom: 28px;
  text-align: center;
}

.auth-logo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(320px, 100%);
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--app-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.auth-logo {
  display: block;
  height: 72px;
  width: auto;
  max-width: none;
  object-fit: contain;
  object-position: left center;
}

.auth-brand__text h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  color: #333333;
  letter-spacing: -0.02em;
}

/* Formulaire */
.auth-form {
  display: grid;
  gap: 20px;
}

.auth-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-label {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #333333;
}

.auth-forgot-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--men-blue-600);
  text-decoration: none;
  white-space: nowrap;
}

.auth-forgot-link:hover {
  color: var(--men-blue-800);
  text-decoration: underline;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap.is-invalid .auth-input {
  border-color: var(--status-danger);
  background: var(--status-danger-bg);
}

.auth-input-wrap.is-invalid .auth-input:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.auth-input-wrap.is-valid .auth-input {
  border-color: #4caf50;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: #666666;
  pointer-events: none;
}

.auth-input-icon svg {
  width: 18px;
  height: 18px;
}

.auth-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 44px 12px 44px;
  font-size: 16px;
  font-family: inherit;
  color: #333333;
  background: #ffffff;
  border: 1.5px solid #dce6f5;
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder {
  font-size: 14px;
  color: #999999;
}

.auth-input:focus {
  outline: none;
  border-color: var(--men-blue-600);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.18);
}

.auth-input--password {
  padding-right: 48px;
}

.auth-toggle-password {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #666666;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-toggle-password:hover {
  background: var(--men-blue-50);
  color: var(--men-blue-800);
}

.auth-toggle-password svg {
  width: 20px;
  height: 20px;
}

.auth-toggle-password[aria-pressed="true"] .auth-eye-open { display: none; }
.auth-toggle-password[aria-pressed="false"] .auth-eye-closed { display: none; }
.auth-toggle-password[aria-pressed="true"] .auth-eye-closed { display: block; }

.auth-field-error {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--status-danger);
}

/* Alerte globale */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.auth-alert--danger {
  background: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger);
}

.auth-alert__icon {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.3;
}

/* Bouton connexion */
.auth-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 800;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, #0066cc 0%, #2196f3 100%);
  box-shadow: 0 4px 14px rgba(0, 102, 204, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.auth-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #0052a3 0%, #1976d2 100%);
  box-shadow: 0 6px 20px rgba(0, 82, 163, 0.4);
  transform: translateY(-1px);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.auth-submit.is-loading .auth-submit__label {
  visibility: hidden;
}

.auth-submit.is-loading .auth-submit__spinner {
  display: block;
}

.auth-submit__spinner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Note & pied de page */
.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--app-border);
  font-size: 13px;
  line-height: 1.5;
  color: #666666;
  text-align: left;
}

.auth-note__icon {
  flex-shrink: 0;
  font-size: 14px;
}

.auth-footer {
  text-align: center;
}

.auth-footer p {
  margin: 0 0 6px;
  font-size: 12px;
  color: #666666;
}

.auth-footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-footer__links a {
  font-size: 12px;
  font-weight: 600;
  color: var(--men-blue-600);
  text-decoration: none;
}

.auth-footer__links a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 575px) {
  .auth-card {
    padding: 24px 20px;
  }

  .auth-brand__text h1 {
    font-size: 22px;
  }

  .auth-brand__text p {
    font-size: 15px;
  }

  .auth-logo {
    height: 64px;
  }

  .auth-input {
    font-size: 16px; /* évite le zoom iOS */
  }

  .auth-banner__text {
    font-size: 11px;
  }
}

/* Utilitaires rôles (page utilisateurs) */
.users-help {
  font-size: 14px;
  color: var(--app-muted);
}

.role-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.role-admin { background: #ffefef; color: #b42318; }
.role-pilote { background: #eef4ff; color: #1d4ed8; }
.role-lecteur { background: #f3f5f7; color: #5c6773; }
