/*
 * Настраиваемые тосты сайта — современный вид в фирменной стилистике.
 * Рендерятся public/js/toasts.js из window.__SITE_TOASTS. Без сторонних библиотек.
 * Палитра: бирюза #149394 / #018283 / тёмная #0c4141. Шрифт: var(--fonts-m).
 */

:root {
  --toast-brand: #149394;
  --toast-brand-dark: #018283;
  --toast-text: #303036;
}

/* ── Контейнеры по позициям ──────────────────────────────────────────────── */
.site-toast-container {
  position: fixed;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: auto;
  max-width: calc(100vw - 32px);
  pointer-events: none; /* клики ловят сами тосты */
}
.site-toast-container > * { pointer-events: auto; }

.site-toast-container--topLeft     { top: 20px;    left: 20px; }
.site-toast-container--topRight    { top: 20px;    right: 20px; }
.site-toast-container--topCenter   { top: 20px;    left: 50%; transform: translateX(-50%); align-items: center; }
.site-toast-container--bottomLeft  { bottom: 20px; left: 20px;  flex-direction: column-reverse; }
.site-toast-container--bottomRight { bottom: 20px; right: 20px; flex-direction: column-reverse; }
.site-toast-container--bottomCenter{ bottom: 20px; left: 50%; transform: translateX(-50%); align-items: center; flex-direction: column-reverse; }
.site-toast-container--center      { top: 50%; left: 50%; transform: translate(-50%, -50%); align-items: center; }

/* ── Затемнение под модальным промо (как диалоговое окно) ─────────────────── */
.site-toast-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99990; /* ниже контейнеров тостов (99999) */
  background: rgba(8, 40, 40, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.site-toast-backdrop.is-in { opacity: 1; }

/* ── Базовый тост ────────────────────────────────────────────────────────── */
.site-toast {
  position: relative;
  display: flex;
  gap: 12px;
  width: 380px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 16px;
  background: #fff;
  color: var(--toast-text);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(12, 65, 65, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06);
  font-family: var(--fonts-m, system-ui, sans-serif);
  font-size: 15px;
  line-height: 1.45;
  /* анимация появления */
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
.site-toast.is-in { opacity: 1; transform: none; }
.site-toast.is-out { opacity: 0; transform: translateY(8px) scale(0.98); }

/* направление въезда зависит от стороны */
.site-toast-container--topLeft .site-toast,
.site-toast-container--bottomLeft .site-toast { transform: translateX(-16px); }
.site-toast-container--topRight .site-toast,
.site-toast-container--bottomRight .site-toast { transform: translateX(16px); }
.site-toast-container--topLeft .site-toast.is-in,
.site-toast-container--bottomLeft .site-toast.is-in,
.site-toast-container--topRight .site-toast.is-in,
.site-toast-container--bottomRight .site-toast.is-in { transform: none; }

/* ── Картинка ────────────────────────────────────────────────────────────── */
.site-toast__img {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

/* ── Тело ────────────────────────────────────────────────────────────────── */
.site-toast__body { min-width: 0; flex: 1 1 auto; }
.site-toast__title { font-family: var(--fonts-b, inherit); font-weight: 700; font-size: 15.5px; margin-bottom: 2px; }
.site-toast__msg { font-size: 14px; line-height: 1.5; opacity: 0.92; }
.site-toast__msg p { margin: 0.25em 0; }
.site-toast__msg p:first-child { margin-top: 0; }
.site-toast__msg p:last-child { margin-bottom: 0; }
.site-toast__msg a { color: var(--toast-link, var(--toast-brand-dark)); text-decoration: underline; text-underline-offset: 2px; }
.site-toast__msg ul, .site-toast__msg ol { margin: 0.25em 0; padding-left: 1.2em; }

/* ── Кнопка-ссылка ───────────────────────────────────────────────────────── */
.site-toast__btn {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 16px;
  border-radius: 999px;
  border: none;
  background: var(--toast-link, var(--toast-brand));
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.site-toast__btn:hover { filter: brightness(1.08); }
.site-toast__btn:active { transform: translateY(1px); }

/* ── Крестик ─────────────────────────────────────────────────────────────── */
.site-toast__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: currentColor;
  opacity: 0.45;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.site-toast__close:hover { opacity: 0.9; background: rgba(0, 0, 0, 0.06); }
.site-toast:has(.site-toast__close) .site-toast__body { padding-right: 14px; }

/* ── Полоса прогресса (для timeout) ──────────────────────────────────────── */
.site-toast__progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left center;
  background: var(--toast-link, var(--toast-brand));
  opacity: 0.5;
  animation: site-toast-progress linear forwards;
}
@keyframes site-toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── Шаблоны ─────────────────────────────────────────────────────────────── */
/* minimal — компактный, без картинки */
.site-toast--minimal { padding: 12px 14px; border-radius: 12px; }
.site-toast--minimal .site-toast__img { display: none; }

/* banner / cookie — шире и заметнее (цвета приходят из данных) */
.site-toast--banner,
.site-toast--cookie { width: 620px; }
.site-toast--banner { align-items: center; }
.site-toast--cookie { border-radius: 12px; }

/* promo — Hero-карточка: крупное фото-баннер сверху, жирный заголовок, CTA во всю ширину */
.site-toast--promo {
  width: 380px;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
  /* модальная глубина: сильная тень + тонкая светлая рамка */
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  /* глянцевый градиент-overlay поверх инлайнового bg_color — глубина при любом цвете */
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.28));
  /* более выраженное появление (модальный pop) */
  transform: translateY(16px) scale(0.94);
}
.site-toast--promo.is-in { transform: none; }
.site-toast--promo .site-toast__img {
  width: 100%;
  height: 160px;
  border-radius: 0;
  object-fit: cover;
}
.site-toast--promo .site-toast__body { padding: 16px 18px 18px; }
.site-toast--promo .site-toast__title { font-size: 19px; line-height: 1.25; }
.site-toast--promo .site-toast__msg { font-size: 14.5px; opacity: 0.95; }
.site-toast--promo .site-toast__btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 11px 18px;
  border-radius: 10px;
  text-align: center;
  font-size: 14.5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.site-toast--promo .site-toast__btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
/* крестик поверх фото — читаемый */
.site-toast--promo .site-toast__close {
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  opacity: 0.85;
}
.site-toast--promo .site-toast__close:hover { opacity: 1; background: rgba(0, 0, 0, 0.55); }
/* одноразовый «блик» по фото на появлении — чтобы цепляло */
.site-toast--promo:has(.site-toast__img)::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 160px;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.45) 50%, transparent 100%);
  transform: translateX(-180%) skewX(-12deg);
  animation: site-toast-shine 1.1s ease-out 0.35s 1;
  pointer-events: none;
}
@keyframes site-toast-shine { to { transform: translateX(320%) skewX(-12deg); } }

/* success / warning / error — цветной акцент слева (цвета из данных тоже работают) */
.site-toast--success { border-left: 4px solid #10b981; }
.site-toast--warning { border-left: 4px solid #f59e0b; }
.site-toast--error   { border-left: 4px solid #ef4444; }

/* ── Мобильные ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-toast-container {
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    transform: none;
    align-items: stretch;
  }
  .site-toast,
  .site-toast--banner,
  .site-toast--promo,
  .site-toast--cookie { width: 100%; }
  .site-toast-container--topCenter,
  .site-toast-container--center { top: 16px; }
  .site-toast-container--bottomCenter { bottom: 16px; }
  .site-toast-container--center { top: auto; bottom: 16px; }
}

/* уважение к prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .site-toast { transition: opacity 0.2s ease; transform: none !important; }
  .site-toast__progress { animation: none; }
  .site-toast--promo::after { display: none; }
}
