/* ==========================================================================
   XpressCoupon UX Pack V117 — patterns adapted from 21st.dev into vanilla CSS
   1) Floating mobile dock (replaces the 3 legacy sticky bottom bars)
   2) Pointer-spotlight ring on cards (hover-capable devices only)
   3) Toast upgrade (card style w/ icon chip)
   4) Sticky filter chips on the homepage coupon browser
   All colors/typography inherit the existing token system.
   ========================================================================== */

/* ---------- 0. Retire legacy bottom bars ---------- */
.sticky-cta,
.mobile-sticky-cta,
.lp-sticky-cta { display: none !important; }

@media (max-width: 860px) {
  body.xc-has-dock { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ---------- 1. Floating dock (mobile) ---------- */
.xc-dock {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 65;
  display: none;
  gap: 2px;
  padding: 6px;
  width: min(94vw, 420px);
  background: oklch(1 0 0 / .88);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border: 1px solid var(--line, oklch(0.90 0.01 50));
  border-radius: 22px;
  box-shadow: 0 18px 44px oklch(0.4 0.06 45 / .18), 0 4px 12px oklch(0.4 0.04 45 / .10);
  transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .25s ease;
}
.xc-dock--hidden { transform: translateX(-50%) translateY(140%); opacity: 0; pointer-events: none; }

.xc-dock__item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 7px 4px;
  border-radius: 16px;
  font-family: var(--font-display, var(--fd, Inter, sans-serif));
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: .02em;
  color: var(--ink-soft, oklch(0.46 0.02 45));
  text-decoration: none !important;
  background: none;
  border: 0;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.xc-dock__item svg { width: 21px; height: 21px; flex: none; }
.xc-dock__item:active { transform: scale(.94); }
.xc-dock__item:hover { color: var(--accent, oklch(0.63 0.21 28)); background: var(--accent-soft, oklch(0.95 0.05 40)); }
.xc-dock__item[aria-current="page"],
.xc-dock__item.is-active {
  color: #fff;
  background: var(--accent, oklch(0.63 0.21 28));
  box-shadow: 0 8px 18px var(--accent-glow, oklch(0.63 0.21 28 / .35));
}

@media (max-width: 860px) { .xc-dock { display: flex; } }

/* ---------- 2. Pointer-spotlight ring on cards ---------- */
@media (hover: hover) and (pointer: fine) {
  .coupon-card, .sale-card, .deal-card, .post-card, .verify-card {
    position: relative;
  }
  .coupon-card::after,
  .sale-card::after,
  .deal-card::after,
  .post-card::after,
  .verify-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: radial-gradient(
      220px circle at var(--mx, 50%) var(--my, 50%),
      var(--accent, oklch(0.63 0.21 28)) 0%,
      var(--accent-2, oklch(0.74 0.16 58)) 30%,
      transparent 70%
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
    z-index: 2;
  }
  .coupon-card:hover::after,
  .sale-card:hover::after,
  .deal-card:hover::after,
  .post-card:hover::after,
  .verify-card:hover::after { opacity: 1; }

  /* list rows get a soft radial wash instead of a ring */
  .code-row { position: relative; }
  .code-row::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
      320px circle at var(--mx, 50%) var(--my, 50%),
      var(--accent-soft, oklch(0.95 0.05 40)) 0%,
      transparent 65%
    );
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
  }
  .code-row:hover::before { opacity: .8; }
  .code-row > * { position: relative; }
}

/* ---------- 3. Toast upgrade ---------- */
.toast {
  border-radius: 16px !important;
  padding: 13px 20px 13px 14px !important;
  font-size: 15px !important;
  gap: 12px !important;
  max-width: min(92vw, 400px) !important;
  border: 1px solid oklch(1 0 0 / .12);
}
.toast svg {
  width: 32px !important;
  height: 32px !important;
  padding: 7px;
  border-radius: 50%;
  background: var(--green-soft, oklch(0.95 0.05 150));
  color: var(--green, oklch(0.62 0.15 150)) !important;
}
@media (max-width: 860px) {
  body.xc-has-dock .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ---------- 4. Sticky filter chips (homepage coupon browser) ---------- */
@supports (position: sticky) {
  .filter-tabs {
    position: sticky;
    top: calc(var(--header-h, 70px) + 10px);
    z-index: 35;
    background: oklch(0.985 0.006 60 / .85);
    -webkit-backdrop-filter: saturate(150%) blur(12px);
    backdrop-filter: saturate(150%) blur(12px);
    padding: 10px 12px;
    margin-inline: -12px;
    border-radius: 18px;
    border: 1px solid transparent;
    transition: border-color .25s ease, box-shadow .25s ease;
  }
  .filter-tabs.is-stuck {
    border-color: var(--line-soft, oklch(0.94 0.008 50));
    box-shadow: var(--shadow-md, 0 8px 24px oklch(0.4 0.04 45 / .10));
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .xc-dock { transition: none; }
  .xc-dock--hidden { transform: translateX(-50%); opacity: 1; pointer-events: auto; }
  .coupon-card::after, .sale-card::after, .deal-card::after,
  .post-card::after, .verify-card::after, .code-row::before { transition: none; }
}
