/**
 * Vallon — contraste formulaires (tous champs, tous thèmes)
 * Plus de zone blanche : fond teinté + texte toujours lisible
 * (mots de passe, select, textarea, contenteditable).
 */
:root {
  --vallon-field-bg: #d8e2ef;
  --vallon-field-bg-focus: #c9d7ea;
  --vallon-field-fg: #0b1220;
  --vallon-field-border: #64748b;
  --vallon-field-placeholder: #475569;
  --vallon-field-caret: #0b1220;
}

html[data-theme="dark"],
html.dark,
body.theme-dark {
  --vallon-field-bg: #1e293b;
  --vallon-field-bg-focus: #273449;
  --vallon-field-fg: #f8fafc;
  --vallon-field-border: #64748b;
  --vallon-field-placeholder: #94a3b8;
  --vallon-field-caret: #f8fafc;
}

/* Apps toujours sombres (fond body très sombre sans data-theme) */
body[style*="background"] input:not([type]),
:root:not([data-theme="light"]) {
  /* variables déjà définies ci-dessus en clair par défaut */
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="color"]):not([type="hidden"]),
select,
textarea,
[contenteditable="true"],
.vp-input,
.vp-select,
.vp-textarea,
.form-group input,
.form-group select,
.form-group textarea,
.login-box input,
.login-card input,
.auth-form-panel input,
.auth-form-panel select,
.auth-form-panel textarea,
.bc-poste-form input,
.bc-poste-form select,
.bc-poste-form textarea,
.bc-gen-pu-input,
.bc-lot-select,
.bc-gen-lot select,
.line-title-input,
.line-desc-input,
.quote-code-input,
.bc-gen-quote-table .line-title-input,
.bc-gen-quote-table .line-desc-input,
.bc-gen-quote-table .quote-code-input,
.bc-general-devis .line-title-input,
.bc-general-devis .line-desc-input,
.bc-gen-qe-table .line-desc-input,
.quote-lines-table input,
.quote-lines-table select,
.quote-lines-table textarea,
.quote-lines-table .line-title-input,
.quote-lines-table .line-desc-input,
.facture-lines-editor input,
.facture-lines-editor select,
.facture-lines-editor textarea {
  background: var(--vallon-field-bg) !important;
  background-color: var(--vallon-field-bg) !important;
  color: var(--vallon-field-fg) !important;
  -webkit-text-fill-color: var(--vallon-field-fg) !important;
  caret-color: var(--vallon-field-caret) !important;
  border-color: var(--vallon-field-border) !important;
  opacity: 1 !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="color"]):not([type="hidden"]):focus,
select:focus,
textarea:focus,
[contenteditable="true"]:focus,
.vp-input:focus,
.vp-select:focus,
.vp-textarea:focus {
  background: var(--vallon-field-bg-focus) !important;
  background-color: var(--vallon-field-bg-focus) !important;
  color: var(--vallon-field-fg) !important;
  -webkit-text-fill-color: var(--vallon-field-fg) !important;
  border-color: #b91c3c !important;
  outline: none;
}

/* Placeholders lisibles (jamais blanc sur blanc) */
input::placeholder,
textarea::placeholder,
.vp-input::placeholder,
.vp-textarea::placeholder {
  color: var(--vallon-field-placeholder) !important;
  -webkit-text-fill-color: var(--vallon-field-placeholder) !important;
  opacity: 1 !important;
}

/* Mot de passe : points / caractères toujours contrastés */
input[type="password"],
input[type="password"]:focus,
input[type="password"]:hover,
input[type="password"]:active,
input[type="password"]:-webkit-autofill,
input[type="password"]:-webkit-autofill:hover,
input[type="password"]:-webkit-autofill:focus {
  background: var(--vallon-field-bg) !important;
  background-color: var(--vallon-field-bg) !important;
  color: var(--vallon-field-fg) !important;
  -webkit-text-fill-color: var(--vallon-field-fg) !important;
  caret-color: var(--vallon-field-caret) !important;
}

/* Autofill navigateur (évite fond jaune/blanc + texte fantôme) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--vallon-field-fg) !important;
  caret-color: var(--vallon-field-caret) !important;
  box-shadow: 0 0 0 1000px var(--vallon-field-bg) inset !important;
  transition: background-color 99999s ease-out 0s;
}

/* Options des listes déroulantes */
select option,
.bc-lot-select option {
  background: var(--vallon-field-bg) !important;
  color: var(--vallon-field-fg) !important;
}

/* Disabled : encore lisible */
input:disabled,
select:disabled,
textarea:disabled {
  background: color-mix(in srgb, var(--vallon-field-bg) 70%, #94a3b8) !important;
  color: var(--vallon-field-fg) !important;
  -webkit-text-fill-color: var(--vallon-field-fg) !important;
  opacity: 0.85 !important;
}

/* Ne pas casser checkboxes / radios / range */
input[type="checkbox"],
input[type="radio"] {
  background: initial !important;
  background-color: initial !important;
  -webkit-text-fill-color: initial !important;
  color: initial !important;
  accent-color: #b91c3c;
}
