/* ==========================================================================
   Application form (modal). Structure and UX follow the reference EN form,
   restyled with EasyDate tokens (see main.css).
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: rgb(32 14 27 / 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.modal.is-open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.3s ease, visibility 0s; }

.modal__dialog {
  position: relative;
  width: min(580px, 100%);
  margin: 24px 0;
  padding: 28px 24px 24px;
  border-radius: 24px;
  background: #fff;
  color: var(--primary-text);
  box-shadow: 0 24px 80px rgb(32 14 27 / 0.28), 0 8px 24px rgb(32 14 27 / 0.14);
  transform: translateY(24px) scale(0.985);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}
.modal.is-open .modal__dialog { transform: none; opacity: 1; }

.modal__close {
  position: absolute;
  top: 8px; right: 8px;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.modal__close:hover { background: rgb(26 25 28 / 0.06); }
.modal__close::before, .modal__close::after {
  content: "";
  position: absolute;
  left: 13px; top: 21px;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: var(--primary-text);
}
.modal__close::before { transform: rotate(45deg); }
.modal__close::after { transform: rotate(-45deg); }

.form { display: flex; flex-direction: column; gap: 18px; }
.form[hidden], .form__success[hidden] { display: none; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field--group { margin: 0; padding: 0; border: 0; }
.field--group > .field__label { padding: 0; margin-bottom: 8px; }
.field__label { font-size: 14px; font-weight: 700; color: var(--primary-text); }
.field__hint { font-weight: 400; color: rgb(26 25 28 / 0.6); }
.field__error { min-height: 0; font-size: 13px; line-height: 1.4; color: #c4162f; }
.field__error:empty { display: none; }

.input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: #f7f3f5;
  color: var(--primary-text);
  font: inherit;
  font-size: 17px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.input::placeholder { color: #8d8590; }
.input:focus { border-color: var(--main-color); background: #fff; box-shadow: 0 0 0 5px rgb(232 86 119 / 0.16); }
.input[aria-invalid="true"] { border-color: #c4162f; box-shadow: 0 0 0 5px rgb(196 22 47 / 0.12); }

/* phone row + listbox */
.phone-row { display: flex; gap: 10px; align-items: stretch; }
.phone-row .input { flex: 1 1 auto; min-width: 0; }

.listbox { position: relative; }
.listbox__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 0 38px 0 14px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: #f7f3f5;
  color: var(--primary-text);
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.listbox__trigger::after {
  content: "";
  position: absolute;
  right: 15px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--main-color-ink);
  border-bottom: 2px solid var(--main-color-ink);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.18s ease;
  pointer-events: none;
}
.listbox.is-open .listbox__trigger { border-color: var(--main-color); background: #fff; box-shadow: 0 0 0 5px rgb(232 86 119 / 0.16); }
.listbox.is-open .listbox__trigger::after { transform: translateY(-30%) rotate(225deg); }
.listbox__trigger:focus-visible { outline: none; border-color: var(--main-color); box-shadow: 0 0 0 5px rgb(232 86 119 / 0.16); }

.listbox--country { flex: 0 0 auto; }
.listbox--country .listbox__trigger { width: auto; min-width: 118px; }
.listbox__dial { font-weight: 700; }

.listbox__list {
  position: absolute;
  left: 0; top: calc(100% + 8px);
  z-index: 30;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  max-height: 260px;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 40px rgb(32 14 27 / 0.18), 0 6px 16px rgb(32 14 27 / 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.99);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}
.listbox.is-open .listbox__list { opacity: 1; visibility: visible; transform: none; transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s; }
.listbox__option {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}
.listbox__list--plain .listbox__option { grid-template-columns: 1fr; }
.listbox__option[aria-selected="true"] { background: rgb(232 86 119 / 0.12); font-weight: 700; }
.listbox__option.is-active, .listbox__option:hover { background: rgb(232 86 119 / 0.16); }
.listbox__name { white-space: nowrap; }
.listbox__code { font-weight: 700; color: var(--main-color-ink); }

.flag { width: 24px; height: 18px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgb(26 25 28 / 0.12); object-fit: cover; }

/* radios */
.radio-group { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.radio {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 16px 0 12px;
  border-radius: 14px;
  background: #f7f3f5;
  cursor: pointer;
}
.radio input { width: 20px; height: 20px; margin: 0; accent-color: var(--main-color-ink); cursor: pointer; }
.radio:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--main-color); background: #fff; }
.radio:has(input:focus-visible) { outline: 3px solid var(--main-color); outline-offset: 2px; }

/* honeypot: off-screen, not display:none (bots fill it) */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__submit { position: relative; margin-top: 4px; width: 100%; min-height: 56px; }
.form__submit[disabled] { cursor: progress; background: var(--main-color-ink); opacity: 0.85; }
.form__submit .spinner { display: none; width: 20px; height: 20px; border: 3px solid rgb(255 255 255 / 0.45); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.form__submit.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.form__alert {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fdecef;
  color: #9d1328;
  font-size: 14px;
}
.form__alert[hidden] { display: none; }
.form__privacy { font-size: 13px; line-height: 1.45; text-align: center; color: rgb(26 25 28 / 0.65); }
.form__privacy a { color: var(--main-color-ink); }

.form__success { padding: 36px 8px 20px; text-align: center; }
.form__success-icon {
  display: grid; place-items: center;
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--main-color);
}
.form__success-icon::after { content: ""; width: 14px; height: 26px; margin-top: -4px; border: solid #fff; border-width: 0 4px 4px 0; transform: rotate(45deg); }
.form__success-title { font-size: 24px; font-weight: 500; line-height: 1.2; }
.form__success-text { margin-top: 8px; color: rgb(26 25 28 / 0.7); }
.form__success .btn { margin-top: 24px; }
