/* Модалки аккаунта/заявки — карточка 880 по docs/design/lead-auth-modals/ (Task 11) */

:root {
  --iti-path-flags-1x: url("../../img/vendor/intl-tel-input/flags.webp");
  --iti-path-flags-2x: url("../../img/vendor/intl-tel-input/flags@2x.webp");
}

.account-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--acc-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.account-card {
  display: flex;
  width: 880px;
  max-width: 100%;
  max-height: calc(100dvh - 48px);
  border-radius: var(--radius-20);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(36,38,43,.05), 0 18px 44px rgba(36,38,43,.10);
  background: #fff;
}

/* ── Тёмная колонка (десктоп) ── */
.account-dark {
  flex: none;
  width: 392px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  background: var(--acc-dark);
  color: #fff;
}

.account-mobile-head { display: none; } /* только мобилка, см. media-запрос ниже */

.account-dark-header { display: block; }

.account-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--acc-eyebrow);
}

.account-dark-title {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  color: #fff;
}

.account-dark-sub {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--acc-dark-text-muted);
  line-height: 1.4;
}

.account-benefits { display: flex; flex-direction: column; gap: 15px; }
.account-benefits--dark { border-top: 1px solid var(--acc-dark-border); padding-top: 16px; }

.account-benefit { display: flex; gap: 11px; }
.account-benefit-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-benefit-icon svg { width: 15px; height: 15px; }
.account-benefit-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.account-benefit-text { font-size: 13.5px; line-height: 1.4; margin-top: 3px; }

.account-benefit--dark .account-benefit-icon {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: var(--acc-dark-surface);
  border: 1px solid var(--acc-dark-border);
  color: var(--acc-eyebrow);
}
.account-benefit--dark .account-benefit-title { color: #fff; }
.account-benefit--dark .account-benefit-text { color: var(--acc-dark-text-muted); }

.account-spacer { flex: 1; min-height: 8px; }

.account-plate {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--acc-dark-surface);
  border: 1px solid var(--acc-dark-border);
  border-radius: var(--radius-12);
  padding: 11px 13px;
}
.account-plate-price { flex: none; white-space: nowrap; font-size: 17px; font-weight: 800; color: var(--acc-primary); }
.account-plate-text { font-size: 13.5px; line-height: 1.35; color: var(--acc-dark-text-muted); }

/* ── Мобильная карточка «Что вы получаете» — только шаг 1, только мобилка ── */
.account-benefits-mobile {
  display: none;
  flex-direction: column;
  gap: 13px;
  background: var(--acc-neutral-bg);
  border: 1px solid var(--acc-badge-bg);
  border-radius: var(--radius-16);
  padding: 15px 15px 17px;
}
.account-benefits-mobile-eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--acc-text-secondary);
}
.account-benefit--light .account-benefit-icon {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--acc-accent-bg);
  color: var(--acc-accent);
}
.account-benefit--light .account-benefit-title { color: var(--acc-text); }
.account-benefit--light .account-benefit-text { color: var(--acc-text-secondary); margin-top: 2px; }

/* ── Форма ── */
.account-form {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 24px 22px 24px;
  overflow-y: auto;
  background: #fff;
}
/* Форма скроллится, а не ужимается: без этого flex-дети сжимаются под высоту
   контейнера и их содержимое ложится поверх следующего блока (зелёная плашка
   контакта наезжала на первое согласие на мобиле). */
.account-form > * { flex-shrink: 0; }

.account-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--acc-text);
}
.account-sub {
  margin-top: 5px;
  font-size: 16px;
  color: var(--acc-text-secondary);
  line-height: 1.45;
}

.account-fields { display: flex; flex-direction: column; gap: 13px; }
.account-contact-row { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); gap: 11px; }

.account-field,
.account-input-wrap,
.account-input,
.account-input-wrap .iti {
  min-width: 0;
  width: 100%;
}

.account-input-wrap .iti { height: 100%; }

.account-field-label-row { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.account-field-label { font-size: 13.5px; font-weight: 600; color: var(--acc-text-secondary); }
.account-badge {
  font-size: 12px;
  color: var(--acc-placeholder);
  background: var(--acc-badge-bg);
  border-radius: 6px;
  padding: 1px 6px;
}

.account-input-wrap {
  display: flex;
  align-items: center;
  height: 50px;
  background: #fff;
  border: 1px solid var(--acc-field-border);
  border-radius: 13px;
  padding: 0 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.account-input-wrap:focus-within {
  border-color: var(--acc-accent);
  box-shadow: 0 0 0 3px var(--acc-accent-bg);
}
.account-input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
  font-size: 16px; /* ≥16px — иначе iOS зумит форму */
  font-weight: 600;
  color: var(--acc-text);
  padding: 0;
}
.account-input::placeholder { color: var(--acc-placeholder); }

.account-field-error {
  min-height: 17px;
  color: var(--acc-error);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 17px;
  visibility: hidden;
}
.account-field-error.is-visible { visibility: visible; }
/* В узкой двухколоночной строке длинная Telegram-ошибка занимает две строки. */
.account-contact-row .account-field-error { min-height: 34px; }

/* IntlTelInput остаётся частью поля: локальные флаги, Onest и modal-токены. */
.account-input-wrap .iti__selected-country {
  color: var(--acc-text-secondary);
  font-family: var(--font-family);
  border-radius: var(--radius-10);
}
.account-input-wrap .iti__selected-country:focus-visible {
  outline: 2px solid var(--acc-accent);
  outline-offset: -2px;
}
.account-overlay .iti__country-selector,
.iti--detached-country-selector .iti__country-selector {
  z-index: 5;
  overflow: hidden;
  color: var(--acc-text);
  background: #fff;
  border: 1px solid var(--acc-field-border);
  border-radius: var(--radius-12);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-family);
}
.account-overlay .iti__search-input,
.iti--detached-country-selector .iti__search-input {
  color: var(--acc-text);
  background: var(--acc-neutral-bg);
  border: 0;
  border-radius: var(--radius-10);
  font-family: var(--font-family);
  font-size: 16px;
  outline: none;
}
.account-overlay .iti__search-input:focus-visible,
.iti--detached-country-selector .iti__search-input:focus-visible {
  box-shadow: inset 0 0 0 2px var(--acc-accent);
}
.account-overlay .iti__country,
.iti--detached-country-selector .iti__country {
  font-family: var(--font-family);
}
.account-overlay .iti__country.iti__highlight,
.iti--detached-country-selector .iti__country.iti__highlight {
  background: var(--acc-accent-bg);
}

.account-input-prefix {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 10px;
  margin-right: 9px;
  border-right: 1px solid var(--acc-field-divider);
  height: 24px;
  color: var(--acc-placeholder);
}
.account-input-prefix-flag { font-size: 19px; line-height: 1; }
.account-input-prefix-chevron { font-size: 10px; }
.account-input-prefix--tg {
  padding-right: 11px;
  margin-right: 3px;
  border-right: none;
  font-size: 17px;
  font-weight: 700;
}

.account-input-wrap.is-error {
  border-color: var(--acc-error-field-border);
}

/* ── Зона подсказки способа входа: 40px десктоп (README «зарезервировано всегда»),
   0 на мобилке — там подсказка появляется в потоке ── */
.account-hint { min-height: 40px; }
.account-hint-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  border-radius: 11px;
  padding: 9px 13px;
}
.account-hint-box--error {
  font-weight: 600;
  color: var(--acc-error);
  background: var(--acc-error-bg);
  border: 1px solid var(--acc-error-border);
}
.account-hint-box--ok {
  color: var(--acc-success);
  background: var(--acc-success-bg);
  border: 1px solid var(--acc-success-border);
}
.account-hint-check { font-weight: 800; }

/* ── Чекбокс согласия на ПД (22×22) ── */
.account-consent { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.account-consent-checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  border-radius: 7px;
  border: 1.5px solid var(--acc-checkbox-off-border);
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
}
.account-consent-checkbox:checked {
  background-color: var(--acc-accent);
  border-color: var(--acc-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
.account-consent-checkbox.is-error {
  background-color: var(--acc-error-bg);
  border-color: var(--acc-error);
}
.account-consent-text {
  font-size: 16px;
  line-height: 1.4;
  color: var(--acc-text);
}
.account-consent-error-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--acc-error);
  margin: 6px 0 0 33px;
}

.account-continue-btn {
  height: 56px;
  border: none;
  border-radius: 15px;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--acc-disabled-bg);
  color: var(--acc-disabled-text);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.account-continue-btn.is-active {
  background: var(--acc-primary);
  color: var(--acc-text);
}
.account-continue-btn:disabled { opacity: .7; cursor: default; }

/* ── Юридический блок ── */
.account-legal {
  display: flex;
  flex-direction: column;
  gap: 11px;
  border-top: 1px solid var(--acc-divider);
  padding-top: 14px;
}
.account-legal-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--acc-text-tertiary);
}
.account-legal-underline {
  text-decoration: underline;
  text-decoration-color: var(--acc-legal-underline);
  text-underline-offset: 2px;
}
.account-marketing { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.account-marketing-checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  border-radius: 5px;
  border: 1.5px solid var(--acc-legal-muted);
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
}
.account-marketing-checkbox:checked {
  background-color: var(--acc-legal-muted);
  border-color: var(--acc-legal-muted);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
.account-marketing-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--acc-text-quaternary);
}

/* ── Шаг 2 (Task 12): signup «Придумайте пароль» / login «Введите пароль» ──
   Контейнер сам — flex-column с тем же ритмом, что account-form (13px):
   он живёт ВНУТРИ account-form как единственный ребёнок текущего шага,
   а не рядом с полями шага 1 напрямую. */
.account-step2 { display: flex; flex-direction: column; gap: 13px; }
.account-step2-spacer { min-height: 6px; }

/* ── Пароль: тот же account-input-wrap/account-input, что у прочих полей,
   плюс кнопка-глаз (иконка меняет type text/password) ── */
.account-eye-btn {
  flex: none;
  margin-left: 10px;
  display: flex;
  align-items: center;
  color: var(--acc-text-tertiary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.account-eye-btn svg { width: 19px; height: 19px; }

/* ── Инфо-блок восстановления пароля ── */
.account-info-box {
  background: var(--acc-neutral-bg);
  border: 1px solid var(--acc-badge-bg);
  border-radius: var(--radius-12);
  padding: 12px 14px;
}
.account-info-text { font-size: 13.5px; line-height: 1.45; color: var(--acc-text-secondary); }

/* ── Ссылка возврата на шаг 1 ── */
.account-back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: auto;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--acc-accent);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
}

/* ── Плашка «У вас уже есть аккаунт» (шаг 2 · login) ── */
.account-existing-badge {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--acc-accent-bg-soft);
  border: 1px solid var(--acc-accent-bg-strong);
  border-radius: var(--radius-14);
  padding: 12px 14px;
}
.account-existing-avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-12);
  background: #fff;
  border: 1px solid var(--acc-accent-bg-strong);
  color: var(--acc-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-existing-avatar svg { width: 19px; height: 19px; }
.account-existing-body { min-width: 0; }
.account-existing-title { font-size: 15px; font-weight: 700; color: var(--acc-text); }
.account-existing-sub { font-size: 13.5px; color: var(--acc-text-secondary); line-height: 1.35; margin-top: 2px; }

/* ── «Забыли пароль?» — v1 без кодов, раскрывает плашку с ручным восстановлением ── */
.account-forgot-row { display: flex; align-items: center; }
.account-forgot-link { font-size: 15px; font-weight: 600; color: var(--acc-accent); cursor: pointer; }
.account-forgot-panel {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--acc-text-secondary);
  background: var(--acc-neutral-bg);
  border: 1px solid var(--acc-badge-bg);
  border-radius: var(--radius-12);
  padding: 10px 13px;
}
.account-forgot-panel[hidden] { display: none; }

/* ── Успех (состояние 9): форма заменяется подтверждением ── */
.account-success {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 24px 22px 24px;
  background: #fff;
}
.account-success-check {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-16);
  background: var(--acc-success-bg);
  color: var(--acc-success);
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-success-text { font-size: 16px; color: var(--acc-text-secondary); line-height: 1.5; margin-top: 7px; }
.account-success-info {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--acc-neutral-bg);
  border: 1px solid var(--acc-badge-bg);
  border-radius: var(--radius-14);
  padding: 14px 16px;
}
.account-success-info-eyebrow {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--acc-text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.account-success-info-text { font-size: 15px; line-height: 1.45; color: #45474D; }
.account-success-actions { display: flex; gap: 11px; }
.account-success-primary, .account-success-secondary {
  flex: 1;
  height: 50px;
  border-radius: var(--radius-14);
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-success-primary { border: none; background: var(--acc-primary); color: var(--acc-text); font-weight: 800; }
.account-success-secondary { background: #fff; border: 1px solid var(--acc-field-border); color: var(--acc-text); font-weight: 700; }

/* ── Шапка: режим «вошёл» (Task 12) ── */
.account-user-wrap { position: relative; }
.account-user-wrap[hidden] { display: none; }
.account-user-btn {
  display: inline-flex;
  align-items: center;
  height: 42px;
  max-width: 170px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-12);
  background: var(--color-fill);
  color: var(--color-ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-user-btn:hover { background: var(--color-line); }
.account-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--acc-field-border);
  border-radius: var(--radius-14);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
}
.account-user-menu[hidden] { display: none; }
.account-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-10);
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--acc-text);
  cursor: pointer;
}
.account-menu-item:hover { background: var(--acc-neutral-bg); }
.account-menu-item--danger { color: var(--acc-error); }

/* ══ Модалка «Заявка на курс» (Task 14) — колонка 320px (README «Заявка на курс»),
   переиспользует базовые .account-* классы каркаса/полей/чекбоксов/подсказки/успеха,
   здесь — только то, что реально отличается: ширина колонки, блок цены, «Что дальше»,
   1fr/1fr сетка контактной строки, список согласий. ── */
.lead-dark { width: 320px; padding: 26px 24px; }
.lead-form-modal { padding: 24px 26px 26px; gap: 15px; }

.lead-price-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid var(--acc-dark-border);
  border-bottom: 1px solid var(--acc-dark-border);
  padding: 15px 0;
}
.lead-price-row { display: flex; justify-content: space-between; align-items: baseline; }
.lead-price-row-label { font-size: 13.5px; color: var(--acc-dark-text-muted); }
.lead-price-row-value { font-size: 18px; font-weight: 800; color: #fff; }
.lead-price-row-value--secondary { font-size: 15px; font-weight: 700; color: var(--acc-dark-text); }

.lead-next { display: flex; flex-direction: column; gap: 14px; }
.lead-next-eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--acc-eyebrow);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.lead-next-item { display: flex; gap: 11px; }
.lead-next-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--acc-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lead-next-text { font-size: 15px; line-height: 1.4; color: var(--acc-dark-text); }

/* Телефон + Telegram — 1fr/1fr (README «Заявка на курс»), в отличие от 1.18fr/1fr
   у сохранения диалога (account-contact-row без модификатора) */
.lead-contact-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.lead-consents-wrap { display: flex; flex-direction: column; gap: 11px; }
.lead-required { color: var(--acc-error); margin-left: 2px; }
.lead-consents-error, .lead-consents-load-error {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--acc-error);
  background: var(--acc-error-bg);
  border: 1px solid var(--acc-error-border);
  border-radius: 11px;
  padding: 9px 13px;
}

@media (prefers-reduced-motion: reduce) {
  .account-input-wrap, .account-continue-btn { transition: none; }
}

/* ══ Мобилка: тёмная шапка вместо колонки, кнопка в потоке, фуллскрин ══ */
@media (max-width: 720px) {
  /* Небольшой отступ вместо padding:0 — иначе карточка перекрывает весь оверлей
     и закрытие кликом по скриму (вне карточки) становится недостижимо на тач-вьюпорте */
  .account-overlay { padding: 10px; }
  .account-card {
    width: 100%;
    max-width: 100%;
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: var(--radius-16);
    flex-direction: column;
    overflow: hidden;
  }
  .account-dark { display: none; }
  .account-mobile-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: none;
    padding: 14px 18px 20px;
    background: var(--acc-dark);
    color: #fff;
  }
  .account-mobile-head-text { flex: 1; min-width: 0; }
  .account-mobile-head-title {
    margin-top: 6px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.25;
    color: #fff;
  }
  .account-mobile-head-sub {
    margin-top: 5px;
    font-size: 13px;
    color: var(--acc-dark-text-muted);
    line-height: 1.4;
  }
  .account-close {
    flex: none;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 9px;
    background: var(--acc-dark-surface);
    color: #C6C8CE;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .account-form { padding: 18px 18px 26px; gap: 18px; }
  .account-fields { gap: 14px; }
  .account-contact-row { grid-template-columns: 1fr; gap: 14px; } /* телефон/telegram в столбик */
  .account-contact-row .account-field-error { min-height: 17px; }
  .account-head { display: none; } /* «Куда сохранить» не дублируется — уже есть в шапке */
  .account-benefits-mobile { display: flex; }
  .account-input-wrap { height: 48px; }
  .account-hint { min-height: 0; }
  .account-legal { gap: 12px; padding-top: 16px; }

  /* Шаг 2/успех (Task 12): в отличие от account-head шага 1, свой заголовок
     («Придумайте пароль» / «Введите пароль» / «Диалог сохранён») НЕ дублирует
     общую шапку («Чтобы этот разговор не пропал») — остаётся видимым. */
  .account-step2 { gap: 18px; }
  .account-step2-head .account-title,
  .account-success .account-title { font-size: 23px; }
  .account-success { gap: 16px; padding: 22px 18px 26px; }
  .account-success-actions { flex-direction: column; gap: 9px; }
  .account-success-primary, .account-success-secondary { height: 56px; border-radius: 15px; font-size: 17px; }

  .account-user-btn { max-width: 120px; padding: 0 12px; font-size: 14px; }
}
