﻿/**
 * HYDROGIS - Styles d'Authentification Modernes
 * Version: 4.0
 * Design: Interface de connexion élégante et professionnelle
 */

/* ============================================
   VARIABLES CSS - Design System Auth
   ============================================ */
:root {
  --auth-primary: #0ea5e9;
  --auth-primary-dark: #0284c7;
  --auth-primary-light: #38bdf8;
  --auth-success: #10b981;
  --auth-danger: #ef4444;
  --auth-warning: #f59e0b;

  --auth-bg: #f0f9ff;
  --auth-card-bg: #ffffff;
  --auth-text: #0f172a;
  --auth-text-muted: #64748b;

  --auth-border: #e2e8f0;
  --auth-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --auth-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

  --auth-radius: 16px;
  --auth-radius-sm: 10px;
  --auth-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BASE ET RESET AUTH
   ============================================ */
html.auth-page,
body.auth-page {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}

body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #dbeafe 100%);
  position: relative;
  overflow-x: hidden;
}

/* Motif de fond subtil */
body.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(
      circle at 20% 80%,
      rgba(14, 165, 233, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(16, 185, 129, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(139, 92, 246, 0.05) 0%,
      transparent 40%
    );
  pointer-events: none;
}

/* ============================================
   CONTENEUR PRINCIPAL
   ============================================ */
.auth-container {
  width: 100%;
  max-width: 380px;
  padding: 14px;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--auth-card-bg);
  border-radius: var(--auth-radius);
  box-shadow:
    var(--auth-shadow),
    0 0 0 1px rgba(0, 0, 0, 0.02);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  animation: authSlideUp 0.5s ease;
}

/* Ligne décorative en haut */
.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0ea5e9, #10b981, #8b5cf6, #0ea5e9);
  background-size: 300% 100%;
  animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes authSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   LOGO ET TITRE
   ============================================ */
.auth-logo {
  text-align: center;
  margin-bottom: 1rem;
}

.auth-logo img {
  max-width: 145px;
  border-radius: 50%;
  height: auto;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
  transition: var(--auth-transition);
}

.auth-logo img:hover {
  transform: scale(1.02);
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--auth-text);
  margin: 0;
  letter-spacing: -0.02em;
  text-align: center;
}

.auth-subtitle {
  font-size: 0.8125rem;
  color: var(--auth-text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* ============================================
   FORMULAIRES AUTH
   ============================================ */
.auth-form {
  margin-top: 1.25rem;
}

.form-floating-auth {
  position: relative;
  margin-bottom: 1rem;
}

.form-floating-auth input {
  width: 100%;
  padding: 0.78rem 0.85rem 0.78rem 2.55rem;
  font-size: 0.875rem;
  border: 2px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  background: #fafafa;
  color: var(--auth-text);
  transition: var(--auth-transition);
  font-family: inherit;
}

.form-floating-auth.form-floating-auth-password input {
  padding-right: 3.25rem;
}

.form-floating-auth input:focus {
  outline: none;
  border-color: var(--auth-primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.form-floating-auth input::placeholder {
  color: transparent;
}

.form-floating-auth label {
  position: absolute;
  left: 2.55rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: var(--auth-text-muted);
  pointer-events: none;
  transition: var(--auth-transition);
  background: transparent;
  padding: 0 0.25rem;
}

.form-floating-auth input:focus ~ label,
.form-floating-auth input:not(:placeholder-shown) ~ label {
  top: 0;
  left: 0.6rem;
  font-size: 0.7rem;
  color: var(--auth-primary);
  background: white;
  font-weight: 600;
}

.form-floating-auth i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--auth-text-muted);
  font-size: 0.9rem;
  transition: var(--auth-transition);
}

.form-floating-auth input:focus ~ i {
  color: var(--auth-primary);
}

.auth-password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--auth-text-muted);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--auth-transition);
  z-index: 3;
}

.auth-password-toggle:hover {
  color: var(--auth-text-muted);
  background: transparent;
}

.auth-password-toggle:focus-visible {
  outline: none;
  color: var(--auth-primary);
  background: rgba(14, 165, 233, 0.12);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.auth-password-toggle[aria-pressed="true"] {
  color: var(--auth-primary-dark);
}

/* ============================================
   CHECKBOX ET OPTIONS
   ============================================ */
.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0;
  font-size: 0.8125rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--auth-text-muted);
}

.remember-me input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 2px solid var(--auth-border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--auth-primary);
}

.forgot-password {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--auth-transition);
}

.forgot-password:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

/* ============================================
   BOUTONS AUTH
   ============================================ */
.auth-btn {
  width: 100%;
  padding: 0.78rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(
    135deg,
    var(--auth-primary) 0%,
    var(--auth-primary-dark) 100%
  );
  border: none;
  border-radius: var(--auth-radius-sm);
  cursor: pointer;
  transition: var(--auth-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.3);
  position: relative;
  overflow: hidden;
}

.auth-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: var(--auth-transition);
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.4);
}

.auth-btn:hover::before {
  opacity: 1;
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-btn-secondary {
  background: transparent;
  color: var(--auth-text);
  border: 2px solid var(--auth-border);
  box-shadow: none;
}

.auth-btn-secondary:hover {
  background: var(--auth-bg);
  border-color: var(--auth-primary);
  color: var(--auth-primary);
}

/* ============================================
   ALERTES AUTH
   ============================================ */
.auth-alert {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--auth-radius-sm);
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: authSlideUp 0.3s ease;
}

.auth-alert i {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.auth-alert-success {
  background: linear-gradient(135deg, #d1fae5, #dcfce7);
  border: 1px solid #86efac;
  color: #065f46;
}

.auth-alert-danger {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.auth-alert-warning {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
  color: #92400e;
}

.auth-alert-info {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  border: 1px solid #7dd3fc;
  color: #0c4a6e;
}

/* ============================================
   LIENS ET FOOTER
   ============================================ */
.auth-footer {
  text-align: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--auth-border);
  color: var(--auth-text-muted);
  font-size: 0.8125rem;
}

.auth-footer a {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--auth-transition);
}

.auth-footer a:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

.auth-copyright {
  text-align: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--auth-border);
  color: var(--auth-text-muted);
  font-size: 0.7rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes authShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

.auth-shake {
  animation: authShake 0.5s ease;
}

@keyframes authPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
  }
}

.auth-pulse {
  animation: authPulse 2s infinite;
}

/* ============================================
   Ã‰TATS DE CHARGEMENT
   ============================================ */
.auth-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.auth-btn.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 1.5px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .auth-container {
    padding: 0.75rem;
  }

  .auth-card {
    padding: 1.25rem;
  }

  .auth-title {
    font-size: 1.25rem;
  }

  .auth-logo img {
    max-width: 120px;
  }
}

/* ============================================
   MOT DE PASSE OUBLIÃ‰ SPÃ‰CIFIQUE
   ============================================ */
.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--auth-text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  transition: var(--auth-transition);
}

.auth-back-link:hover {
  color: var(--auth-primary);
}

.auth-instructions {
  text-align: center;
  color: var(--auth-text-muted);
  font-size: 0.875rem;
  line-height: 1.45;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

/* ============================================
   INSCRIPTION SPÃ‰CIFIQUE
   ============================================ */
.password-strength {
  margin-top: 0.5rem;
  height: 4px;
  background: var(--auth-border);
  border-radius: 2px;
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  width: 0;
  transition: var(--auth-transition);
  border-radius: 2px;
}

.password-strength-weak {
  width: 33%;
  background: var(--auth-danger);
}
.password-strength-medium {
  width: 66%;
  background: var(--auth-warning);
}
.password-strength-strong {
  width: 100%;
  background: var(--auth-success);
}

.password-hint {
  font-size: 0.7rem;
  color: var(--auth-text-muted);
  margin-top: 0.5rem;
}
