/* =============================================================
   ACIM SMS — Styles communs aux pages d'authentification
   (login, mot de passe oublié, reset, register, MFA)
   v3 — Glass / Motion / Premium
   ============================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ====== LAYOUT SPLIT ====== */
.auth-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* ====== PANNEAU GAUCHE : BRANDING ====== */
.auth-brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, #FEF7F7 0%, #FDECEA 30%, #FDF0EF 60%, #FEF7F7 100%);
  background-size: 300% 300%;
  animation: gradientShift 12s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

/* Animated gradient background */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Decorative floating circles */
.auth-brand::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(194, 33, 40, 0.06) 0%, transparent 70%);
  top: -100px;
  left: -100px;
  animation: floatOrb 8s ease-in-out infinite;
}

.auth-brand::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(194, 33, 40, 0.05) 0%, transparent 70%);
  bottom: -80px;
  right: -60px;
  animation: floatOrb 10s ease-in-out infinite reverse;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

.auth-brand .brand-content {
  position: relative;
  z-index: 1;
  animation: fadeSlideIn 0.7s ease-out;
}

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

.auth-brand .brand-logo {
  width: 130px;
  height: 130px;
  border-radius: 24px;
  object-fit: contain;
  background: #fff;
  padding: 12px;
  box-shadow: 0 8px 32px rgba(194, 33, 40, 0.15), 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 30px;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.auth-brand .brand-logo:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 40px rgba(194, 33, 40, 0.2), 0 4px 12px rgba(0,0,0,0.08);
}

.auth-brand h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #C22128, #9B1A20);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand .brand-tagline {
  font-size: 0.82rem;
  font-weight: 600;
  color: #9B1A20;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0.7;
}

.auth-brand p {
  font-size: 1.02rem;
  color: #6E7687;
  max-width: 420px;
  line-height: 1.7;
  margin-bottom: 34px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.brand-features .feature {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.92rem;
  color: #4A4A4A;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.brand-features .feature:hover {
  transform: translateX(6px);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 16px rgba(194, 33, 40, 0.08);
}

.brand-features .feature i {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(194, 33, 40, 0.1), rgba(194, 33, 40, 0.05));
  color: #C22128;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.brand-features .feature:hover i {
  background: linear-gradient(135deg, #C22128, #E8353D);
  color: #fff;
}

/* Icône décorative (MFA shield, etc.) */
.auth-brand .brand-shield {
  margin-top: 30px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(194, 33, 40, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #C22128;
}


/* ====== PANNEAU DROIT : FORMULAIRE ====== */
.auth-form-panel {
  width: 500px;
  min-width: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 50px 44px;
  background: #fff;
  box-shadow: -4px 0 32px rgba(0,0,0,0.06);
  position: relative;
  animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Subtle top accent line */
.auth-form-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #C22128, #E8353D, #C22128);
  background-size: 200% 100%;
  animation: shimmerLine 3s linear infinite;
}

@keyframes shimmerLine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.auth-form-panel.auth-form-wide {
  width: 540px;
  min-width: 440px;
  padding: 40px 36px;
  overflow-y: auto;
}

.auth-form-wrapper {
  width: 100%;
  max-width: 370px;
}

.auth-form-panel.auth-form-wide .auth-form-wrapper {
  max-width: 440px;
}


/* ====== TITRES ====== */
.auth-form-wrapper h2 {
  font-size: 1.7rem;
  font-weight: 800;
  color: #2D2D3A;
  margin-bottom: 6px;
  position: relative;
}

.auth-form-wrapper h2::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, #C22128, #E8353D);
  border-radius: 2px;
  margin-top: 8px;
}

.auth-form-wrapper h2 i {
  color: #C22128;
  margin-right: 8px;
}

.auth-form-wrapper .subtitle {
  color: #6c757d;
  font-size: 0.9rem;
  margin-bottom: 30px;
  margin-top: 12px;
}


/* ====== FORMULAIRE ====== */
.auth-form-wrapper .form-group {
  margin-bottom: 20px;
}

.auth-form-wrapper label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #495057;
  margin-bottom: 6px;
  display: block;
}

.auth-form-wrapper label i {
  color: #C22128;
  margin-right: 4px;
}

.auth-form-wrapper .form-control {
  height: 50px;
  border-radius: 12px;
  border: 1.5px solid #e8eaed;
  padding: 10px 16px;
  font-size: 0.95rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  background: #fafbfc;
}

.auth-form-wrapper .form-control:hover {
  border-color: #ccc;
  background: #fff;
}

.auth-form-wrapper .form-control:focus {
  border-color: #C22128;
  box-shadow: 0 0 0 4px rgba(194, 33, 40, 0.1);
  background: #fff;
}

/* Icônes dans les inputs */
.input-icon-wrapper { position: relative; }

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #adb5bd;
  font-size: 1rem;
}

.input-icon-wrapper .form-control {
  padding-left: 42px;
}

.input-icon-wrapper .togglePassword {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  padding: 4px 8px;
  z-index: 2;
}

.input-icon-wrapper .togglePassword:hover {
  color: #495057;
}


/* ====== OTP INPUT (MFA) ====== */
.otp-input {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 12px;
  height: 60px !important;
  border-radius: 12px;
  border: 2px solid #dee2e6;
}

.otp-input:focus {
  border-color: #C22128;
  box-shadow: 0 0 0 3px rgba(194, 33, 40, 0.12);
}


/* ====== EMAIL HINT (MFA) ====== */
.auth-email-hint {
  background: #FEF7F7;
  border: 1px solid rgba(194, 33, 40, 0.1);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: #495057;
  text-align: center;
}

.auth-email-hint i {
  color: #C22128;
  margin-right: 6px;
}

.auth-email-hint strong {
  color: #C22128;
}


/* ====== BOUTONS ====== */
.btn-auth {
  height: 52px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #C22128 0%, #E8353D 50%, #C22128 100%);
  background-size: 200% 100%;
  border: none;
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-position 0.4s ease;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.btn-auth::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(194, 33, 40, 0.4);
  background-position: 100% 0;
  color: #fff;
}

.btn-auth:hover::before {
  left: 100%;
}

.btn-auth:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(194, 33, 40, 0.3);
}


/* ====== LIENS ====== */
.auth-link {
  text-align: center;
  margin-top: 16px;
}

.auth-link a {
  color: #C22128;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
  color: #9B1A20;
}

.auth-link-muted a {
  color: #6c757d;
  font-weight: 400;
}

.auth-link-muted a:hover {
  color: #C22128;
}

/* Resend section (MFA) */
.resend-section {
  text-align: center;
  margin-top: 20px;
}

.resend-section .resend-text {
  color: #6c757d;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.resend-section .btn-resend {
  background: none;
  border: none;
  color: #C22128;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: underline;
}

.resend-section .btn-resend:hover {
  color: #9B1A20;
}

/* Timer (MFA) */
.timer-info {
  text-align: center;
  margin-top: 12px;
  font-size: 0.78rem;
  color: #adb5bd;
}

.timer-info i { margin-right: 4px; }


/* ====== FOOTER ====== */
.auth-footer {
  margin-top: 40px;
  text-align: center;
  color: #b8bdc5;
  font-size: 0.78rem;
  letter-spacing: 0.2px;
}

.auth-footer p {
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}


/* ====== ALERTES ====== */
.alert-auth {
  border-radius: 10px;
  font-size: 0.88rem;
  padding: 12px 16px;
  margin-bottom: 20px;
}


/* ====== SELECT2 (Register) ====== */
.auth-form-wrapper .select2-container .select2-selection--single {
  height: 44px !important;
  border-radius: 10px !important;
  border: 1.5px solid #dee2e6 !important;
  padding: 6px 14px;
}

.auth-form-wrapper .select2-container .select2-selection__rendered {
  line-height: 30px !important;
}

.auth-form-wrapper .select2-container .select2-selection__arrow {
  height: 42px !important;
}


/* ====== LOADING ====== */
#loading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #fff;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ====== STAGGER ANIMATION for features ====== */
.brand-features .feature:nth-child(1) { animation: fadeSlideIn 0.5s ease-out 0.1s both; }
.brand-features .feature:nth-child(2) { animation: fadeSlideIn 0.5s ease-out 0.2s both; }
.brand-features .feature:nth-child(3) { animation: fadeSlideIn 0.5s ease-out 0.3s both; }
.brand-features .feature:nth-child(4) { animation: fadeSlideIn 0.5s ease-out 0.4s both; }
.brand-features .feature:nth-child(5) { animation: fadeSlideIn 0.5s ease-out 0.5s both; }

/* Form groups stagger */
.auth-form-wrapper .form-group:nth-child(1) { animation: fadeSlideIn 0.4s ease-out 0.15s both; }
.auth-form-wrapper .form-group:nth-child(2) { animation: fadeSlideIn 0.4s ease-out 0.25s both; }
.auth-form-wrapper .btn-auth { animation: fadeSlideIn 0.4s ease-out 0.35s both; }


/* ====== RESPONSIVE ====== */
@media (max-width: 992px) {
  .auth-brand { display: none; }
  .auth-form-panel,
  .auth-form-panel.auth-form-wide {
    width: 100%;
    min-width: auto;
  }
  .auth-form-panel::before { display: none; }
}

@media (max-width: 576px) {
  .auth-form-panel { padding: 30px 24px; }
  .auth-form-wrapper h2 { font-size: 1.3rem; }
  .otp-input { font-size: 1.5rem; letter-spacing: 8px; height: 50px !important; }
}
