/* ============================================================================
   DESIGN TOKENS — auth (light + dark)
   ============================================================================
   Ces pages ne chargent pas style.css : on definit ici un sous-ensemble de
   tokens (memes noms que le socle quand ca correspond) + tokens auth-specifiques.
   theme-toggle.js pose data-theme="dark" sur <html>. Le gradient violet
   decoratif (#667eea -> #764ba2) reste en dur dans les 2 modes.
   ========================================================================== */
:root {
  /* surfaces */
  --bg-card: #ffffff;
  --bg-main: #f9fafb;
  /* textes */
  --text-primary:   #1f2937;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  /* bordures */
  --border-light: #e5e7eb;
  /* accent auth (violet) */
  --auth-accent: #667eea;
  --focus-ring:  rgba(102, 126, 234, 0.1);
  /* info / indigo */
  --info-light:  #eef2ff;
  --info:        #3730a3;
  --info-border: #c7d2fe;
  /* semantique */
  --danger:         #b91c1c;
  --danger-light:   #fef2f2;
  --danger-border:  #fecaca;
  --warning:        #92400e;
  --warning-light:  #fef3c7;
  --warning-border: #fcd34d;
  --success:        #166534;
  --success-light:  #d1fae5;
  --success-border: #86efac;
  /* ombre carte (valeur .auth-card d'origine, a l'identique) */
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
  color-scheme: light;
}

[data-theme="dark"] {
  /* surfaces (socle dark) */
  --bg-card: #1f2227;
  --bg-main: #16181c;
  /* textes (socle dark) */
  --text-primary:   #e8eaed;
  --text-secondary: #b0b4bb;
  --text-muted:     #8a8f98;
  /* bordures (socle dark) */
  --border-light: #2e333b;
  /* accent auth -- violet plus clair, lisible sur sombre */
  --auth-accent: #9aa8ff;
  --focus-ring:  rgba(154, 168, 255, 0.28);
  /* info -- indigo sombre */
  --info-light:  #1f2545;
  --info:        #b7c0f5;
  --info-border: #38406b;
  /* semantique (socle dark) + bordures sombres subtiles */
  --danger:         #ff6b66;
  --danger-light:   #3a1715;
  --danger-border:  #6b2b28;
  --warning:        #f0b657;
  --warning-light:  #322611;
  --warning-border: #5c4420;
  --success:        #57d97e;
  --success-light:  #16301f;
  --success-border: #2b5236;
  /* ombre carte plus profonde */
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* body : degrade violet vif en clair -> fond sombre uni en dark */
[data-theme="dark"] body { background: var(--bg-main); }

/* ============================================================================
   AUTH PAGES (login + register)
   ========================================================================= */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.auth-container {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-icon {
  font-size: 40px;
  margin-bottom: 12px;
  color: var(--auth-accent);
}

.auth-inline-icon { vertical-align: -0.125em; margin-inline-end: 6px; }

.auth-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.info-box {
  background: var(--info-light);
  border: 1px solid var(--info-border);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  color: var(--info);
  margin-bottom: 20px;
  line-height: 1.5;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  padding: 11px 14px;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  font-size: 14px;
  transition: border 0.15s, box-shadow 0.15s;
  background: var(--bg-main);
}

.form-group input:focus {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--bg-card);
}

.form-group small {
  font-size: 11px;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--auth-accent);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 13px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: 8px;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

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

.error-msg {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--text-muted);
}

/* Phrase de récupération */
.recovery-phrase-box {
  background: var(--bg-main);
  border: 2px dashed var(--info-border);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.phrase-word {
  background: var(--bg-card);
  padding: 8px 10px;
  border-radius: 6px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: 'Consolas', 'Monaco', monospace;
  border: 1px solid var(--border-light);
}

.word-num {
  color: var(--text-muted);
  font-size: 11px;
  min-width: 22px;
}

.word-text {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  word-break: break-all;
}

.recovery-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-light);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: var(--auth-accent);
  color: var(--auth-accent);
}

.warning-strong {
  background: var(--warning-light) !important;
  border-color: var(--warning-border) !important;
  color: var(--warning) !important;
}

.success-box {
  background: var(--success-light) !important;
  border-color: var(--success-border) !important;
  color: var(--success) !important;
}

.link-back {
  color: var(--auth-accent);
  text-decoration: none;
  font-size: 13px;
}
.link-back:hover {
  text-decoration: underline;
}

textarea {
  font-family: 'Consolas', 'Monaco', monospace;
  padding: 11px 14px;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-main);
  resize: vertical;
  width: 100%;
}

textarea:focus {
  outline: none;
  border-color: var(--auth-accent);
  background: var(--bg-card);
}

@media (max-width: 500px) {
  .auth-card {
    padding: 24px 20px;
  }
  .auth-header h1 {
    font-size: 18px;
  }
}
