/* ============================================
   Всплывающее окно сайта (popup)
   Управляется из Админка → Всплывающее окно
   4 готовых шаблона: classic, promo, subscribe, exit
   ============================================ */

.sc-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 18, 32, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease;
}
.sc-popup-overlay[hidden] { display: none; }
.sc-popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.sc-popup {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 18, 32, 0.35);
  transform: translateY(18px) scale(0.97);
  opacity: 0;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .28s ease;
}
.sc-popup-overlay.is-visible .sc-popup {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.sc-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.sc-popup__close:hover { background: #fff; }

.sc-popup__media {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  background: #f1f2f8;
}
.sc-popup__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sc-popup__body {
  padding: 24px 24px 26px;
  text-align: center;
}
.sc-popup__title {
  margin: 0 0 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a1d29;
}
.sc-popup__text {
  margin: 0 0 18px;
  color: #565b72;
  font-size: 0.95rem;
  line-height: 1.5;
}
.sc-popup__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.sc-popup__btn {
  display: inline-block;
  width: 100%;
  padding: 12px 20px;
  border-radius: 12px;
  background: #4f46e5;
  color: #fff !important;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: transform .12s ease, background .15s ease;
}
.sc-popup__btn:hover {
  background: #4338ca;
  transform: translateY(-1px);
}
.sc-popup__dismiss {
  border: none;
  background: none;
  color: #9296a8;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px;
}
.sc-popup__dismiss:hover { color: #565b72; text-decoration: underline; }

/* ---------- Шаблон: Классический ---------- */
.sc-popup--classic { --accent: #4f46e5; }
.sc-popup--classic .sc-popup__btn { background: var(--accent); }
.sc-popup--classic .sc-popup__btn:hover { background: #4338ca; }

/* ---------- Шаблон: Акция / Скидка ---------- */
.sc-popup--promo {
  border: 2px solid #ff8a3d;
  background: linear-gradient(180deg, #fff 0%, #fff7f0 100%);
}
.sc-popup--promo::before {
  content: '🔥 Акция';
  position: absolute;
  top: -1px;
  left: 20px;
  background: linear-gradient(120deg, #ff8a3d, #ff5f6d);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 5px 14px;
  border-radius: 0 0 10px 10px;
  z-index: 1;
}
.sc-popup--promo .sc-popup__title { color: #d9480f; }
.sc-popup--promo .sc-popup__btn {
  background: linear-gradient(120deg, #ff8a3d, #ff5f6d);
}
.sc-popup--promo .sc-popup__btn:hover { filter: brightness(0.95); }

/* ---------- Шаблон: Подписка ---------- */
.sc-popup--subscribe {
  background: linear-gradient(180deg, #eef2ff 0%, #fff 55%);
}
.sc-popup--subscribe .sc-popup__media {
  border-radius: 18px 18px 0 0;
}
.sc-popup--subscribe .sc-popup__title {
  color: #3730a3;
}
.sc-popup--subscribe .sc-popup__btn {
  background: #3730a3;
  border-radius: 999px;
}
.sc-popup--subscribe .sc-popup__btn:hover { background: #312e81; }

/* ---------- Шаблон: Прощальный (exit-intent) ---------- */
.sc-popup--exit {
  background: #fffdf5;
  border: 1px solid #fde68a;
}
.sc-popup--exit .sc-popup__title {
  color: #92400e;
}
.sc-popup--exit .sc-popup__text { color: #78716c; }
.sc-popup--exit .sc-popup__btn {
  background: #d97706;
}
.sc-popup--exit .sc-popup__btn:hover { background: #b45309; }

/* ---------- Адаптив для мобильных ---------- */
@media (max-width: 480px) {
  .sc-popup-overlay { padding: 10px; align-items: flex-end; }
  .sc-popup {
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 85vh;
  }
  .sc-popup__media { max-height: 160px; }
  .sc-popup__body { padding: 20px 18px 22px; }
  .sc-popup__title { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-popup-overlay, .sc-popup { transition: none; }
}
