/* Плавающая кнопка «Записаться на приём» + форма заявки (views/layouts/_lead_widget.php) */

.lw {
  --lw-red: #e31e24;
  --lw-red-dark: #c4161c;
  --lw-text: #111111;
  --lw-muted: #6b6b6b;
  --lw-border: #d9d9d9;
  --lw-bg: #ffffff;
  --lw-offset: 0px; /* подъём над cookie-плашкой Tilda, задаётся из JS */
  font-family: 'TildaSans', Arial, sans-serif;
}

.lw *,
.lw *::before,
.lw *::after { box-sizing: border-box; }

/* ---------- Шарик ---------- */

.lw-bubble {
  position: fixed;
  right: 24px;
  bottom: calc(24px + var(--lw-offset));
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  transition: bottom .3s ease, opacity .25s ease, transform .25s ease;
  -webkit-tap-highlight-color: transparent;
}

.lw-bubble__circle {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--lw-red);
  color: #fff;
  box-shadow: 0 8px 24px rgba(227, 30, 36, .38);
  transition: background-color .2s ease, transform .2s ease;
}

/* пульсирующее кольцо — привлекает внимание */
.lw-bubble__circle::before,
.lw-bubble__circle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--lw-red);
  animation: lw-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
.lw-bubble__circle::after { animation-delay: 1.2s; }

@keyframes lw-pulse {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(1.7); opacity: 0; }
}

.lw-bubble__label {
  padding: 12px 18px;
  border-radius: 30px;
  background: var(--lw-bg);
  color: var(--lw-text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
  transition: color .2s ease;
}

.lw-bubble:hover .lw-bubble__circle { background: var(--lw-red-dark); transform: scale(1.06); }
.lw-bubble:hover .lw-bubble__label  { color: var(--lw-red); }
.lw-bubble:focus-visible { outline: none; }
.lw-bubble:focus-visible .lw-bubble__circle { outline: 3px solid var(--lw-text); outline-offset: 3px; }

/* прячем шарик, пока открыта наша форма или фото галереи на весь экран (site.js ставит .lightbox-open) */
.lw_open .lw-bubble,
.lightbox-open .lw-bubble {
  opacity: 0;
  transform: scale(.8);
  pointer-events: none;
}

@media (max-width: 640px) {
  .lw-bubble { right: 16px; bottom: calc(16px + var(--lw-offset)); }
  .lw-bubble__circle { width: 60px; height: 60px; }
  .lw-bubble__label { display: none; }
}

/* ---------- Модальное окно ---------- */

.lw-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000; /* выше всего: попапов, cookie-плашки и виджетов Tilda */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lw-modal[hidden] { display: none; }

.lw-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  animation: lw-fade .2s ease;
}

.lw-modal__card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 40px 36px 36px;
  border-radius: 30px; /* как у попапов Tilda на сайте */
  background: var(--lw-bg);
  color: var(--lw-text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: lw-rise .25s ease;
}

@keyframes lw-fade { from { opacity: 0; } }
@keyframes lw-rise { from { opacity: 0; transform: translateY(16px); } }

.lw-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--lw-muted);
  cursor: pointer;
}
.lw-modal__close:hover { background: #f2f2f2; color: var(--lw-text); }
.lw-modal__close:focus-visible { outline: 2px solid var(--lw-text); outline-offset: 2px; }

.lw-title {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--lw-text);
}
.lw-title:focus { outline: none; }

.lw-lead {
  margin: 0 0 24px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--lw-muted);
}

/* ---------- Поля ---------- */

.lw-field { margin-bottom: 16px; }

.lw-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.lw-input {
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--lw-border);
  border-radius: 14px;
  background: #fff;
  color: var(--lw-text);
  font: inherit;
  font-size: 17px; /* ≥16px: iOS не зумит поле при фокусе */
  transition: border-color .2s ease, box-shadow .2s ease;
}
.lw-input::placeholder { color: #a8a8a8; }
.lw-input:focus {
  outline: none;
  border-color: var(--lw-red);
  box-shadow: 0 0 0 3px rgba(227, 30, 36, .15);
}
.lw-input[aria-invalid="true"] { border-color: var(--lw-red); }

.lw-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.4;
  color: var(--lw-muted);
  cursor: pointer;
}
.lw-consent__box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--lw-red);
  cursor: pointer;
}

.lw-error {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--lw-red);
}
.lw-error:empty { display: none; }
.lw-error_form { margin: 0 0 12px; }

/* honeypot */
.lw-hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.lw-submit {
  display: block;
  width: 100%;
  height: 56px;
  margin-top: 8px;
  border: 0;
  border-radius: 30px;
  background: var(--lw-red);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s ease;
}
.lw-submit:hover { background: var(--lw-red-dark); }
.lw-submit:focus-visible { outline: 3px solid var(--lw-text); outline-offset: 2px; }
.lw-submit:disabled { opacity: .6; cursor: wait; }

/* ---------- Успех ---------- */

.lw-success { text-align: center; }
.lw-success[hidden] { display: none; }
.lw-success__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #e8f5ec;
  color: #1f8e47;
}

@media (max-width: 480px) {
  .lw-modal__card { padding: 36px 20px 24px; border-radius: 24px; }
  .lw-title { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .lw-bubble__circle::before,
  .lw-bubble__circle::after { animation: none; display: none; }
  .lw-modal__overlay,
  .lw-modal__card { animation: none; }
  .lw-bubble { transition: none; }
}
