/* ============================================================
   Auditas — Form
   ============================================================ */
.form {
  position: relative;
  background: linear-gradient(132.62923291558644deg, var(--gray10) 3.147%, var(--gray20) 94.664%);
  overflow: hidden;
  isolation: isolate;
}
.form__deco { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.form__deco img { position: absolute; left: 0; top: 60px; width: 100%; height: auto; min-height: 100%; object-fit: cover; opacity: 0.9; }

.form__wrap {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding-block: clamp(56px, 7vw, 80px);
}

/* ---- Tarjeta ---- */
.form-card {
  width: 624px;
  max-width: 100%;
  background: var(--whitef);
  border-top: 10px solid var(--seyedit);
  border-radius: 16px;
  box-shadow: 8px 8px 4px 0 rgba(160, 165, 163, 0.25);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-32);
}

.form-card__title { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-4); }
.form-card__heading { font-family: var(--font-title); font-weight: var(--fw-bold); font-size: var(--fs-h2); color: var(--blackdit); }
.form-card__subtitle { font-family: var(--font-body); font-size: 18px; color: var(--black80); line-height: 1.35; max-width: 433px; }

.form-card__fields { display: flex; flex-direction: column; gap: var(--sp-20); width: 100%; }

/* ---- Campos ---- */
.field { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-8); width: 100%; }
.field__label { font-family: var(--font-body); font-weight: var(--fw-bold); font-size: var(--fs-mini); color: var(--blackdit); line-height: 1.35; }
.field__input {
  width: 100%;
  border: 1px solid var(--gray70);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--blackdit);
  background: var(--whitef);
  line-height: 1.35;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
  appearance: none;
}
.field__input::placeholder { color: var(--gray40); }
.field__input:focus { outline: none; border-color: var(--yelludit); box-shadow: 0 0 0 3px rgba(255, 179, 0, 0.18); }
.field__textarea { min-height: 95px; resize: vertical; }

/* ---- Dropdowns personalizados (indicativo de país + servicio) ----
   El menú abre DEBAJO del control (no montado encima como el <select> nativo). */
.phone-row { display: flex; gap: 10px; width: 100%; }
.phone-row .field__input { flex: 1; min-width: 0; }

.dd { position: relative; }
.dd--full { width: 100%; }
.dd__btn {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  border: 1px solid var(--gray70);
  border-radius: 8px;
  background: var(--whitef);
  padding: 16px 14px;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--blackdit);
  line-height: 1.35;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.dd__btn:focus-visible, .dd.is-open .dd__btn {
  outline: none;
  border-color: var(--yelludit);
  box-shadow: 0 0 0 3px rgba(255, 179, 0, 0.18);
}
.dd--full .dd__btn { width: 100%; justify-content: space-between; }
.dd__text.is-placeholder { color: var(--gray40); }
.dd__flag { font-size: 18px; line-height: 1; }
.dd__dial { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dd__chev {
  width: 18px; height: 18px; flex: none;
  transform: rotate(-90deg); /* chevron base apunta a la izquierda → abajo */
  transition: transform var(--t-med) var(--ease-out);
}
.dd.is-open .dd__chev { transform: rotate(90deg); } /* abierto → arriba */

.dd__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 100%;
  background: var(--whitef);
  border: 1px solid var(--gray30);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(25, 26, 33, 0.18);
  overflow: hidden;
  animation: dd-in 0.16s var(--ease-out);
}
.dd__menu[hidden] { display: none; }
.dd--full .dd__menu { right: 0; }
[data-dd="cc"] .dd__menu { width: min(320px, 86vw); }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.dd__search {
  width: calc(100% - 20px);
  margin: 10px 10px 6px;
  padding: 10px 12px;
  border: 1px solid var(--gray30);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--blackdit);
}
.dd__search:focus { outline: none; border-color: var(--yelludit); }

.dd__list { max-height: 260px; overflow-y: auto; padding: 4px 0 8px; margin: 0; list-style: none; }
.dd__list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--blackdit);
  white-space: nowrap;
}
.dd__list li:hover { background: var(--gray10); }
.dd__list li.is-selected { background: rgba(255, 179, 0, 0.12); font-weight: 700; }
.dd__list .dd__name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.dd__list .dd__code { color: var(--gray60); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Estado inválido */
.field.is-invalid .field__input { border-color: #e2452f; box-shadow: 0 0 0 3px rgba(226, 69, 47, 0.14); }
.field__error { font-family: var(--font-body); font-size: 12px; color: #e2452f; min-height: 0; display: none; }
.field.is-invalid .field__error { display: block; }

/* ---- Honeypot anti-spam (invisible para personas, presente para bots) ---- */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Bloque legal ---- */
.form-legal { display: flex; flex-direction: column; gap: var(--sp-8); width: 100%; }
.form-legal__auth { display: flex; align-items: flex-start; gap: var(--sp-8); cursor: pointer; }
.form-legal__checkbox { position: absolute; opacity: 0; width: 0; height: 0; }
.form-legal__box {
  flex: none;
  width: 24px; height: 24px;
  border: 2px solid var(--gray70);
  border-radius: 5px;
  background: var(--whitef);
  box-shadow: 1px 2px 2px 0 rgba(67, 74, 76, 0.10);
  position: relative;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
  margin-top: 1px;
}
.form-legal__box::after {
  content: "";
  position: absolute;
  left: 7px; top: 3px;
  width: 6px; height: 11px;
  border: solid var(--blackdit);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--t-fast) var(--ease-spring);
}
.form-legal__checkbox:checked + .form-legal__box { background: var(--yelludit); border-color: var(--yelludit); }
.form-legal__checkbox:checked + .form-legal__box::after { transform: rotate(45deg) scale(1); }
.form-legal__checkbox:focus-visible + .form-legal__box { outline: 3px solid var(--infodit); outline-offset: 2px; }
.form-legal__text { font-family: var(--font-body); font-size: var(--fs-body); color: var(--blackdit); line-height: 1.35; }
.form-legal__text a { color: var(--infodit); }
.form-legal__text a:hover { text-decoration: underline; }
.form-legal__trust { display: flex; align-items: center; gap: var(--sp-4); font-family: var(--font-body); font-size: var(--fs-mini); color: var(--blackf); line-height: 1.35; }
.form-legal__info { width: 16px; height: 16px; flex: none; }
.form-legal__jcc { color: var(--blackf); text-decoration: underline; }

/* ---- Botón ---- */
.form-boton {
  position: relative;
  width: 100%;
  min-height: 60px;
  background: var(--yelludit);
  border: 2px solid var(--grayudit);
  border-radius: var(--r-s);
  box-shadow: 4px 4px 2px 0 rgba(160, 165, 163, 0.30);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out), opacity var(--t-med);
}
.form-boton__content { display: inline-flex; align-items: center; gap: var(--sp-4); transition: opacity var(--t-fast); }
.form-boton__icon { width: 24px; height: 24px; }
.form-boton__label { font-family: var(--font-title); font-weight: var(--fw-bold); font-size: var(--fs-h3); color: var(--blackdit); white-space: nowrap; }
.form-boton:not(:disabled):hover { background: var(--yelludit60); transform: translateY(-2px); box-shadow: 6px 8px 10px rgba(160, 165, 163, 0.4); }
.form-boton:not(:disabled):active { transform: translateY(0) scale(0.99); }
.form-boton:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

/* Estado cargando */
.form-boton__spinner {
  position: absolute;
  width: 24px; height: 24px;
  border: 3px solid rgba(36, 43, 46, 0.25);
  border-top-color: var(--blackdit);
  border-radius: 50%;
  opacity: 0;
  animation: form-spin 0.7s linear infinite;
}
.form-boton.is-loading .form-boton__content { opacity: 0; }
.form-boton.is-loading .form-boton__spinner { opacity: 1; }
@keyframes form-spin { to { transform: rotate(360deg); } }

/* Microanimación de éxito (pulso) */
.form-boton.is-success { background: var(--yelludit); animation: form-pop 0.45s var(--ease-spring); }
@keyframes form-pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }

/* ---- Modal ---- */
.form-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.form-modal[hidden] { display: none; }
.form-modal__backdrop { position: absolute; inset: 0; background: rgba(19, 18, 23, 0.6); backdrop-filter: blur(2px); animation: fade-in 0.25s var(--ease-out); }
.form-modal__card {
  position: relative;
  width: 420px; max-width: 100%;
  background: var(--whitef);
  border-top: 8px solid var(--seyedit);
  border-radius: 16px;
  box-shadow: var(--sh-l);
  padding: 36px 32px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-12);
  animation: modal-in 0.32s var(--ease-spring);
}
.form-modal__icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--yelludit);
  color: var(--blackdit);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 700;
}
.form-modal__card.is-error .form-modal__icon { background: #e2452f; color: #fff; }
.form-modal__card.is-error { border-top-color: #e2452f; }
.form-modal__title { font-family: var(--font-title); font-weight: var(--fw-bold); font-size: 24px; color: var(--blackdit); }
.form-modal__text { font-family: var(--font-body); font-size: var(--fs-body); color: var(--gray70); line-height: 1.4; }
.form-modal__btn {
  margin-top: var(--sp-8);
  background: var(--yelludit);
  color: var(--blackdit);
  font-family: var(--font-title);
  font-weight: var(--fw-bold);
  font-size: 16px;
  padding: 12px 32px;
  border-radius: var(--r-s);
  box-shadow: var(--sh-s);
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-med);
}
.form-modal__btn:hover { background: var(--yelludit60); transform: translateY(-2px); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .form-card { padding: 28px 20px; gap: var(--sp-24); }
}
@media (prefers-reduced-motion: reduce) {
  .form-boton__spinner { animation-duration: 0.9s; }
  .form-modal__backdrop, .form-modal__card, .form-boton.is-success { animation: none; }
}
