/* ==========================================================================
   OstuGrupp — Engagement & UX
   Cookie-consent banner · newsletter popup · app-like mobile bottom nav.
   Uses the design tokens from main.css.
   ========================================================================== */

/* ==========================================================================
   Dark mode fully removed — the site is LIGHT-ONLY by design.
   The former toggle only half-applied (white surfaces on a slate page), so it
   was dropped. engagement.js → forceLightTheme() strips any stale [data-theme]
   and forces 'light'; inc/engagement.php localizes defaultDark:0. No code path
   sets [data-theme="dark"], so the old dark rules were unreachable and removed.
   ========================================================================== */

/* ==========================================================================
   1. Cookie-consent banner
   ========================================================================== */
.og-cookie {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200;
  background: var(--slate-dark); color: #e2e8f0;
  border-top: 3px solid var(--green);
  box-shadow: 0 -8px 30px -12px rgba(0,0,0,.45);
  transform: translateY(110%);
  transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.og-cookie[hidden] { display: none; }
.og-cookie.is-visible { transform: translateY(0); }
.og-cookie__inner {
  display: flex; flex-direction: column; gap: 14px;
  padding-block: 16px; align-items: flex-start;
}
.og-cookie__title {
  font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff;
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.og-cookie__icon { font-size: 18px; }
.og-cookie__desc { font-size: 13.5px; line-height: 1.6; color: #cbd5e1; max-width: 760px; }
.og-cookie__link { color: var(--green-bright); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.og-cookie__link:hover { color: #6ee7b7; }
.og-cookie__actions { display: flex; gap: 10px; flex-wrap: wrap; width: 100%; }
.og-cookie__btn { min-height: 44px; flex: 1; }
.og-cookie .og-cookie__btn.btn-secondary {
  background: transparent; color: #e2e8f0; border-color: rgba(255,255,255,.25);
}
.og-cookie .og-cookie__btn.btn-secondary:hover { border-color: var(--green); color: #fff; background: rgba(255,255,255,.04); }

@media (min-width: 768px) {
  .og-cookie__inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 28px; }
  .og-cookie__actions { width: auto; flex-shrink: 0; }
  .og-cookie__btn { flex: 0 0 auto; padding-inline: 22px; }
}

/* Keep the cookie banner clear of the mobile bottom nav, including the safe-area
   inset the bottom nav adds on notched phones (otherwise the banner overlaps the
   nav's extended bottom). */
@media (max-width: 1023.98px) {
  .og-cookie { bottom: calc(var(--og-bottomnav-h, 64px) + env(safe-area-inset-bottom, 0px)); }
}

/* ==========================================================================
   2. Newsletter popup
   ========================================================================== */
.og-popup { position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.og-popup[hidden] { display: none; }
.og-popup__backdrop {
  position: absolute; inset: 0; background: rgba(15,23,42,.62); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .3s ease;
}
.og-popup.is-visible .og-popup__backdrop { opacity: 1; }
.og-popup__card {
  position: relative; width: min(460px, 100%);
  background: #fff; border-radius: var(--radius-2xl);
  box-shadow: 0 30px 80px -20px rgba(15,23,42,.55);
  padding: 36px 30px 28px; overflow: hidden;
  border: 1px solid var(--border);
  transform: translateY(16px) scale(.97); opacity: 0;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
}
.og-popup.is-visible .og-popup__card { transform: translateY(0) scale(1); opacity: 1; }
.og-popup__card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--green), var(--green-dark));
}
.og-popup__close {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; line-height: 1; color: var(--slate-500);
  background: var(--muted); border: 1px solid var(--border); border-radius: 10px;
  transition: background .2s ease, color .2s ease;
}
.og-popup__close:hover { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.og-popup__view { text-align: center; }
.og-popup__view[hidden] { display: none; }
.og-popup__eyebrow { justify-content: center; margin-bottom: 8px; }
.og-popup__title { font-size: clamp(22px, 4.5vw, 27px); line-height: 1.2; margin-bottom: 10px; }
.og-popup__desc { color: var(--slate-600); font-size: 15px; line-height: 1.6; margin-bottom: 20px; }
.og-popup__form { display: flex; flex-direction: column; gap: 10px; }
.og-popup__input {
  width: 100%; min-height: 50px; padding: 12px 16px; font: inherit;
  background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--fg); transition: border-color .2s ease, box-shadow .2s ease;
}
.og-popup__input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(5,150,105,.18); }
.og-popup__input.has-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.16); }
.og-popup__submit { width: 100%; min-height: 50px; font-size: 15px; }
.og-popup__fineprint { margin-top: 14px; font-size: 12px; color: var(--slate-500); }
.og-popup__success { padding-block: 8px; }
.og-popup__success-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%;
  background: rgba(5,150,105,.12); color: var(--green-dark);
  font-size: 30px; font-weight: 800;
}
.og-popup__done { margin-top: 18px; min-height: 44px; }

@media (min-width: 480px) {
  .og-popup__form { flex-direction: row; }
  .og-popup__submit { width: auto; flex-shrink: 0; padding-inline: 24px; }
}

/* ==========================================================================
   3. App-like mobile bottom nav (≤1024px)
   ========================================================================== */
:root { --og-bottomnav-h: 64px; }

.og-bottomnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px -16px rgba(15,23,42,.4);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 1023.98px) {
  .og-bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: stretch; }
  /* Reserve space so fixed content (back-to-top, sticky ATC) and page content
     are never hidden behind the bar. */
  body { padding-bottom: calc(var(--og-bottomnav-h) + env(safe-area-inset-bottom, 0px)); }
  /* Nudge the cart module's floating buttons above the bar. */
  .back-to-top { bottom: calc(var(--og-bottomnav-h) + 16px); }
  .sticky-atc { bottom: var(--og-bottomnav-h); }
}

.og-bottomnav__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--og-bottomnav-h); padding: 6px 4px;
  background: transparent; border: 0; color: var(--slate-500);
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  text-align: center; position: relative;
  transition: color .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.og-bottomnav__item:hover { color: var(--green); }
.og-bottomnav__item.is-active { color: var(--green-dark); }
.og-bottomnav__item.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--green);
}
.og-bottomnav__icon { position: relative; display: inline-flex; }
.og-bottomnav__icon svg { width: 23px; height: 23px; display: block; }
.og-bottomnav__label {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -.01em;
}
.og-bottomnav__item:focus-visible { outline: 2px solid var(--green); outline-offset: -4px; border-radius: 8px; }

/* Very small phones: shrink the label a touch and tighten padding so the longest
   label ("Kategooriad") fits each 1/5 cell without ellipsis truncation. */
@media (max-width: 380px) {
  .og-bottomnav__item { padding-inline: 2px; font-size: 10px; }
  .og-bottomnav__label { letter-spacing: -.02em; }
}

/* Live cart count badge on the bottom-nav cart item. */
.og-bottomnav__count {
  position: absolute; top: -6px; right: -10px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: none; align-items: center; justify-content: center;
  background: var(--green); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1;
  border: 2px solid rgba(255,255,255,.96);
}
.og-bottomnav__count.is-visible { display: inline-flex; }

/* ==========================================================================
   Reduced motion — kill the slide/scale transitions for those who ask.
   (main.css already neutralises animation/transition durations globally; this
   makes the intent explicit for the entrance transforms.)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .og-cookie,
  .og-popup__card,
  .og-popup__backdrop,
  html { transition: none !important; }
}
