/**
 * Feedback unificado: errores inline, banner de validación y toasts.
 * Complementa styles.css y portal-create-forms.css.
 */

/* —— Errores bajo campos (global) —— */
.field-error {
  display: flex;
  align-items: flex-start;
  gap: 0.42rem;
  margin-top: 0.42rem;
  padding: 0.46rem 0.62rem;
  border-radius: 9px;
  background: color-mix(in srgb, #d64545 7%, #fff);
  border: 1px solid color-mix(in srgb, #d64545 22%, transparent);
  color: #b42323;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.005em;
}

.field-error::before {
  content: "!";
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-top: 0.06rem;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.antares-create-form .field-error--portal {
  /* Hereda el estilo global; mantiene compatibilidad con reglas del módulo de alta. */
}

/* —— Banner de validación (formularios y modales) —— */
.antares-form-validation-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.88rem 1rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, #d64545 32%, transparent);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, #d64545 9%, #fff) 0%,
    color-mix(in srgb, #d64545 4%, #fff) 100%
  );
  box-shadow: 0 10px 24px rgba(214, 69, 69, 0.08);
  color: #7f1d1d;
}

.antares-form-validation-alert.hidden {
  display: none !important;
}

.antares-form-validation-alert__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-top: 0.05rem;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(214, 69, 69, 0.28);
}

.antares-form-validation-alert__copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.antares-form-validation-alert__title {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #991b1b;
}

.antares-form-validation-alert__text {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  color: #b42323;
}

#crud-modal .antares-form-validation-alert {
  margin-top: 0.25rem;
}

.modal-reason-field .field-error {
  margin-top: 0.35rem;
}

/* —— Toasts: refresco al deduplicar —— */
.toast.toast--refresh {
  animation: toast-refresh-bump 0.32s ease;
}

@keyframes toast-refresh-bump {
  0% {
    transform: translateX(0) scale(1);
  }
  40% {
    transform: translateX(-2px) scale(1.015);
  }
  100% {
    transform: translateX(0) scale(1);
  }
}

.toast-container {
  gap: 0.65rem;
}

.toast-error {
  border-color: color-mix(in srgb, #d64545 28%, transparent);
}

.toast-error .toast-title {
  color: #991b1b;
}

/* —— Tema oscuro —— */
body[data-theme="dark"] .field-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

body[data-theme="dark"] .field-error::before {
  background: #ef4444;
}

body[data-theme="dark"] .antares-form-validation-alert {
  border-color: rgba(248, 113, 113, 0.38);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.16) 0%, rgba(127, 29, 29, 0.22) 100%);
  color: #fecaca;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .antares-form-validation-alert__title {
  color: #fecaca;
}

body[data-theme="dark"] .antares-form-validation-alert__text {
  color: #fca5a5;
}

body[data-theme="dark"] .antares-form-validation-alert__icon {
  background: #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}
