/*
 * Формы заявки: модальное окно и подвал (includes/lead-form.php, assets/br-lead.js).
 * Макет: https://claude.ai/artifact/RP1zq8NqpUBpidEBjgyrGd. Цвета и шрифт — как у каталога (br.css).
 * Оверлей — класс modal-overlay темы: script.js показывает и прячет его через style.display.
 */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: optional; src: url(fonts/manrope-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: optional; src: url(fonts/manrope-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

.brl-overlay, .brl-form {
  --brl-ink: #0f1d2b; --brl-ink-2: #2b3b4c; --brl-muted: #5d6d7e; --brl-line: #e2e8ef; --brl-edge: #8796a5;
  --brl-sea: #0b7285; --brl-sea-2: #095c6b; --brl-sea-soft: #e6f4f6; --brl-bg: #f5f7fa;
  --brl-ok: #1e8e4e; --brl-ok-soft: #e6f5ec; --brl-err: #b42318; --brl-err-ink: #8a1c12; --brl-err-soft: #fdecea;
  --brl-ring: 0 0 0 3px rgba(11, 114, 133, .18);
  --brl-icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.5'/%3E%3C/svg%3E");
}
.brl-modal, .brl-form { font-family: 'Manrope', 'Segoe UI', Tahoma, sans-serif; color: var(--brl-ink); line-height: 1.45; text-align: left; }
.brl-modal *, .brl-modal *::before, .brl-form *, .brl-form *::before { box-sizing: border-box; }

/* окно */
.modal-overlay.brl-overlay { padding: 16px; align-items: center; justify-content: center; background: rgba(15, 29, 43, .6); }
.brl-modal { position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 28px 32px 32px; background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 29, 43, .35); }
.brl-close { position: absolute; top: 12px; right: 12px; z-index: 1; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--brl-muted); cursor: pointer; }
.brl-close:hover { background: var(--brl-bg); color: var(--brl-ink); }
.brl-head { display: flex; flex-direction: column; gap: 6px; padding-right: 36px; }
.brl-title { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 800; color: var(--brl-ink); }
.brl-head .brl-sub { margin: 0; font-size: 15px; line-height: 1.5; color: var(--brl-muted); }

/* поля */
.brl-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.brl-field { display: flex; flex-direction: column; gap: 6px; }
.brl-label { margin: 0; padding: 0; font-size: 14px; font-weight: 700; color: var(--brl-ink); }
.brl-label span { font-weight: 500; color: var(--brl-muted); }
.brl-field .iti { display: block; width: 100%; }
.brl-form .brl-input { display: block; width: 100%; height: 52px; margin: 0; padding: 0 14px; border: 1px solid var(--brl-edge); border-radius: 12px; background: #fff; color: var(--brl-ink); font: inherit; font-size: 17px; outline: none; box-shadow: none; transition: border-color .15s, box-shadow .15s; }
.brl-form .brl-input::placeholder { color: #6b7a89; }
.brl-form .brl-input:focus { border-color: var(--brl-sea); box-shadow: var(--brl-ring); }
.brl-form .is-invalid .brl-input { border-color: var(--brl-err); box-shadow: 0 0 0 1px var(--brl-err); }
.brl-error { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; line-height: 1.4; color: var(--brl-err); }
.brl-error::before { content: ''; flex: 0 0 16px; height: 16px; margin-top: 1px; background: currentColor; -webkit-mask: var(--brl-icon-alert) center / contain no-repeat; mask: var(--brl-icon-alert) center / contain no-repeat; }
.brl-error[hidden], .brl-alert[hidden] { display: none; }
.brl-hint { font-size: 13px; line-height: 1.4; color: var(--brl-muted); }
.brl-hint:empty, .is-invalid .brl-hint { display: none; }
.brl-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* поле телефона: intl-tel-input */
.brl-form .iti { --iti-border-color: var(--brl-line); --iti-hover-color: var(--brl-sea-soft); }
.brl-form .iti__selected-country { border-radius: 12px 0 0 12px; }
.brl-form .iti__country { min-height: 44px; }
.iti--detached-country-selector, .iti--fullscreen-popup { z-index: 3000; }   /* выше оверлея темы (2000) */

/* тип квартиры */
.brl-apts { min-width: 0; margin: 0; padding: 0; border: 0; }
.brl-apts .brl-label { margin-bottom: 8px; }
.brl-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.brl-chip { position: relative; display: block; margin: 0; }
.brl-chip input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.brl-chip span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 6px; border: 1px solid var(--brl-edge); border-radius: 10px; background: #fff; color: var(--brl-ink); font-size: 14px; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer; }
.brl-chip input:checked + span { border-color: var(--brl-sea); box-shadow: inset 0 0 0 1px var(--brl-sea); background: var(--brl-sea-soft); color: var(--brl-sea-2); }
.brl-chip input:focus-visible + span { outline: 2px solid var(--brl-sea); outline-offset: 2px; }

/* согласие, ошибка отправки, кнопка */
.brl-consent { display: flex; gap: 12px; align-items: flex-start; margin: 0; font-size: 14px; line-height: 1.45; color: var(--brl-ink-2); cursor: pointer; }
.brl-form .brl-consent input { flex: 0 0 20px; width: 20px; height: 20px; margin: 1px 0 0; padding: 0; accent-color: var(--brl-sea); }
.brl-consent a { color: var(--brl-sea); }
.brl-consent + .brl-error { padding-left: 32px; }
.brl-alert { padding: 12px 14px; border-radius: 10px; background: var(--brl-err-soft); color: var(--brl-err-ink); font-size: 14px; line-height: 1.45; }
.brl-form .brl-submit { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 54px; margin: 0; padding: 0 16px; border: 0; border-radius: 12px; background: var(--brl-sea); color: #fff; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; opacity: 1; transition: background .15s; }
.brl-form .brl-submit:hover { background: var(--brl-sea-2); opacity: 1; }
.brl-form .brl-submit:disabled { cursor: progress; }
.brl-spin { display: none; width: 18px; height: 18px; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: brl-spin .8s linear infinite; }
.is-sending .brl-spin { display: block; }
@keyframes brl-spin { to { transform: rotate(360deg); } }

/* заявка отправлена */
.success-message.brl-success { padding: 24px 8px 4px; text-align: center; }
.brl-success-icon { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--brl-ok-soft); color: var(--brl-ok); }
.brl-success-title { margin: 0 0 8px; font-size: 24px; line-height: 1.25; font-weight: 800; color: var(--brl-ink); }
.brl-success p { margin: 0 0 6px; font-size: 15px; line-height: 1.5; color: var(--brl-muted); }
.brl-success .brl-success-phone { font-size: 20px; font-weight: 700; color: var(--brl-ink); }
.brl-link { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--brl-sea); font: inherit; font-size: 15px; font-weight: 600; text-decoration: underline; cursor: pointer; }
.brl-secondary { display: block; width: 100%; height: 52px; margin-top: 12px; border: 1px solid var(--brl-edge); border-radius: 12px; background: #fff; color: var(--brl-ink); font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }

/* форма в тёмном подвале темы: правила темы .footer-form input и .footer-form button перекрываются точнее */
.footer-form .brl-form { gap: 14px; }
.footer-form .brl-label { color: #dfe4e8; }
.footer-form .brl-form .brl-input { height: 48px; margin: 0; padding: 0 14px; border: 0; border-radius: 10px; font-size: 16px; }
.footer-form .brl-form .is-invalid .brl-input { box-shadow: 0 0 0 2px #ff8a7a; }
.footer-form .brl-error { color: #ffb4a9; }
.footer-form .brl-hint, .footer-form .brl-consent { color: #b8c0c8; }
.footer-form .brl-consent { font-size: 13px; }
.footer-form .brl-consent a { color: #7fd3e0; }
.footer-form .brl-form .brl-consent input { flex-basis: 18px; width: 18px; height: 18px; margin: 1px 0 0; }
.footer-form .brl-consent + .brl-error { padding-left: 28px; }
.footer-form .brl-alert { background: #3a2422; color: #ffd2cc; }
.footer-form .brl-form .brl-submit { height: 50px; border-radius: 10px; background: var(--brl-sea); }
.footer-form .iti button { width: auto; margin: 0; padding: 0; border-radius: 0; background: transparent; color: inherit; font-weight: inherit; }
.footer-form .iti .iti__selected-country { border-radius: 10px 0 0 10px; }
.footer-form .iti .iti__search-input { width: 100%; margin: 0; border: 0; border-radius: 3px; font-size: 15px;
  padding: 8px calc(var(--iti-spacer-horizontal) + var(--iti-clear-icon-size) + var(--iti-spacer-horizontal)) 8px calc(var(--iti-spacer-horizontal) + var(--iti-globe-icon-size) + var(--iti-spacer-horizontal)); }

/* телефон: окно выезжает снизу */
@media (max-width: 600px) {
  .modal-overlay.brl-overlay { padding: 56px 0 0; align-items: flex-end; }
  .brl-modal { max-width: none; max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); padding: 22px 16px 24px; border-radius: 20px 20px 0 0; }
  .brl-modal::before { content: ''; display: block; width: 40px; height: 4px; margin: -12px auto 14px; border-radius: 2px; background: #cfd8e3; }
  .brl-title { font-size: 22px; }
  .brl-form { gap: 18px; }
}

/* справа налево: иврит и арабский. Поле телефона остаётся слева направо (цифры и код страны). */
html[dir="rtl"] .brl-modal, html[dir="rtl"] .brl-form { text-align: right; font-family: 'Segoe UI', Arial, Tahoma, 'Noto Sans Hebrew', 'Noto Sans Arabic', sans-serif; }
html[dir="rtl"] .brl-close { right: auto; left: 12px; }
html[dir="rtl"] .brl-head { padding-right: 0; padding-left: 36px; }
html[dir="rtl"] .brl-consent + .brl-error, html[dir="rtl"] .footer-form .brl-consent + .brl-error { padding-left: 0; padding-right: 32px; }
html[dir="rtl"] .brl-form input[type="tel"], html[dir="rtl"] .brl-form .iti { direction: ltr; text-align: left; }
html[dir="rtl"] .brl-form .iti input { text-align: left; }
/* ловушка для ботов уходит за правый край: слева в документе справа налево появилась бы прокрутка на 10 000 px */
html[dir="rtl"] .brl-hp { left: auto !important; right: -10000px !important; }
