/**
 * SBWCASC Popups — стили гео-попапов.
 *
 * Изоляция: все селекторы с префиксом .sbasc-; ничего глобального.
 * Кастомизация: переопределите CSS-переменные --sbasc-* (в теме или кастомном CSS) —
 * цвета, радиусы, шрифт, z-index.
 *
 * @package SBWCASC
 * @since   0.2.0
 */

.sbasc-pop {
  --sbasc-accent: #cda746;
  --sbasc-ink: #101010;
  --sbasc-bg: #ffffff;
  --sbasc-muted: #6f6f6f;
  --sbasc-line: #e8e4dc;
  --sbasc-radius: 16px;
  --sbasc-btn-radius: 10px;
  --sbasc-z: 99990;
  --sbasc-font-family: inherit;
  --sbasc-shadow: 0 18px 60px rgba(16, 16, 16, 0.22);
  font-family: var(--sbasc-font-family);
}

/* ---------- overlay ---------- */
.sbasc-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--sbasc-z);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 16, 16, 0.52);
  opacity: 0;
  transition: opacity 0.18s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  box-sizing: border-box;
}
.sbasc-overlay[hidden] { display: none; }
.sbasc-overlay.is-open { opacity: 1; }

/* ---------- modal ---------- */
.sbasc-modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: min(88vh, 720px);
  overflow-y: auto;
  background: var(--sbasc-bg);
  color: var(--sbasc-ink);
  border-radius: var(--sbasc-radius);
  box-shadow: var(--sbasc-shadow);
  padding: 26px 26px 22px;
  box-sizing: border-box;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.18s ease;
}
.sbasc-overlay.is-open .sbasc-modal { transform: translateY(0) scale(1); }

.sbasc-modal--b { max-width: 400px; text-align: center; }
.sbasc-modal--b .sbasc-title { padding: 8px 18px 0; }

.sbasc-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--sbasc-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
}
.sbasc-x:hover { color: var(--sbasc-ink); }
.sbasc-x:focus-visible { outline: 2px solid var(--sbasc-accent); outline-offset: 1px; }

/* ---------- content ---------- */
.sbasc-head { display: flex; flex-direction: column; gap: 6px; padding-right: 26px; }
.sbasc-head__flag { font-size: 34px; line-height: 1; }
.sbasc-title {
  margin: 0;
  font-family: var(--sbasc-font-family);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}
.sbasc-title--center { text-align: center; }
.sbasc-nowrap { white-space: nowrap; }

.sbasc-text {
  margin: 12px 0 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--sbasc-muted);
}

/* ---------- newsletter ---------- */
.sbasc-nl { margin-top: 18px; }
.sbasc-nl__row { display: flex; gap: 8px; }
.sbasc-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--sbasc-line);
  border-radius: var(--sbasc-btn-radius);
  padding: 11px 13px;
  font-family: var(--sbasc-font-family);
  font-size: 14px;
  color: var(--sbasc-ink);
  background: #fff;
  box-sizing: border-box;
}
.sbasc-input:focus { outline: none; border-color: var(--sbasc-accent); }
.sbasc-note { margin: 8px 0 0; font-size: 12px; color: var(--sbasc-muted); }
.sbasc-note--ok { color: #2e7d32; font-weight: 600; }

/* ---------- buttons ---------- */
.sbasc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--sbasc-btn-radius);
  padding: 11px 18px;
  font-family: var(--sbasc-font-family);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}
.sbasc-btn:focus-visible { outline: 2px solid var(--sbasc-accent); outline-offset: 2px; }
.sbasc-btn--primary { background: var(--sbasc-ink); color: #fff; }
.sbasc-btn--primary:hover { opacity: 0.88; }
.sbasc-btn--primary[disabled] { opacity: 0.45; cursor: default; }
.sbasc-btn--ghost { background: transparent; color: var(--sbasc-ink); border-color: var(--sbasc-line); }
.sbasc-btn--ghost:hover { border-color: var(--sbasc-ink); }
.sbasc-btn--ghost[disabled] { opacity: 0.45; cursor: default; }
.sbasc-btn--sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }

.sbasc-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.sbasc-actions .sbasc-btn { min-width: 96px; }

.sbasc-link {
  border: 0;
  background: none;
  padding: 4px;
  color: var(--sbasc-muted);
  font-size: 13px;
  font-family: var(--sbasc-font-family);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.sbasc-link:hover { color: var(--sbasc-ink); }

/* ---------- country pick ---------- */
.sbasc-pick { margin-top: 18px; }
.sbasc-pick__label { margin: 0 0 8px; font-size: 13px; color: var(--sbasc-muted); }
.sbasc-pick__row { display: flex; gap: 8px; }
.sbasc-select {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--sbasc-line);
  border-radius: var(--sbasc-btn-radius);
  padding: 10px 12px;
  font-family: var(--sbasc-font-family);
  font-size: 14px;
  color: var(--sbasc-ink);
  background: #fff;
  box-sizing: border-box;
}
.sbasc-select:focus { outline: none; border-color: var(--sbasc-accent); }

.sbasc-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--sbasc-line);
  text-align: center;
}

/* ---------- mobile top bar ---------- */
.sbasc-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--sbasc-z);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  padding-top: calc(9px + env(safe-area-inset-top, 0px));
  background: var(--sbasc-ink);
  color: #fff;
  box-shadow: 0 6px 24px rgba(16, 16, 16, 0.25);
  transform: translateY(-102%);
  transition: transform 0.2s ease;
  box-sizing: border-box;
}
.sbasc-bar[hidden] { display: none; }
.sbasc-bar.is-open { transform: translateY(0); }
.sbasc-bar__text { font-size: 13.5px; font-weight: 600; }
.sbasc-bar__actions { display: inline-flex; align-items: center; gap: 6px; }
.sbasc-bar .sbasc-btn--sm { background: var(--sbasc-accent); color: var(--sbasc-ink); }
.sbasc-bar .sbasc-btn--ghost { color: #fff; border-color: rgba(255, 255, 255, 0.45); background: transparent; }
.sbasc-bar .sbasc-btn--ghost:hover { border-color: #fff; }
.sbasc-x--bar { position: static; color: rgba(255, 255, 255, 0.7); font-size: 20px; width: 28px; height: 28px; }
.sbasc-x--bar:hover { color: #fff; }

/* ---------- mobile: bottom sheets ---------- */
@media (max-width: 768px) {
  .sbasc-overlay { align-items: flex-end; padding: 0; }
  .sbasc-modal {
    max-width: none;
    border-radius: var(--sbasc-radius) var(--sbasc-radius) 0 0;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateY(28px);
    max-height: 92vh;
  }
  .sbasc-overlay.is-open .sbasc-modal { transform: translateY(0); }
  .sbasc-nl__row { flex-wrap: wrap; }
  .sbasc-nl__row .sbasc-btn { width: 100%; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .sbasc-overlay,
  .sbasc-modal,
  .sbasc-bar { transition: none; }
}
