/* Compare page: app layer (category dropdown, live badge, sticky dock, share card, motion).
   Uses the page's own design tokens so light and dark mode both work. */

:root { --bbp-dock-top: 86px; }
@media (max-width: 760px) { :root { --bbp-dock-top: 76px; } }

/* ---------- press feedback on existing controls ---------- */
.quick-chip, .popular-chip, .compare-btn, .buy-btn, .save-matrix-btn {
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.quick-chip:active, .popular-chip:active, .compare-btn:not(:disabled):active, .buy-btn:active { transform: scale(.97); }

/* ---------- horizontal chip rows on phones ---------- */
@media (max-width: 760px) {
  .bbp-hscroll { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto; gap: 8px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .bbp-hscroll::-webkit-scrollbar { display: none; }
  .bbp-hscroll > * { flex: 0 0 auto; scroll-snap-align: start; }
}

/* ---------- category dropdown (replaces the 26 card grid) ---------- */
#catGrid.bbp-replaced { display: none; }
.bbp-cat { position: relative; margin: 0 0 4px; }
.bbp-cat-btn {
  width: 100%; display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 12px 16px;
  background: var(--card-bg); border: 1.5px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); color: var(--text-1); text-align: left; cursor: pointer;
  font-family: inherit; transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.bbp-cat-btn:hover { border-color: var(--orange); box-shadow: var(--shadow-md); }
.bbp-cat-btn:active { transform: scale(.99); }
.bbp-cat-btn:focus-visible, .bbp-cat-search:focus-visible, .bbp-cat-opt:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.bbp-cat-btn[aria-expanded="true"] { border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-glow); }
.bbp-cat-ico { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: rgba(255,107,53,.12); color: var(--orange); }
.bbp-cat-ico svg { width: 22px; height: 22px; }
.bbp-cat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bbp-cat-label { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-3); }
.bbp-cat-value { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bbp-cat-value.is-empty { color: var(--text-2); font-weight: 600; }
.bbp-cat-chev { flex: 0 0 auto; width: 22px; height: 22px; color: var(--text-3); transition: transform .2s ease; }
.bbp-cat-btn[aria-expanded="true"] .bbp-cat-chev { transform: rotate(180deg); }

.bbp-cat-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 60; overflow: hidden;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xl);
  opacity: 0; transform: translateY(-6px) scale(.99); pointer-events: none; visibility: hidden;
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.bbp-cat-panel.open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
.bbp-cat-grab { display: none; }
.bbp-cat-head { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); }
.bbp-cat-search { flex: 1; min-width: 0; min-height: 46px; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--text-1); background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--r-md); }
.bbp-cat-close { display: none; width: 46px; height: 46px; border: none; border-radius: 50%; background: var(--bg-alt); color: var(--text-1); cursor: pointer; place-items: center; }
.bbp-cat-close svg { width: 18px; height: 18px; }
.bbp-cat-list { list-style: none; margin: 0; padding: 4px 6px 10px; max-height: 380px; overflow-y: auto; overscroll-behavior: contain; }
.bbp-cat-group { padding: 14px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--text-3); }
.bbp-cat-opt { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--text-1); }
.bbp-cat-opt svg.ico { width: 20px; height: 20px; flex: 0 0 auto; color: var(--text-3); }
.bbp-cat-opt .tick { margin-left: auto; width: 18px; height: 18px; color: var(--orange); opacity: 0; }
.bbp-cat-opt:hover, .bbp-cat-opt.is-active { background: var(--bg-alt); }
.bbp-cat-opt[aria-selected="true"] { background: rgba(255,107,53,.12); }
.bbp-cat-opt[aria-selected="true"] .tick { opacity: 1; }
.bbp-cat-opt mark { background: rgba(255,107,53,.25); color: inherit; border-radius: 3px; padding: 0 1px; }
.bbp-cat-empty { padding: 20px; text-align: center; font-size: 14px; color: var(--text-2); }
.bbp-cat-backdrop { display: none; }

@media (max-width: 760px) {
  .bbp-cat-panel {
    position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 1000; max-height: 84vh;
    border-radius: 22px 22px 0 0; border-bottom: none; opacity: 1; visibility: hidden;
    transform: translateY(100%); transition: transform .3s cubic-bezier(.32,.72,0,1), visibility .3s;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bbp-cat-panel.open { transform: translateY(0); visibility: visible; }
  .bbp-cat-grab { display: block; width: 42px; height: 5px; margin: 10px auto 0; border-radius: 99px; background: var(--border-strong); }
  .bbp-cat-close { display: grid; }
  .bbp-cat-list { max-height: calc(84vh - 150px); }
  .bbp-cat-backdrop { display: block; position: fixed; inset: 0; z-index: 999; background: rgba(14,14,26,.52); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
  .bbp-cat-backdrop.open { opacity: 1; pointer-events: auto; }
}

/* ---------- recent comparisons ---------- */
.bbp-recent { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.bbp-recent[hidden] { display: none; }
.bbp-recent-label { font-size: 12px; font-weight: 700; color: var(--text-3); }
.bbp-recent-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border: 1.5px solid var(--border); border-radius: var(--r-pill); background: var(--card-bg); color: var(--text-1); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .2s ease, transform .15s ease; }
.bbp-recent-chip:hover { border-color: var(--orange); }
.bbp-recent-chip:active { transform: scale(.97); }

/* ---------- loading status ---------- */
.bbp-loadmsg { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 18px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.bbp-loadmsg .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); animation: bbpPulse 1.2s ease-in-out infinite; }

/* ---------- live badge ---------- */
.bbp-live { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0 auto 14px; padding: 7px 14px; width: fit-content; max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--card-bg); font-size: 12px; font-weight: 700; color: var(--text-2); }
.bbp-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #16A34A; box-shadow: 0 0 0 0 rgba(22,163,74,.55); animation: bbpLive 1.8s ease-out infinite; }
.bbp-live-time { color: var(--text-3); font-weight: 600; }

/* ---------- animated scores and winner reveal ---------- */
.score-bar-fill { transition: width .95s cubic-bezier(.22,1,.36,1); }
.bbp-win { position: relative; }
.bbp-win::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; border: 2px solid rgba(22,163,74,.55); pointer-events: none; animation: bbpRing 2.6s ease-out 1 both; }
.bbp-pop { animation: bbpPop .55s cubic-bezier(.34,1.56,.64,1) .35s both; }
@keyframes bbpPop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes bbpRing { 0% { opacity: 0; transform: scale(.985); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.02); } }
@keyframes bbpLive { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 9px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
@keyframes bbpPulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* ---------- sticky dock: mini VS bar + section tabs ---------- */
.vs-banner, .compare-table-wrap, #scoreWrap, .features-wrap, #prosconsWrap, .buy-wrap, #bbpShareCard { scroll-margin-top: calc(var(--bbp-dock-top) + 96px); }
.bbp-dock {
  position: fixed; left: 50%; top: var(--bbp-dock-top); z-index: 80; width: min(920px, calc(100% - 20px));
  transform: translate(-50%, -140%); opacity: 0; pointer-events: none;
  background: color-mix(in srgb, var(--card-bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  transition: transform .3s cubic-bezier(.32,.72,0,1), opacity .2s ease;
}
.bbp-dock.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.bbp-dock-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.bbp-dock-p { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 6px; border: none; border-radius: 12px; background: transparent; color: var(--text-1); font: inherit; text-align: left; cursor: pointer; }
.bbp-dock-p:hover { background: var(--bg-alt); }
.bbp-dock-p img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; flex: 0 0 auto; }
.bbp-dock-p .nm { display: block; font-size: 12.5px; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bbp-dock-p .pr { display: block; font-size: 12px; font-weight: 800; color: var(--orange-dark); }
.bbp-dock-vs { flex: 0 0 auto; font-size: 11px; font-weight: 900; letter-spacing: .5px; color: var(--text-3); }
.bbp-dock-act { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border: none; border-radius: 12px; background: var(--bg-alt); color: var(--text-1); cursor: pointer; }
.bbp-dock-act:hover { color: var(--orange); }
.bbp-dock-act svg { width: 18px; height: 18px; }
.bbp-dock-nav { display: flex; gap: 6px; padding: 0 10px 8px; overflow-x: auto; scrollbar-width: none; }
.bbp-dock-nav::-webkit-scrollbar { display: none; }
.bbp-dock-nav button { flex: 0 0 auto; min-height: 36px; padding: 6px 14px; border: 1.5px solid var(--border); border-radius: var(--r-pill); background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .2s ease; }
.bbp-dock-nav button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
[data-theme="dark"] .bbp-dock-nav button.on { background: var(--orange); border-color: var(--orange); }
.bbp-dock button:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ---------- share card ---------- */
.bbp-share { max-width: 760px; margin: 8px auto 28px; padding: 22px 20px; border: 1px solid rgba(255,107,53,.35); border-radius: var(--r-xl); background: linear-gradient(135deg, rgba(255,107,53,.10), rgba(124,58,237,.08)); text-align: center; }
.bbp-share h3 { font-size: 20px; font-weight: 900; letter-spacing: -.3px; margin: 0 0 6px; color: var(--text-1); }
.bbp-share p { margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.bbp-share-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.bbp-share-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 20px; border: 1.5px solid var(--border-strong); border-radius: var(--r-pill); background: var(--card-bg); color: var(--text-1); font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .15s ease, border-color .2s ease; }
.bbp-share-btn:hover { border-color: var(--orange); }
.bbp-share-btn:active { transform: scale(.97); }
.bbp-share-btn.wa { background: #25D366; border-color: #25D366; color: #fff; }
.bbp-share-btn.primary { background: var(--grad-btn); border-color: transparent; color: #fff; }
.bbp-share-btn svg { width: 18px; height: 18px; }
.bbp-share-status { min-height: 20px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.bbp-share-btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .score-bar-fill, .bbp-dock, .bbp-cat-panel, .bbp-cat-chev, .bbp-cat-backdrop { transition: none; }
  .bbp-live-dot, .bbp-loadmsg .dot, .bbp-win::after, .bbp-pop { animation: none; }
  .bbp-pop { opacity: 1; transform: none; }
}
