/* ============================================================
   lead-capture.css — плаваюча кнопка «Передзвоніть»,
   автоматичні модалки (time-trigger, exit-intent), форма callback.
   Підключається глобально після components.css.
   ============================================================ */

/* ===================== ПЛАВАЮЧА КНОПКА ===================== */
.lc-float {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-brand-accent);
  color: #fff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.4s ease,
              transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.25s ease,
              bottom 0.3s ease;
}
.lc-float.is-visible { opacity: 1; transform: translateX(0); }
.lc-float:hover {
  width: auto;
  padding: 0 24px 0 16px;
  border-radius: var(--radius-full);
  color: #fff;
  background: var(--color-brand-accent-600);
}
.lc-float:hover::after {
  content: "Передзвонимо вам";
  margin-left: 10px;
  white-space: nowrap;
  font-weight: 600;
  font-size: var(--fs-small);
}
.lc-float:focus-visible { outline: 2px solid var(--color-brand-primary); outline-offset: 3px; }
.lc-float__icon { width: 24px; height: 24px; flex-shrink: 0; }

.lc-float__pulse {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--color-brand-accent);
  z-index: -1;
  animation: lc-pulse 6s ease-out infinite;
}
@keyframes lc-pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  80%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Зсув кнопки вгору, поки видно cookie-банер (він теж зліва знизу) */
body:has(.cookie-banner.is-visible) .lc-float { bottom: 250px; }
body:has(.cookie-banner.is-visible) .lc-bubble { bottom: 256px; }

@media (max-width: 640px) {
  .lc-float { width: 48px; height: 48px; left: 16px; bottom: 16px; }
  .lc-float__icon { width: 21px; height: 21px; }
  body:has(.cookie-banner.is-visible) .lc-float { bottom: 16px; }
}

/* ===================== ПІДКАЗКА-БАБЛ ===================== */
.lc-bubble {
  position: fixed;
  left: 88px;
  bottom: 30px;
  z-index: 159;
  max-width: 240px;
  padding: 12px 36px 12px 14px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--color-ink);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.lc-bubble.is-visible { opacity: 1; transform: translateX(0); }
.lc-bubble::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: translateY(-50%) rotate(45deg);
  box-shadow: -2px 2px 4px rgba(11, 37, 69, 0.05);
}
.lc-bubble p { margin: 0; }
.lc-bubble__close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 24px;
  height: 24px;
  font-size: 18px;
  line-height: 1;
  color: var(--color-ink-subtle);
}
@media (max-width: 640px) { .lc-bubble { display: none; } }

/* ===================== МОДАЛКА ===================== */
.lc-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  pointer-events: none;
}
.lc-modal.is-open { pointer-events: auto; }
.lc-modal[hidden] { display: none; }

.lc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 37, 69, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lc-modal.is-open .lc-modal__backdrop { opacity: 1; }

.lc-modal__card {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  background: #fff;
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 4vw, 2rem);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}
.lc-modal.is-open .lc-modal__card { opacity: 1; transform: scale(1); }

.lc-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  font-size: 22px;
  line-height: 1;
  color: var(--color-ink-muted);
  transition: background var(--dur-micro) var(--ease-standard);
}
.lc-modal__close:hover { background: var(--color-surface-3); }
.lc-modal__title {
  font-family: var(--font-body);
  font-size: var(--fs-h4);
  padding-right: var(--space-8);
}
.lc-modal__lead {
  margin-top: var(--space-2);
  font-size: var(--fs-small);
  color: var(--color-ink-muted);
  margin-bottom: var(--space-5);
}

/* --- Варіант: time-popup (правий нижній кут, над Telegram-кнопкою) --- */
.lc-modal--time { align-items: flex-end; justify-content: flex-end; padding: 24px; }
.lc-modal--time .lc-modal__backdrop { background: transparent; backdrop-filter: none; }
.lc-modal--time .lc-modal__card {
  margin-bottom: 72px;          /* щоб не перекривати плаваючу Telegram-кнопку */
  transform: translateY(40px);
}
.lc-modal--time.is-open .lc-modal__card { transform: translateY(0); }

@media (max-width: 640px) {
  .lc-modal--time { align-items: flex-end; justify-content: stretch; padding: 0; }
  .lc-modal--time .lc-modal__backdrop { background: rgba(11, 37, 69, 0.4); }
  .lc-modal--time .lc-modal__card {
    width: 100%;
    margin-bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
  }
  .lc-modal--time.is-open .lc-modal__card { transform: translateY(0); }
}

/* ===================== ФОРМА CALLBACK ===================== */
.lc-form { display: grid; gap: var(--space-4); }
.lc-form__honey { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.lc-form__field { position: relative; }
.lc-form__field input {
  width: 100%;
  height: var(--field-h);
  padding: 0 var(--space-4);
  font-size: var(--fs-body);
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-ink);
  transition: border-color var(--dur-base) var(--ease-standard),
              box-shadow var(--dur-base) var(--ease-standard);
}
.lc-form__field input::placeholder { color: transparent; }
.lc-form__field input:focus {
  outline: none;
  border-color: var(--color-brand-accent);
  box-shadow: var(--shadow-glow);
}
.lc-form__field label {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-body);
  color: var(--color-ink-subtle);
  background: #fff;
  padding-inline: 4px;
  pointer-events: none;
  transition: all var(--dur-micro) var(--ease-standard);
}
.lc-form__field input:focus + label,
.lc-form__field input:not(:placeholder-shown) + label {
  top: 0;
  transform: translateY(-50%) scale(0.86);
  color: var(--color-brand-accent);
  font-weight: 500;
}
.lc-form__field.has-error input { border-color: var(--color-danger); }
.lc-form__field.has-error label { color: var(--color-danger); }
.lc-form__error {
  display: none;
  margin-top: var(--space-1);
  font-size: var(--fs-small);
  color: var(--color-danger);
}
.lc-form__field.has-error .lc-form__error { display: block; }

.lc-form__submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--field-h);
  background: var(--color-brand-accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background var(--dur-base) var(--ease-standard),
              transform var(--dur-base) var(--ease-standard);
}
.lc-form__submit:hover { background: var(--color-brand-accent-600); transform: translateY(-2px); }
.lc-form__submit[disabled] { opacity: 0.7; pointer-events: none; transform: none; }
.lc-form__spinner {
  display: none;
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.lc-form__submit.is-loading .lc-form__submit-text { visibility: hidden; }
.lc-form__submit.is-loading .lc-form__spinner { display: block; }

.lc-form__legal {
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--color-ink-subtle);
  text-align: center;
}
.lc-form__legal a { text-decoration: underline; }
.lc-form__status {
  display: none;
  font-size: var(--fs-small);
  color: var(--color-danger);
  text-align: center;
}
.lc-form__status.is-visible { display: block; }
.lc-form__success {
  margin: 0;
  padding: var(--space-4);
  background: var(--color-brand-accent-100);
  color: var(--color-brand-accent-600);
  border-radius: var(--radius-md);
  font-size: var(--fs-small);
  font-weight: 500;
  text-align: center;
}

/* ===================== PREFERS-REDUCED-MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  .lc-float__pulse { animation: none; opacity: 0; }
  .lc-float,
  .lc-bubble,
  .lc-modal__card,
  .lc-modal__backdrop {
    transition: opacity 0.15s ease !important;
    transform: none !important;
  }
}
