/* ============================================================================
   Product-info panel redesign ("Price Hero" / #11).
   Scoped under .rx-panel so it can't leak into existing wishlist/product CSS.
   Reuses the Catppuccin --ctp-* tokens already defined in base.html.
   Used by: partials/wishlist_details.html (expanded row) and product_detail.html.
   ========================================================================== */
.rx-panel {
  --rx-hair: rgba(128,128,140,.16);
  --rx-glass: color-mix(in srgb, var(--ctp-surface0, #313244) 55%, transparent);
  color: var(--ctp-text, #cdd6f4);
  font-size: 15px;
}
[data-bs-theme="light"] .rx-panel { --rx-hair: rgba(76,79,105,.14); }

/* wishlist-row context: give the panel a padded backdrop inside the table row */
.rx-panel-wl { padding: 1rem 1rem 1.15rem; background: color-mix(in srgb, var(--ctp-mantle) 35%, var(--ctp-base)); border-top: 1px solid var(--rx-hair); }
@media (min-width: 992px) { .rx-panel-wl { padding: 1.25rem 1.5rem; } }

/* product page: restyle Bootstrap section cards + tables to Catppuccin inside .rx-panel */
.rx-panel .card { background: var(--ctp-surface0); border: 1px solid var(--rx-hair) !important; border-radius: 14px; box-shadow: none !important; }
.rx-panel .card-header { background: transparent !important; border-bottom: 1px solid var(--rx-hair); color: var(--ctp-text); }
.rx-panel .bg-white { background: transparent !important; }
.rx-panel .table { --bs-table-bg: transparent; --bs-table-color: var(--ctp-text); --bs-table-hover-bg: color-mix(in srgb, var(--ctp-blue) 8%, transparent); color: var(--ctp-text); }
.rx-panel thead.table-light th, .rx-panel .table-light { background: color-mix(in srgb, var(--ctp-surface1) 45%, transparent) !important; color: var(--ctp-subtext0); }

.rx-panel .rx-pane { display: flex; flex-direction: column; gap: 1rem; }
.rx-panel .rx-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ctp-subtext0); font-weight: 600; }
.rx-panel .rx-muted { color: var(--ctp-subtext0); }
.rx-panel .rx-num { font-variant-numeric: tabular-nums; }

/* tone helpers */
.rx-panel .tone-green { --tone: var(--ctp-green); } .rx-panel .tone-blue { --tone: var(--ctp-blue); }
.rx-panel .tone-red { --tone: var(--ctp-red); } .rx-panel .tone-yellow { --tone: var(--ctp-yellow); }
.rx-panel .tone-mauve { --tone: var(--ctp-mauve); } .rx-panel .tone-overlay { --tone: var(--ctp-overlay0); }

/* pills */
.rx-panel .rx-pill { display: inline-flex; align-items: center; gap: .28rem; font-size: .72rem; font-weight: 700;
  padding: .12rem .5rem; border-radius: 999px; line-height: 1.5; white-space: nowrap; }
.rx-panel .rx-pill small { opacity: .7; font-weight: 600; }
.rx-panel .rx-pill-green { background: color-mix(in srgb, var(--ctp-green) 20%, transparent); color: var(--ctp-green); }
.rx-panel .rx-pill-red { background: color-mix(in srgb, var(--ctp-red) 20%, transparent); color: var(--ctp-red); }
.rx-panel .rx-pill-blue { background: color-mix(in srgb, var(--ctp-blue) 20%, transparent); color: var(--ctp-blue); }
.rx-panel .rx-pill-tone { background: color-mix(in srgb, var(--tone) 20%, transparent); color: var(--tone); }
[data-bs-theme="light"] .rx-panel .rx-pill-tone.tone-yellow { color: #9a6a12; }

/* ── hero price band ── */
.rx-panel .rx-hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.15rem 1.25rem; border-radius: 16px; border: 1px solid var(--rx-hair);
  background: linear-gradient(135deg, color-mix(in srgb, var(--ctp-blue) 18%, transparent), color-mix(in srgb, var(--ctp-mauve) 12%, transparent)); }
.rx-panel .rx-price-xl { font-size: 2.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--ctp-text); }
.rx-panel .rx-price-was { text-decoration: line-through; color: var(--ctp-subtext0); }
.rx-panel .rx-hero-meta { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.rx-panel .rx-hero-sig { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border-radius: 12px;
  background: color-mix(in srgb, var(--tone) 14%, transparent); }
.rx-panel .rx-hero-sig i { font-size: 1.35rem; color: var(--tone); }
.rx-panel .rx-hero-sig b { color: var(--tone); }
.rx-panel .rx-hero-sig .rx-sig-desc { color: var(--ctp-subtext1); font-size: .8rem; }
.rx-panel .rx-hero-side { display: flex; align-items: stretch; gap: .5rem; flex-wrap: wrap; }
.rx-panel .rx-hero-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem .9rem; border-radius: 12px; text-decoration: none; white-space: nowrap; font-weight: 700; font-size: .88rem;
  color: var(--ctp-blue); background: color-mix(in srgb, var(--ctp-blue) 14%, transparent); transition: background .15s; }
.rx-panel .rx-hero-btn:hover { background: color-mix(in srgb, var(--ctp-blue) 24%, transparent); }
.rx-panel .rx-hero-btn i { font-size: 1.25rem; }

/* ── stat tiles ──
   auto-fit rather than a fixed 3-up: the product hero's centre column is very
   wide on an ultrawide screen, and letting the tiles reflow 2-up → 5-up absorbs
   that width instead of stretching each tile into a mostly-empty box. */
.rx-panel .rx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
@media (max-width: 620px) { .rx-panel .rx-stats { grid-template-columns: 1fr; } }
.rx-panel .rx-stile { background: var(--ctp-surface0); border: 1px solid var(--rx-hair); border-radius: 12px; padding: .6rem .7rem; }
.rx-panel .rx-stile .rx-label { margin-bottom: .15rem; }
.rx-panel .rx-stile-val { font-weight: 800; font-size: 1.05rem; }
/* for tiles holding a date or a range rather than one number */
.rx-panel .rx-stile-val.is-sm { font-size: .92rem; }
.rx-panel .rx-stile-sub { font-size: .72rem; color: var(--ctp-subtext0); margin-top: .1rem; }

/* ── verdict ── */
.rx-panel .rx-verdict { display: flex; flex-direction: column; gap: .5rem; }
.rx-panel .rx-verdict-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.rx-panel .rx-verdict-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: 999px; background: color-mix(in srgb, var(--tone) 18%, transparent); color: var(--tone); }
.rx-panel .rx-explain { display: flex; gap: .5rem; padding: .6rem .7rem; border-radius: 10px; font-size: .82rem; align-items: flex-start;
  background: color-mix(in srgb, var(--tone) 12%, transparent); }
.rx-panel .rx-explain i { margin-top: .1rem; color: var(--tone); flex: none; }
.rx-panel .rx-explain-sub { font-size: .74rem; color: var(--ctp-subtext0); margin-top: .15rem; }
.rx-panel .rx-range { margin-top: .1rem; }
.rx-panel .rx-rangebar { position: relative; height: 8px; border-radius: 999px; background: var(--ctp-surface1); margin: .45rem 0 .25rem; }
.rx-panel .rx-rangebar-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: color-mix(in srgb, var(--ctp-mauve) 45%, transparent); }
.rx-panel .rx-rangebar-dot { position: absolute; top: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ctp-blue); border: 2px solid var(--ctp-base); transform: translateX(-50%); }
.rx-panel .rx-rangebar-cap { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ctp-subtext0); }

/* ── chart ── */
.rx-panel .rx-chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.rx-panel .rx-ranges { display: flex; gap: .2rem; }
.rx-panel .rx-ranges button { font-size: .72rem; font-weight: 600; border: 0; background: var(--ctp-surface0); color: var(--ctp-subtext0);
  border-radius: 7px; padding: .2rem .45rem; cursor: pointer; }
.rx-panel .rx-ranges button.on { background: color-mix(in srgb, var(--ctp-blue) 22%, transparent); color: var(--ctp-blue); }
.rx-panel .rx-chart-box { position: relative; min-height: 330px; padding: 4px 6px; margin: .3rem 0;
  border-radius: 12px; border: 1px solid var(--rx-hair); background: color-mix(in srgb, var(--ctp-surface0) 22%, transparent); }
.rx-panel .rx-legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .72rem; color: var(--ctp-subtext0); margin-top: .5rem; }
.rx-panel .rx-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.rx-panel .rx-legend i { width: 14px; height: 0; border-top: 2px solid var(--ctp-blue); display: inline-block; }
.rx-panel .rx-legend .lg-high { border-top: 2px dashed var(--ctp-overlay0); }
.rx-panel .rx-legend .lg-atl { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--ctp-green); }
.rx-panel .rx-legend .lg-oos { width: 12px; height: 9px; border: 0; border-radius: 2px; background: color-mix(in srgb, var(--ctp-overlay0) 40%, transparent); }
.rx-panel .rx-legend .lg-drop { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--ctp-peach); }

/* ── snapshots ── */
.rx-panel .rx-snaps { width: 100%; border-collapse: collapse; font-size: .8rem; }
.rx-panel .rx-snaps th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ctp-subtext0); padding: .3rem .5rem; font-weight: 600; }
.rx-panel .rx-snaps td { padding: .3rem .5rem; border-top: 1px solid var(--rx-hair); }
.rx-panel .rx-snaps td.rx-num { text-align: right; }

/* ── list picker (bounded, searchable) ── */
.rx-panel .rx-lp { border: 1px solid var(--rx-hair); border-radius: 12px; padding: .75rem; background: var(--ctp-surface0); display: flex; flex-direction: column; min-height: 0; }
.rx-panel .rx-lp-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.rx-panel .rx-lp-count { font-size: .72rem; color: var(--ctp-subtext0); font-weight: 600; }
.rx-panel .rx-lp-search { display: flex; align-items: center; gap: .4rem; margin: .5rem 0 .4rem; padding: .35rem .55rem;
  border: 1px solid var(--ctp-surface2); border-radius: 9px; background: var(--ctp-surface1); }
.rx-panel .rx-lp-search input { border: 0; background: none; padding: 0; width: 100%; font-size: .82rem; color: var(--ctp-text); }
.rx-panel .rx-lp-search input:focus { outline: none; }
.rx-panel .rx-lp-list { display: flex; flex-direction: column; gap: .1rem; max-height: 168px; overflow-y: auto;
  border: 1px solid var(--rx-hair); border-radius: 9px; padding: .2rem; }
.rx-panel .rx-lp-row { display: flex; align-items: center; gap: .5rem; padding: .32rem .5rem; border-radius: 8px; font-size: .85rem; cursor: pointer; }
.rx-panel .rx-lp-row:hover { background: color-mix(in srgb, var(--ctp-blue) 8%, transparent); }
.rx-panel .rx-lp-row.hide { display: none; }
.rx-panel .rx-lp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ctp-blue); flex: none; }
.rx-panel .rx-lp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-panel .rx-lp-cnt { font-size: .7rem; color: var(--ctp-subtext0); }
.rx-panel .rx-lp-new { display: inline-flex; align-items: center; gap: .3rem; background: none; border: 0; color: var(--ctp-blue); font: inherit; font-size: .82rem; cursor: pointer; padding: .45rem .5rem 0; align-self: flex-start; }

/* ── notify (price target) — the target-position bar lives here ── */
.rx-panel .rx-notify { background: var(--ctp-surface0); border: 1px solid var(--rx-hair); border-radius: 12px; padding: .9rem 1rem; }
.rx-panel .rx-nt-bar { margin: 1.35rem 0 1.15rem; }
.rx-panel .rx-nt-track { position: relative; height: 8px; border-radius: 999px; background: var(--ctp-surface1); margin: 1.5rem 0 .45rem; }
.rx-panel .rx-nt-seg { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: color-mix(in srgb, var(--ctp-blue) 45%, transparent); }
.rx-panel .rx-nt-lbl { position: absolute; top: -1.3rem; transform: translateX(-50%); font-size: .68rem; font-weight: 700; color: var(--ctp-peach); white-space: nowrap; }
.rx-panel .rx-nt-mark { position: absolute; top: 50%; }
.rx-panel .rx-nt-mark.atl { width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--ctp-green); }
.rx-panel .rx-nt-mark.now { width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: var(--ctp-blue); border: 2px solid var(--ctp-base); }
.rx-panel .rx-nt-mark.target { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--ctp-peach); border: 2px solid var(--ctp-base); transform: rotate(45deg); }
.rx-panel .rx-nt-cap { display: flex; justify-content: space-between; font-size: .7rem; color: var(--ctp-subtext0); }
.rx-panel .rx-nt-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-top: .55rem; }
.rx-panel .rx-nt-tg { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; color: var(--ctp-subtext0); }
.rx-panel .rx-nt-tg i { color: var(--ctp-blue); }

/* ── wishlist expanded row: one row — chart (80%) + info cards (20%) ──────────
   The cards deliberately carry only what the collapsed wishlist row doesn't
   already show. The sidebar is clamped at 260px so the 80/20 ratio doesn't
   squeeze the cards unusable on a narrower desktop.
   Must come after .rx-chart-box above: the narrow override has equal specificity. */
/* Two rows: the "Price history" heading sits alone in row 1 above the chart only,
   so row 2 starts the chart box and the info column on the same line. */
.rx-panel .rx-split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(260px, 1fr);
  grid-template-rows: auto 1fr; column-gap: 1rem; row-gap: 0; align-items: stretch; }
.rx-panel .rx-split > .rx-chart-head { grid-area: 1 / 1; }
.rx-panel .rx-split > .rx-chart-col { grid-area: 2 / 1; }
.rx-panel .rx-split > .rx-side { grid-area: 2 / 2; }
/* The chart grows to whatever height the info column needs, so the two sides stay
   level as cards are added — flex-basis 0 keeps the canvas out of that measurement
   (a percentage height here would be circular and collapse the chart to nothing). */
.rx-panel .rx-chart-col { display: flex; flex-direction: column; }
.rx-panel .rx-chart-col .rx-chart-box { flex: 1 1 0; margin-top: 0; }
.rx-panel .rx-side { display: flex; flex-direction: column; gap: .6rem; }
.rx-panel .rx-facts { background: var(--ctp-surface0); border: 1px solid var(--rx-hair); border-radius: 12px; padding: .5rem .75rem; }
.rx-panel .rx-fact { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding: .3rem 0; }
.rx-panel .rx-fact + .rx-fact { border-top: 1px solid var(--rx-hair); }
.rx-panel .rx-fact-k { font-size: .74rem; color: var(--ctp-subtext0); }
.rx-panel .rx-fact-v { font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; text-align: right; }
.rx-panel .rx-side-actions { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.rx-panel .rx-side-actions .rx-hero-btn { width: 100%; }

/* Collapsed "Add to list" — one button row; the menu floats in the top layer so
   opening it never resizes the panel (see list_picker_dropdown.html). */
.rx-panel .rx-lp-dd { padding: 0; }
.rx-panel .rx-lp-toggle { display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .55rem .7rem; background: none; border: 0; color: inherit; font: inherit;
  cursor: pointer; border-radius: 12px; }
.rx-panel .rx-lp-toggle:hover { background: color-mix(in srgb, var(--ctp-blue) 8%, transparent); }
.rx-panel .rx-lp-toggle .rx-label { flex: 1; text-align: left; }
.rx-panel .rx-lp-chev { font-size: .8rem; color: var(--ctp-subtext0); transition: transform .2s; }
.rx-panel .rx-lp-toggle.open .rx-lp-chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .rx-panel .rx-lp-chev { transition: none; } }

/* The floating menu. Overrides the UA popover defaults (inset:0 + margin:auto,
   its own border and colours); base.html sets left/top or bottom. */
.rx-panel .rx-lp-pop:popover-open { display: flex; flex-direction: column; }
.rx-panel .rx-lp-pop { position: fixed; inset: auto; margin: 0; padding: .55rem .6rem;
  max-height: 300px; overflow: visible;
  border: 1px solid var(--rx-hair); border-radius: 12px;
  background: var(--ctp-surface0); color: var(--ctp-text);
  box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.rx-panel .rx-lp-pop .rx-lp-search { margin-top: 0; }
.rx-panel .rx-lp-pop .rx-lp-list { max-height: 200px; }

@media (max-width: 991.98px) {   /* single column: heading, chart, then cards */
  .rx-panel .rx-split { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .rx-panel .rx-split > .rx-chart-col { grid-area: 2 / 1; }
  .rx-panel .rx-split > .rx-side { grid-area: 3 / 1; margin-top: 1rem; }
  .rx-panel .rx-chart-box { min-height: 260px; }
}

/* ── product hero: gallery | price + evidence | action rail ──────────────────
   The centre track is the only flexible one, and the facts grid inside it is
   auto-fit, so an ultrawide screen is absorbed by tiles-per-row rather than by
   stretching the text. Below 1400px the rail can't stay readable at 340px
   beside two other columns, so it drops under both and becomes a wrapping row.

   The title occupies a row of its own spanning only the centre column, so row 2
   starts the price band and the rail on exactly the same line — no magic offset
   that a two-line title would break. row-gap is 0 because the title block
   already carries its own bottom margin. */
.rx-panel .rx-ph { display: grid; column-gap: 1rem; row-gap: 0; align-items: start;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  grid-template-rows: auto 1fr;
  grid-template-areas: "gal head ."
                       "gal main rail"; }
.rx-panel .rx-ph-gallery { grid-area: gal; width: auto; }  /* the grid track sizes it, not .prod-gallery-col's 320px */
.rx-panel .rx-ph-head { grid-area: head; min-width: 0; }
.rx-panel .rx-ph-main { grid-area: main; min-width: 0; }   /* min-width:0 or a long title blows the track out */
.rx-panel .rx-ph-rail { grid-area: rail; display: flex; flex-direction: column; gap: .5rem; }
.rx-panel .rx-ph-rail > * { width: 100%; }

@media (max-width: 1399.98px) {
  .rx-panel .rx-ph { grid-template-columns: 300px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: "gal head" "gal main" "rail rail"; }
  .rx-panel .rx-ph-rail { flex-direction: row; flex-wrap: wrap; align-items: flex-start; margin-top: 1rem; }
  .rx-panel .rx-ph-rail > * { width: auto; flex: 1 1 220px; max-width: 340px; }
}
@media (max-width: 767.98px) {
  .rx-panel .rx-ph { grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas: "gal" "head" "main" "rail"; }
  .rx-panel .rx-ph-gallery { margin-bottom: 1rem; }
}

/* .rx-hero-btn is also used on <button> now (wishlist toggle, Scrape now), which
   needs the UA border/font reset the <a> form never did. */
.rx-panel button.rx-hero-btn { border: 0; cursor: pointer; font-family: inherit; }
.rx-panel button.rx-hero-btn:disabled { opacity: .6; cursor: default; }

.rx-panel .rx-hero-btn.rx-btn-heart { color: var(--ctp-red); background: color-mix(in srgb, var(--ctp-red) 14%, transparent); }
.rx-panel .rx-hero-btn.rx-btn-heart:hover { background: color-mix(in srgb, var(--ctp-red) 24%, transparent); }
.rx-panel .rx-hero-btn.rx-btn-heart.is-on { color: var(--ctp-base); background: var(--ctp-red); }
.rx-panel .rx-hero-btn.rx-btn-heart.is-on:hover { background: color-mix(in srgb, var(--ctp-red) 82%, #000); }

/* Scrape now — admin-only and deliberately the quietest control in the rail. */
.rx-panel .rx-hero-btn.rx-btn-muted { color: var(--ctp-subtext0); font-size: .8rem;
  background: color-mix(in srgb, var(--ctp-overlay0) 16%, transparent); }
.rx-panel .rx-hero-btn.rx-btn-muted:hover { background: color-mix(in srgb, var(--ctp-overlay0) 28%, transparent); }
.rx-panel .rx-hero-btn.rx-btn-muted i { font-size: 1rem; }

/* Notify popover: taller than a list menu, and the card inside already sits on
   the popover's own surface — drop its duplicate border/background/padding. */
.rx-panel .rx-nt-pop { max-height: min(70vh, 480px); overflow-y: auto; }
.rx-panel .rx-nt-pop .rx-notify { border: 0; background: none; padding: 0; }
