/* ==========================================================================
   ЯВІР — модуль «Зворотний дзвінок»
   Вікно відкривається кліком по плаваючій кнопці або автоматично,
   якщо користувач хвилину не взаємодіє зі сторінкою.
   Підключається окремо: css/callback.css + js/callback.js
   ========================================================================== */

.cb-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(29, 28, 24, .62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}
.cb-overlay.is-open { opacity: 1; visibility: visible; }

.cb-modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-lg, 22px);
  box-shadow: 0 30px 80px rgba(29, 28, 24, .32);
  padding: clamp(24px, 3.4vw, 36px);
  transform: translateY(26px) scale(.97);
  opacity: 0;
  transition: transform .32s cubic-bezier(.2, .8, .25, 1), opacity .28s ease;
}
.cb-overlay.is-open .cb-modal { transform: none; opacity: 1; }

.cb-modal::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  border-radius: var(--radius-lg, 22px) var(--radius-lg, 22px) 0 0;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
}

/* Кнопка закриття */
.cb-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 38px; height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--gray-50, #f6f5f1);
  color: var(--gray-500, #726e64);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.cb-close:hover { background: var(--gray-100, #eceae3); color: var(--gray-900, #1d1c18); transform: rotate(90deg); }
.cb-close svg { width: 17px; height: 17px; }

/* Шапка вікна */
.cb-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; padding-right: 34px; }
.cb-head__icon {
  flex-shrink: 0;
  width: 50px; height: 50px;
  border-radius: 15px;
  background: var(--gold-50, #fdf9ec);
  color: var(--gold-700, #7d6217);
  display: grid;
  place-items: center;
}
.cb-head__icon svg { width: 24px; height: 24px; }
.cb-modal h3 { font-size: 1.3rem; margin: 0 0 4px; line-height: 1.2; }
.cb-head p { margin: 0; font-size: .9rem; color: var(--text-soft, #726e64); line-height: 1.5; }

/* Плашка «передзвонимо за 15 хв» */
.cb-promise {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--gold-50, #fdf9ec);
  border: 1px solid var(--gold-200, #f3e0a3);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--gray-700, #3a3833);
  margin-bottom: 20px;
}
.cb-promise svg { width: 17px; height: 17px; color: var(--gold-700, #7d6217); flex-shrink: 0; }

/* Вибір способу зв'язку */
.cb-ways { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.cb-way { position: relative; }
.cb-way input { position: absolute; opacity: 0; pointer-events: none; }
.cb-way span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border: 1.5px solid var(--gray-200, #dedbd2);
  border-radius: 10px;
  background: var(--gray-25, #fbfaf7);
  font-size: .76rem;
  font-weight: 600;
  color: var(--gray-600, #524f47);
  cursor: pointer;
  transition: all .18s ease;
}
.cb-way span svg { width: 19px; height: 19px; }
.cb-way span:hover { border-color: var(--gold-300, #ebcd6f); }
.cb-way input:checked + span {
  background: var(--gold-400, #e0b93c);
  border-color: var(--gold-500, #c9a22c);
  color: var(--gray-900, #1d1c18);
  box-shadow: 0 4px 12px rgba(224, 185, 60, .3);
}

.cb-modal .field { margin-bottom: 13px; }
.cb-actions { display: grid; gap: 9px; margin-top: 18px; }
.cb-actions .btn { width: 100%; }

.cb-call {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .92rem;
  font-weight: 700;
  color: var(--gray-600, #524f47);
  padding: 11px;
  border-radius: 999px;
  border: 1.5px solid var(--gray-200, #dedbd2);
  transition: all .2s ease;
}
.cb-call:hover { border-color: var(--gold-400, #e0b93c); background: var(--gold-50, #fdf9ec); color: var(--gray-900, #1d1c18); }
.cb-call svg { width: 16px; height: 16px; color: var(--gold-600, #a5811f); }

.cb-policy {
  margin: 14px 0 0;
  font-size: .74rem;
  line-height: 1.5;
  color: var(--gray-400, #99958a);
  text-align: center;
}

/* Успішна відправка */
.cb-success { display: none; text-align: center; padding: 10px 0 4px; }
.cb-success.is-visible { display: block; }
.cb-success__icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--gold-100, #faf0d0);
  color: var(--gold-700, #7d6217);
  display: grid;
  place-items: center;
}
.cb-success__icon svg { width: 31px; height: 31px; }
.cb-success h3 { margin-bottom: 8px; }
.cb-success p { font-size: .93rem; color: var(--text-soft, #726e64); margin: 0 0 20px; }
.cb-success__phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--gray-900, #1d1c18);
}
.cb-success__phone svg { width: 17px; height: 17px; color: var(--gold-600, #a5811f); }

/* Підказка біля плаваючої кнопки */
.cb-tip {
  position: fixed;
  right: 92px;
  bottom: 34px;
  z-index: 91;
  max-width: 236px;
  background: #fff;
  border: 1px solid var(--line, #dedbd2);
  border-radius: 14px;
  padding: 12px 15px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-800, #2a2823);
  box-shadow: 0 14px 34px rgba(29, 28, 24, .16);
  opacity: 0;
  visibility: hidden;
  transform: translateX(12px);
  transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
  cursor: pointer;
}
.cb-tip.is-visible { opacity: 1; visibility: visible; transform: none; }
.cb-tip::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  width: 13px; height: 13px;
  margin-top: -7px;
  background: #fff;
  border-right: 1px solid var(--line, #dedbd2);
  border-top: 1px solid var(--line, #dedbd2);
  transform: rotate(45deg);
}
.cb-tip small { display: block; font-weight: 400; color: var(--text-soft, #726e64); font-size: .78rem; margin-top: 2px; }
.cb-tip__close {
  position: absolute;
  top: -9px; left: -9px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line, #dedbd2);
  background: #fff;
  color: var(--gray-500, #726e64);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.cb-tip__close:hover { background: var(--gray-100, #eceae3); color: var(--gray-900, #1d1c18); }

body.cb-locked { overflow: hidden; }

@media (max-width: 560px) {
  .cb-overlay { align-items: flex-end; padding: 0; }
  .cb-modal {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    padding: 26px 20px calc(24px + env(safe-area-inset-bottom));
    transform: translateY(100%);
  }
  .cb-modal::before { border-radius: 22px 22px 0 0; }
  .cb-ways { grid-template-columns: repeat(2, 1fr); }
  .cb-tip { right: 16px; bottom: 88px; max-width: calc(100vw - 32px); }
  .cb-tip::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cb-overlay, .cb-modal, .cb-tip { transition-duration: .01ms !important; }
}