/* ============================================================
   ADC Facturation — Styles authentification
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #021791;
  --primary-light: #02234a;
  --accent:        #ff416a;
  --accent-hover:  #e02d57;
  --text:          #02234a;
  --text-muted:    #6b7280;
  --border:        #e5e7eb;
  --bg:            #fffef7;
  --card:          #ffffff;
  --input-bg:      #f3f4f6;
  --input-focus:   #ffffff;
  --error:         #ff416a;
  --success:       #10b981;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(2,23,145,.08);
  --shadow-lg:     0 8px 40px rgba(2,23,145,.14);
  --transition:    .2s ease;
}

[data-theme="dark"] {
  --text:       #fffef7;
  --text-muted: #9db4c8;
  --border:     #0a3060;
  --bg:         #010c1e;
  --card:       #02234a;
  --input-bg:   #021560;
  --input-focus:#032a5a;
  --shadow:     0 4px 24px rgba(0,0,0,.45);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.55);
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  transition: background var(--transition), color var(--transition);
}

/* ---- Fond décoratif ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% -5%, rgba(255,65,106,.14) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 85% 105%, rgba(2,23,145,.15) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(239,188,7,.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Carte ---- */
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  border: 1px solid var(--border);
}

/* ---- Logo / Brand ---- */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.brand-logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #ff416a 0%, #efbc07 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(255,65,106,.4);
}

.brand-logo svg { width: 28px; height: 28px; fill: #fff; }

.brand-name {
  font-size: 1.4375rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -.02em;
}

[data-theme="dark"] .brand-name { color: var(--text); }

.brand-tagline {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ---- Titre de page ---- */
.auth-title {
  font-size: 1.4375rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .375rem;
}

.auth-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* ---- Formulaire ---- */
.form-group {
  margin-bottom: 1.125rem;
}

label {
  display: block;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: .375rem;
  letter-spacing: .01em;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1.125rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

input:focus {
  border-color: var(--accent);
  background: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(233,69,96,.12);
}

input.is-error { border-color: var(--error); }

/* Champ mot de passe avec toggle */
.input-wrapper {
  position: relative;
}

.input-wrapper input { padding-right: 3rem; }

.toggle-pwd {
  position: absolute;
  right: .875rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  display: flex;
  transition: color var(--transition);
}

.toggle-pwd:hover { color: var(--accent); }

/* ---- Bouton principal ---- */
.btn-primary {
  width: 100%;
  padding: .875rem 1.5rem;
  background: linear-gradient(135deg, #021791 0%, #ff416a 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--transition), transform var(--transition), box-shadow var(--transition);
  margin-top: .5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(255,65,106,.4);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 6px 22px rgba(255,65,106,.55);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) { transform: scale(.98); }

.btn-primary:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* Spinner dans le bouton */
.btn-primary .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}

.btn-primary.loading .btn-text { display: none; }
.btn-primary.loading .spinner { display: block; }

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

/* ---- Messages d'alerte ---- */
.alert {
  display: none;
  padding: .875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.alert.show { display: block; }

.alert-error {
  background: rgba(233,69,96,.1);
  color: #be123c;
  border: 1px solid rgba(233,69,96,.2);
}

[data-theme="dark"] .alert-error { color: #fb7185; }

.alert-success {
  background: rgba(16,185,129,.1);
  color: #065f46;
  border: 1px solid rgba(16,185,129,.2);
}

[data-theme="dark"] .alert-success { color: #6ee7b7; }

/* ---- Liens secondaires ---- */
.auth-links {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 1rem;
  color: var(--text-muted);
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition);
}

.auth-links a:hover { opacity: .75; }

.auth-links .separator {
  margin: .5rem 0;
}

/* ---- Lien "mot de passe oublié" inline ---- */
.forgot-link {
  display: block;
  text-align: right;
  font-size: 1rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: .375rem;
  transition: color var(--transition);
}

.forgot-link:hover { color: var(--accent); }

/* ---- Force du mot de passe ---- */
.pwd-strength {
  margin-top: .5rem;
  display: flex;
  gap: .25rem;
}

.pwd-strength-bar {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: var(--border);
  transition: background var(--transition);
}

.pwd-strength-bar.weak   { background: #ef4444; }
.pwd-strength-bar.medium { background: #f59e0b; }
.pwd-strength-bar.strong { background: #10b981; }

.pwd-strength-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* ---- Divider ---- */
.divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: .8125rem;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Toggle dark mode ---- */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: .5rem .75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .8rem;
  font-family: inherit;
  color: var(--text-muted);
  box-shadow: var(--shadow);
  transition: color var(--transition), background var(--transition);
}

.theme-toggle:hover { color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.25rem;
    border-radius: var(--radius);
  }
}
