/* ─────────────────────────────────────────────────────────────────
 * form-modals.css — МногоСна v2026 · стили окон-заявок (.fm-*)
 *
 * Drop-in port из Design_System1/New_Revision/design_handoff_form_modals.
 * Токены (--c-*, --sp-*, --r-*, --dur-*, --ease-out, --ff-*, --fs-*,
 * --ls-*, --sh-*) и классы .btn/.btn--*/.v2-input уже определены в боевых
 * cart_v2.css + cart_v2_overrides.css + iter-04-homepage.css.
 *
 * Скрим самодостаточен через .fm-overlay (НЕ переопределяем .atc-overlay,
 * чтобы не задеть ATC/QuickOrder-модалки корзины). Подключается на тех же
 * модулях, что cart_v2.css (homepage|products|product|generic_v2).
 * ───────────────────────────────────────────────────────────────── */

@keyframes fm-spin { to { transform: rotate(360deg); } }
@keyframes fm-pop {
  0%   { transform: scale(.6); }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ============ Скрим оверлея + закрытие (self-contained, scoped) ============ */
.fm-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal, 90);
  display: grid; place-items: start center;
  padding: clamp(16px, 6vh, 72px) var(--sp-4) var(--sp-6);
  background: rgba(16, 24, 40, .46);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  overflow-y: auto;
}
.fm-overlay.is-open { opacity: 1; }
.fm-card .atc-close {
  position: absolute; top: 12px; right: 12px;
  width: 38px; height: 38px; border: none; border-radius: var(--r-pill);
  background: transparent; color: var(--c-text-3); cursor: pointer;
  display: grid; place-items: center; z-index: 2;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.fm-card .atc-close:hover { background: var(--c-bg-soft); color: var(--c-text); }
.fm-card .atc-close svg { width: 20px; height: 20px; }

/* ============ Спиннер кнопки ============ */
.fm-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
  display: inline-block; animation: fm-spin .7s linear infinite;
  vertical-align: -3px; margin-right: 7px;
}

/* ============================================================
 * FORM MODALS  (.fm-*)  — site enquiry dialogs
 * ============================================================ */
.fm-card {
  position: relative;
  width: 100%; max-width: 600px;
  background: var(--c-surface, #fff);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  transform: translateY(14px) scale(.97); opacity: 0;
  transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
.fm-overlay.is-open .fm-card { transform: translateY(0) scale(1); opacity: 1; }
.fm-card--wide { max-width: 640px; }

/* ── Базовые поля (.v2-select отсутствует в боевом CSS — зеркалим .v2-input) ── */
.fm-card .v2-select {
  display: block; width: 100%; height: 44px; padding: 0 var(--sp-4);
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-bg, #fff); font: 400 var(--fs-sm)/1 var(--ff-body);
  color: var(--c-text); box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.fm-card .v2-select:focus { outline: 2px solid var(--c-blue); outline-offset: -1px; border-color: var(--c-blue); }
/* Fidelity: в модалке инпут/селект 15px (Onest), плейсхолдер --c-text-2 (боевой .v2-input грузит 17px) */
.fm-card .v2-input,
.fm-card .v2-input[type="text"],
.fm-card .v2-input[type="email"] { font-size: var(--fs-sm); }
.fm-card .v2-input::placeholder { color: var(--c-text-2); }
.fm-card .v2-input:hover,
.fm-card .v2-select:hover { border-color: var(--c-text-2); }

/* ── Header ── */
.fm-head {
  position: relative;
  padding: var(--sp-6) var(--sp-6) var(--sp-4);
  display: flex; flex-direction: column; gap: 6px;
}
.fm-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font: 600 var(--fs-xs)/1 var(--ff-body); letter-spacing: var(--ls-smallcaps);
  text-transform: uppercase; color: var(--c-blue);
}
.fm-eyebrow svg { width: 16px; height: 16px; }
.fm-title { font: 700 var(--fs-h2)/1.15 var(--ff-display); color: var(--c-text); margin: 0; letter-spacing: var(--ls-h2); }
.fm-sub { font: 400 var(--fs-sm)/1.45 var(--ff-body); color: var(--c-text-2); margin: 2px 0 0; max-width: 46ch; }

/* ── Stepper ── */
.fm-steps {
  display: flex; align-items: flex-start;
  padding: 0 var(--sp-6) var(--sp-5);
}
.fm-step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 56px; }
.fm-step__dot {
  width: 32px; height: 32px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  font: 700 var(--fs-sm)/1 var(--ff-body);
  background: var(--c-bg-soft); color: var(--c-text-3);
  border: 1.5px solid var(--c-border);
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.fm-step__dot svg { width: 16px; height: 16px; }
.fm-step__label {
  font: 600 var(--fs-xs)/1.2 var(--ff-body); color: var(--c-text-3); text-align: center;
  transition: color var(--dur-base) var(--ease-out);
}
.fm-step__bar {
  flex: 1; height: 2px; background: var(--c-border); border-radius: var(--r-pill);
  margin: 16px 2px 0; align-self: flex-start;
  transition: background var(--dur-base) var(--ease-out);
}
.fm-step.is-current .fm-step__dot { background: var(--c-blue); border-color: var(--c-blue); color: #fff; }
.fm-step.is-current .fm-step__label { color: var(--c-text); }
.fm-step.is-done .fm-step__dot { background: var(--c-success); border-color: var(--c-success); color: #fff; }
.fm-step.is-done .fm-step__label { color: var(--c-text-2); }
.fm-step__bar.is-filled { background: var(--c-success); }

/* ── Body ── */
.fm-body { padding: 0 var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.fm-section-label {
  font: 600 var(--fs-sm)/1 var(--ff-body); color: var(--c-text-2);
  display: flex; align-items: center; gap: 7px; margin-bottom: 2px;
}
.fm-section-label svg { width: 16px; height: 16px; color: var(--c-blue); }

.fm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4) var(--sp-4); }
.fm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fm-field--full { grid-column: 1 / -1; }
.fm-field__label { font: 600 var(--fs-sm)/1.2 var(--ff-body); color: var(--c-text); }
.fm-field__label .req { color: var(--c-orange); margin-left: 2px; font-weight: 700; }
.fm-field__hint { font: 400 var(--fs-xs)/1.3 var(--ff-body); color: var(--c-text-3); }

.fm-textarea {
  min-height: 104px; padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-bg); font: 400 var(--fs-sm)/1.5 var(--ff-body); color: var(--c-text);
  resize: vertical; width: 100%; box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.fm-textarea::placeholder { color: var(--c-text-2); }
.fm-textarea:hover { border-color: var(--c-text-2); }
.fm-textarea:focus-visible { border-color: var(--c-blue); outline: 2px solid var(--c-blue); outline-offset: 0; }
.fm-field.is-error .v2-input,
.fm-field.is-error .v2-select,
.fm-field.is-error .fm-textarea { border-color: var(--c-error); }
.fm-field__err { font: 400 var(--fs-xs)/1.3 var(--ff-body); color: var(--c-error); }

/* ── Native select with chevron ── */
.fm-selectwrap { position: relative; }
.fm-selectwrap .v2-select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; }
.fm-selectwrap__chev {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--c-text-2); display: grid; place-items: center;
}
.fm-selectwrap__chev svg { width: 16px; height: 16px; }
.fm-card .v2-select option[value=""] { color: var(--c-text-2); }

/* ── Radio cards (тип товара) ── */
.fm-radios { display: flex; flex-direction: column; gap: var(--sp-2); }
.fm-radio {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--c-border); border-radius: var(--r-md);
  cursor: pointer; background: var(--c-bg);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.fm-radio:hover { border-color: var(--c-blue); background: var(--c-blue-light); }
.fm-radio.is-on { border-color: var(--c-blue); background: var(--c-blue-light); }
.fm-radio input { position: absolute; opacity: 0; pointer-events: none; }
.fm-radio__mark {
  flex: none; width: 22px; height: 22px; border-radius: var(--r-pill);
  border: 2px solid var(--c-border); display: grid; place-items: center;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.fm-radio.is-on .fm-radio__mark { border-color: var(--c-blue); }
.fm-radio__mark::after { content: ""; width: 10px; height: 10px; border-radius: var(--r-pill); background: var(--c-blue); transform: scale(0); transition: transform var(--dur-fast) var(--ease-out); }
.fm-radio.is-on .fm-radio__mark::after { transform: scale(1); }
.fm-radio__icon {
  flex: none; width: 38px; height: 38px; border-radius: var(--r-md);
  background: var(--c-blue-light); color: var(--c-blue); display: grid; place-items: center;
}
.fm-radio__icon svg { width: 20px; height: 20px; }
.fm-radio__body { display: flex; flex-direction: column; gap: 1px; }
.fm-radio__title { font: 600 var(--fs-body)/1.2 var(--ff-body); color: var(--c-text); }
.fm-radio__sub { font: 400 var(--fs-xs)/1.3 var(--ff-body); color: var(--c-text-2); }

/* ── File dropzone ── */
.fm-drop {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4); border: 1.5px dashed var(--c-border);
  border-radius: var(--r-md); background: var(--c-bg-soft); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.fm-drop:hover, .fm-drop.is-drag { border-color: var(--c-blue); background: var(--c-blue-light); }
.fm-drop input { display: none; }
.fm-drop__icon {
  flex: none; width: 42px; height: 42px; border-radius: var(--r-md);
  background: #fff; border: 1px solid var(--c-border-soft); color: var(--c-blue);
  display: grid; place-items: center;
}
.fm-drop__icon svg { width: 20px; height: 20px; }
.fm-drop__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fm-drop__title { font: 600 var(--fs-sm)/1.3 var(--ff-body); color: var(--c-text); }
.fm-drop__title b { color: var(--c-blue); }
.fm-drop__hint { font: 400 var(--fs-xs)/1.3 var(--ff-body); color: var(--c-text-2); }
.fm-files { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.fm-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 10px; background: var(--c-blue-light);
  border-radius: var(--r-pill); font: 500 var(--fs-xs)/1 var(--ff-body); color: var(--c-blue-dark);
  max-width: 220px;
}
.fm-file.is-uploading { opacity: .6; }
.fm-file__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-file__rm {
  flex: none; width: 18px; height: 18px; border: none; border-radius: var(--r-pill);
  background: rgba(14,148,200,.18); color: var(--c-blue-dark); cursor: pointer;
  display: grid; place-items: center;
}
.fm-file__rm svg { width: 11px; height: 11px; }
.fm-file__rm:hover { background: var(--c-blue); color: #fff; }

/* ── Reassurance list (модалка «Обратный звонок», 2026-06-30) ── */
.fm-assure { list-style: none; margin: var(--sp-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.fm-assure li { display: flex; align-items: center; gap: var(--sp-2); font: 400 var(--fs-sm)/1.3 var(--ff-body); color: var(--c-text-2); }
.fm-assure svg { color: var(--c-blue); flex: none; }

/* ── Footer ── */
.fm-foot { padding: var(--sp-5) var(--sp-6) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.fm-consent-wrap { display: flex; flex-direction: column; gap: 6px; }
.fm-consent-wrap.is-error .fm-consent span { color: var(--c-error); }
.fm-consent-wrap.is-error .fm-consent input { outline: 2px solid var(--c-error); outline-offset: 1px; border-radius: 3px; }
.fm-consent { display: flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; }
.fm-consent input {
  flex: none; width: 18px; height: 18px; margin: 1px 0 0;
  accent-color: var(--c-blue); cursor: pointer;
}
.fm-consent span { font: 400 var(--fs-sm)/1.4 var(--ff-body); color: var(--c-text-2); }
.fm-consent a { color: var(--c-blue); }

.fm-actions { display: flex; align-items: center; gap: var(--sp-3); }
.fm-actions--end { justify-content: flex-end; }
.fm-actions--split { justify-content: space-between; }
.fm-actions .btn { min-width: 150px; justify-content: center; }
.fm-cta.is-loading { pointer-events: none; }
.fm-step-caption { font: 500 var(--fs-xs)/1 var(--ff-body); color: var(--c-text-3); }

/* ── Success ── */
.fm-success { padding: var(--sp-7) var(--sp-6); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); }
.fm-success__badge {
  width: 64px; height: 64px; border-radius: var(--r-pill); flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c-success) 14%, #fff); color: var(--c-success);
}
.fm-success__badge svg { width: 32px; height: 32px; }
.fm-overlay.is-open .fm-success__badge { animation: fm-pop 460ms var(--ease-out) both; }
.fm-success__title { font: 700 var(--fs-h2)/1.15 var(--ff-display); color: var(--c-text); margin: 0; }
.fm-success__sub { font: 400 var(--fs-sm)/1.5 var(--ff-body); color: var(--c-text-2); margin: 0; max-width: 40ch; }
.fm-success__sub b { color: var(--c-text); }
.fm-success .btn { margin-top: var(--sp-2); }

/* ── Responsive ── */
@media (max-width: 560px) {
  .fm-grid { grid-template-columns: 1fr; }
  .fm-head { padding: var(--sp-5) var(--sp-5) var(--sp-4); }
  .fm-body { padding: 0 var(--sp-5); }
  .fm-foot { padding: var(--sp-4) var(--sp-5) var(--sp-5); }
  .fm-steps { padding: 0 var(--sp-5) var(--sp-4); }
  .fm-step { width: 44px; }
  .fm-step__label { font-size: 10px; }
  .fm-actions .btn { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .fm-card { transition: opacity 1ms; transform: none; }
  .fm-overlay.is-open .fm-success__badge { animation: none; }
}
