/* motdepasse.dev — patch
   - Corrige le débordement du champ mot de passe
   - Ajoute un thème clair / sombre (toggle + variables)
*/

/* =====================
   Thème clair / sombre
   ===================== */

:root {
  /* Palette (par défaut = sombre) */
  --bg: #0b0c10;
  --surface: #141824;
  --surface-2: rgba(255, 255, 255, 0.06);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  --input-bg: rgba(255, 255, 255, 0.04);
  --input-border: rgba(255, 255, 255, 0.12);
  --toast-bg: rgba(20, 24, 36, 0.98);
  --accent: #3b82f6;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: rgba(11, 18, 32, 0.06);
  --text: rgba(11, 18, 32, 0.92);
  --muted: rgba(11, 18, 32, 0.68);
  --border: rgba(11, 18, 32, 0.14);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.12);
  --input-bg: rgba(11, 18, 32, 0.04);
  --input-border: rgba(11, 18, 32, 0.14);
  --toast-bg: rgba(255, 255, 255, 0.98);
}

/* Fond & texte */
body {
  background: var(--bg) !important;
  color: var(--text) !important;
}

/* Liens */
a {
  color: inherit;
  text-decoration-color: var(--border);
}

a:hover {
  text-decoration-color: currentColor;
}

/* Surfaces principales */
.card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}

/* Texte secondaire */
.hint,
.brand-subtitle {
  color: var(--muted) !important;
}

/* Pilule longueur */
.pill {
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

/* Inputs */
input,
button {
  color: var(--text) !important;
}

input[type="text"],
input[type="number"],
textarea {
  background: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
}

input[type="checkbox"],
input[type="range"] {
  accent-color: var(--accent);
}

/* Boutons (harmonisation light/dark sans dépendre de la CSS buildée) */
.card button {
  border: 1px solid var(--border) !important;
}

.card button:not(.secondary) {
  background: var(--surface-2) !important;
}

.card button.secondary {
  background: transparent !important;
}

/* Toast */
.toast {
  background: var(--toast-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

/* =====================
   Bouton toggle thème
   ===================== */

.brand {
  /* s'assure que le bouton peut se placer à droite sans casser la mise en page */
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.theme-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.theme-toggle__icon {
  line-height: 1;
}

@media (max-width: 520px) {
  .theme-toggle {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

/* =====================
   Fix overflow (password)
   ===================== */

.output {
  min-width: 0;
}

.output #password {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
