/**
 * @file
 * Formulaires globaux — select, checkbox, radio, états error/disabled.
 * Les bases (input text/email/textarea, labels, .form-item) sont dans block.css.
 */

/* ============================================================
   Select — flèche custom
   ============================================================ */
select,
.form-select {
  display: block;
  width: 100%;
  font-family: var(--dvd-sans);
  font-size: 0.9375rem;
  color: var(--dvd-ink);
  background-color: var(--dvd-paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a736b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 12px 8px;
  border: 1px solid var(--dvd-border);
  border-radius: var(--dvd-r-sm);
  padding: 0.625rem 2.25rem 0.625rem 0.875rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease;
  outline: none;
}
select:focus,
.form-select:focus {
  border-color: var(--dvd-sage);
  box-shadow: 0 0 0 3px rgba(44, 62, 99, 0.12);
  outline: 0;
}
select[multiple],
.form-select[multiple] {
  background-image: none;
  padding-right: 0.875rem;
}

/* ============================================================
   Checkbox custom
   ============================================================ */
.form-check-input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid var(--dvd-border);
  border-radius: 4px;
  background-color: var(--dvd-paper);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 9px;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
  vertical-align: middle;
  margin-top: 0;
}
.form-check-input[type="checkbox"]:checked {
  background-color: var(--dvd-sage);
  border-color: var(--dvd-sage);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='9' viewBox='0 0 11 9'%3E%3Cpath d='M1 4.5l3 3 6-7' stroke='%23faf6ee' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.form-check-input[type="checkbox"]:focus {
  border-color: var(--dvd-sage);
  box-shadow: 0 0 0 3px rgba(44, 62, 99, 0.12);
  outline: 0;
}
.form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--dvd-sage);
  border-color: var(--dvd-sage);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='2' viewBox='0 0 10 2'%3E%3Cpath d='M1 1h8' stroke='%23faf6ee' stroke-width='1.75' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ============================================================
   Radio custom
   ============================================================ */
.form-check-input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid var(--dvd-border);
  border-radius: 50%;
  background-color: var(--dvd-paper);
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
  vertical-align: middle;
  margin-top: 0;
  position: relative;
}
.form-check-input[type="radio"]:checked {
  border-color: var(--dvd-sage);
  background-color: var(--dvd-paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Ccircle cx='4' cy='4' r='3' fill='%232c3e63'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 8px 8px;
}
.form-check-input[type="radio"]:focus {
  border-color: var(--dvd-sage);
  box-shadow: 0 0 0 3px rgba(44, 62, 99, 0.12);
  outline: 0;
}

/* ============================================================
   Label du form-check (le texte à côté du checkbox/radio)
   ============================================================ */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 0;
  cursor: pointer;
}
.form-check .form-check-input {
  flex-shrink: 0;
}
.form-check-label {
  font-family: var(--dvd-sans);
  font-size: 0.9375rem;
  color: var(--dvd-ink);
  cursor: pointer;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* ============================================================
   États erreur / invalide
   ============================================================ */
.form-item--error input,
.form-item--error textarea,
.form-item--error select,
.is-invalid,
input.error,
textarea.error,
select.error {
  border-color: var(--dvd-brick) !important;
}
.form-item--error input:focus,
.form-item--error textarea:focus,
.form-item--error select:focus,
.is-invalid:focus {
  border-color: var(--dvd-brick) !important;
  box-shadow: 0 0 0 3px rgba(176, 90, 61, 0.12) !important;
}
.form-item--error .form-check-input[type="checkbox"],
.form-item--error .form-check-input[type="radio"] {
  border-color: var(--dvd-brick);
}
.form-item__error-message,
.form-item .error,
.invalid-feedback,
.field-validation-error {
  display: block;
  font-family: var(--dvd-sans);
  font-size: 0.75rem;
  color: var(--dvd-brick);
  margin-top: 0.25rem;
  font-weight: 500;
}

/* ============================================================
   État désactivé
   ============================================================ */
input[disabled],
textarea[disabled],
select[disabled],
.form-control[disabled],
.form-select[disabled],
input[readonly],
textarea[readonly] {
  opacity: .55;
  cursor: not-allowed;
  background-color: var(--dvd-paper-2);
}

/* ============================================================
   Input file
   ============================================================ */
input[type="file"] {
  display: block;
  width: 100%;
  font-family: var(--dvd-sans);
  font-size: 0.875rem;
  color: var(--dvd-muted);
  padding: 0.5rem 0;
  border: 0;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  font-family: var(--dvd-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--dvd-paper-2);
  color: var(--dvd-ink);
  border: 1px solid var(--dvd-border);
  border-radius: var(--dvd-r-sm);
  padding: 0.375rem 0.875rem;
  margin-right: 0.75rem;
  cursor: pointer;
  transition: background .2s ease;
}
input[type="file"]::file-selector-button:hover {
  background: var(--dvd-paper-3);
}

/* ============================================================
   Input range
   ============================================================ */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--dvd-paper-3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--dvd-sage);
  border: 2px solid var(--dvd-paper);
  box-shadow: 0 0 0 1px var(--dvd-sage);
  cursor: pointer;
  transition: box-shadow .2s ease;
}
input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(44, 62, 99, 0.2);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--dvd-sage);
  border: 2px solid var(--dvd-paper);
  box-shadow: 0 0 0 1px var(--dvd-sage);
  cursor: pointer;
}

/* ============================================================
   Drupal exposed filters — select dans .views-exposed-form
   ============================================================ */
.views-exposed-form select,
.bef-exposed-form select {
  min-width: 160px;
}
