/* ─────────────────────────────────────────────────────────────────────
 * ShippingHub — Cookie consent banner
 *
 * Three layout variants share a common typography + button style:
 *   .sh-cookie-style-top    → fixed strip at the top of the viewport
 *   .sh-cookie-style-bottom → fixed strip at the bottom of the viewport
 *   .sh-cookie-style-center → modal-style popup with full-screen overlay
 *
 * The banner is purely client-side — sh-cookie.js builds the DOM, this
 * file styles whatever the JS produces. No theme dependencies.
 * ─────────────────────────────────────────────────────────────────────*/

.sh-cookie-banner,
.sh-cookie-overlay {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  box-sizing: border-box;
}

.sh-cookie-banner *,
.sh-cookie-banner *::before,
.sh-cookie-banner *::after { box-sizing: border-box; }

/* Banner content (shared across all 3 variants) */
.sh-cookie-banner {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  padding: 18px 24px;
  z-index: 999990;
}
.sh-cookie-banner__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.sh-cookie-banner__text {
  flex: 1 1 320px;
  min-width: 280px;
}
.sh-cookie-banner__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  color: #111827;
}
.sh-cookie-banner__body {
  font-size: 13px;
  color: #4b5563;
  margin: 0;
}
.sh-cookie-banner__body a {
  color: #ea580c;
  text-decoration: underline;
}
.sh-cookie-banner__body a:hover { color: #c2410c; }

.sh-cookie-banner__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.sh-cookie-banner__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color .15s, border-color .15s, color .15s;
  white-space: nowrap;
  font-family: inherit;
}
.sh-cookie-banner__btn--accept {
  background: #ea580c;
  color: #ffffff;
  border-color: #ea580c;
}
.sh-cookie-banner__btn--accept:hover,
.sh-cookie-banner__btn--accept:focus {
  background: #c2410c;
  border-color: #c2410c;
  color: #ffffff;
}
.sh-cookie-banner__btn--decline {
  background: transparent;
  color: #4b5563;
  border-color: #d1d5db;
}
.sh-cookie-banner__btn--decline:hover,
.sh-cookie-banner__btn--decline:focus {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}

/* ── Variant: top strip ───────────────────────────────────────────── */
.sh-cookie-style-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* ── Variant: bottom strip ────────────────────────────────────────── */
.sh-cookie-style-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  border-bottom: 0;
  border-left: 0;
  border-right: 0;
  border-top: 1px solid #e5e7eb;
}

/* ── Variant: centred popup with full-screen overlay ─────────────── */
.sh-cookie-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 999985;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: shCookieFadeIn .18s ease-out;
}
.sh-cookie-style-center {
  position: static;
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  animation: shCookiePopIn .22s cubic-bezier(.2, .8, .2, 1);
}
.sh-cookie-style-center .sh-cookie-banner__inner {
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
}
.sh-cookie-style-center .sh-cookie-banner__text { flex: 1 1 auto; }
.sh-cookie-style-center .sh-cookie-banner__title {
  font-size: 18px;
  margin-bottom: 8px;
}
.sh-cookie-style-center .sh-cookie-banner__body { font-size: 14px; }
.sh-cookie-style-center .sh-cookie-banner__actions {
  flex-direction: row-reverse;
  justify-content: flex-start;
  gap: 12px;
}
.sh-cookie-style-center .sh-cookie-banner__btn { flex: 1 1 auto; }

@keyframes shCookieFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes shCookiePopIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ── Mobile (≤640px) ──────────────────────────────────────────────
 * Mobile-first compact layout. The previous rules stacked everything
 * top-to-bottom with generous padding — that pushed the banner up
 * roughly half the viewport height on small phones, with text sitting
 * awkwardly near the top of the banner because the buttons reserved
 * the bottom half. The fixes below:
 *   • Tighter padding (10px 12px instead of 14px 16px)
 *   • Smaller, denser typography (14px title, 12px body)
 *   • Title + body in the same block, no extra gap between them
 *   • Buttons stay on ONE row at the bottom of the banner (no stretch
 *     to full column) so the banner stays slim
 *   • Hard cap on banner height: max 45% of viewport, scroll inside
 *     if the body text is exceptionally long
 *   • Center popup variant: full-width on phones with bottom-anchored
 *     positioning so it looks like a native sheet rather than a tiny
 *     pill floating in the middle.
 * ────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sh-cookie-banner {
    padding: 12px 14px 14px;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.10);
  }
  .sh-cookie-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .sh-cookie-banner__text { min-width: 0; }
  .sh-cookie-banner__title {
    font-size: 14px;
    margin-bottom: 2px;
    line-height: 1.3;
  }
  .sh-cookie-banner__body {
    font-size: 12.5px;
    line-height: 1.4;
    color: #4b5563;
  }
  .sh-cookie-banner__actions {
    flex-direction: row;
    justify-content: stretch;
    gap: 8px;
  }
  .sh-cookie-banner__btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 9px 12px;
    font-size: 13px;
  }

  /* Bottom + top strips: cap height so they never take half the
     viewport. Inner text scrolls if the merchant configures a long
     consent paragraph. */
  .sh-cookie-style-bottom,
  .sh-cookie-style-top {
    max-height: 45vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Center popup → bottom-sheet style on phones */
  .sh-cookie-overlay { padding: 0; align-items: flex-end; }
  .sh-cookie-style-center {
    border-radius: 14px 14px 0 0;
    max-width: 100%;
    padding: 18px 16px 22px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.22);
  }
  .sh-cookie-style-center .sh-cookie-banner__inner { gap: 12px; }
  .sh-cookie-style-center .sh-cookie-banner__title { font-size: 16px; }
  .sh-cookie-style-center .sh-cookie-banner__body  { font-size: 13.5px; }
  .sh-cookie-style-center .sh-cookie-banner__actions { gap: 10px; }
}

/* Very narrow phones (iPhone SE / older Android 320–360px) — squeeze
   even more. Keeps the banner under ~35% of viewport height. */
@media (max-width: 360px) {
  .sh-cookie-banner { padding: 10px 12px 12px; }
  .sh-cookie-banner__title { font-size: 13.5px; }
  .sh-cookie-banner__body  { font-size: 12px; }
  .sh-cookie-banner__btn   { padding: 8px 10px; font-size: 12.5px; }
}

/* Hidden helper (JS toggles via display: none / removal) */
.sh-cookie-hidden { display: none !important; }
