/**
 * Styles front basiques pour les formulaires NDM.
 * Volontairement minimaux : juste de quoi être lisible et utilisable
 * sans imposer une identité visuelle au thème.
 */

/* --- Honeypot (toujours caché) -------------------------------------- */
.ndm-form-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* --- Layout général -------------------------------------------------- */
.ndm-form {
  max-width: 100%;
  font-size: 1rem;
  line-height: 1.5;
}

.ndm-form p,
.ndm-form fieldset {
  margin: 0 0 1rem;
}

.ndm-form fieldset {
  border: 1px solid #e5e7eb;
  padding: 0.75rem 1rem;
  border-radius: 4px;
}

.ndm-form legend {
  padding: 0 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

/* --- Labels --------------------------------------------------------- */
.ndm-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: #1f2937;
}

/* Label inline pour case à cocher / radio */
.ndm-form input[type="checkbox"] + *,
.ndm-form input[type="radio"] + *,
.ndm-form label > input[type="checkbox"],
.ndm-form label > input[type="radio"] {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.4rem;
  font-weight: normal;
}

.ndm-form label:has(> input[type="checkbox"]),
.ndm-form label:has(> input[type="radio"]) {
  font-weight: normal;
}

/* --- Champs --------------------------------------------------------- */
.ndm-form input[type="text"],
.ndm-form input[type="email"],
.ndm-form input[type="tel"],
.ndm-form input[type="url"],
.ndm-form input[type="number"],
.ndm-form input[type="date"],
.ndm-form input[type="time"],
.ndm-form input[type="password"],
.ndm-form select,
.ndm-form textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.4;
  color: #1f2937;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-sizing: border-box;
}

.ndm-form textarea {
  min-height: 7rem;
  resize: vertical;
}

.ndm-form input:focus,
.ndm-form select:focus,
.ndm-form textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.ndm-form input[disabled],
.ndm-form select[disabled],
.ndm-form textarea[disabled] {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}

/* --- Bouton submit -------------------------------------------------- */
.ndm-form button[type="submit"],
.ndm-form input[type="submit"] {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
  background: #1f2937;
  border: 1px solid #1f2937;
  border-radius: 4px;
  cursor: pointer;
}

.ndm-form button[type="submit"]:hover,
.ndm-form input[type="submit"]:hover {
  background: #111827;
  border-color: #111827;
}

.ndm-form button[type="submit"]:focus,
.ndm-form input[type="submit"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(31, 41, 55, 0.25);
}

/* --- État pendant l'envoi ------------------------------------------- */
.ndm-form.is-submitting {
  opacity: 0.7;
  pointer-events: none;
}

.ndm-form.is-submitting button[type="submit"],
.ndm-form.is-submitting input[type="submit"] {
  cursor: progress;
}

/* --- Feedback succès / erreur --------------------------------------- */
.ndm-form-feedback {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.ndm-form-feedback[hidden] {
  display: none;
}

.ndm-form-feedback.is-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.ndm-form-feedback.is-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.ndm-form-feedback.is-pending {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}

/* --- État erreur par champ ------------------------------------------ */
.ndm-form [aria-invalid="true"] {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px #dc2626;
}

.ndm-form .ndm-form-error {
  display: block;
  margin-top: 0.25rem;
  color: #dc2626;
  font-size: 0.875rem;
}

.ndm-form .ndm-form-error[hidden] {
  display: none;
}
