/* ============================================================
   PRICE NINJA — Pagina prodotto (PDP) — design allineato al Figma
   Hero card + sezione SERP (filtri + lista offerte).
   Caricato da prodotto.html e da serp-pn.html.
   ============================================================ */

/* Design tokens.
   This file used to assume style.css had already defined every --pn-* token.
   That holds on the product page and the home page, but NOT on the SERP: base.html
   only emits style.css when `css_site.site.name == "Price Ninja"`, a condition that is
   false in production, so on /serp every `var(--pn-*)` below resolved to nothing.
   The effect was silent and partial - `background: var(--pp-accent)` became
   invalid-at-computed-value-time (transparent) while the sibling `color: #fff` still
   applied, rendering the offer button as white text on a white card.
   Declaring the tokens here makes this stylesheet self-sufficient wherever it is loaded.
   Values mirror style.css; when both load the values are identical, so nothing changes
   on the pages that already worked. Single-sourcing the two copies needs base.html to
   load the tokens unconditionally - a wider change, tracked separately. */
:root {
  --pn-blu:           #1D51BF;
  --pn-blu-60:        #6A8AF4;
  --pn-blu-80:        #B6C4FA;
  --pn-blu-90:        #DCE1FC;
  --pn-blu-scuro:     #163DA0;
  --pn-navy:          #051747;
  --pn-success:       #0DBD79;
  --pn-sfondo-pagina: #F4F5F8;
  --pn-raggio-md:     12px;
  --pn-raggio-lg:     16px;
  --pn-raggio-xl:     24px;
  --pn-font-testo:    'Inter', system-ui, -apple-system, sans-serif;
  --pn-font-titoli:   'Zalando Sans', 'Inter', system-ui, -apple-system, sans-serif;
}

:root {
  --pp-ink:        var(--pn-navy);      /* #051747 — titoli */
  --pp-muted:      #5a6172;             /* WCAG AA su sfondo chiaro */
  --pp-line:       #ECECF2;
  --pp-green:      var(--pn-success);   /* #0DBD79 — prezzo */
  --pp-original:   #837E80;             /* prezzo barrato */
  --pp-accent:     var(--pn-blu);       /* #1D51BF — bottoni/brand */
  --pp-lav:        #DCE1FC;             /* sfondo sezione SERP */
  --pp-filter-bg:  #EEF0FE;             /* input filtri */
  --pp-orange:     #EA4600;             /* checkbox attiva */
  --pp-star:       #E9D705;             /* stelle rating */
  --pp-radius:     var(--pn-raggio-xl); /* 24px */
  --pp-shadow:     0 12px 34px rgba(28, 22, 64, .08), 0 2px 8px rgba(0, 0, 0, .04);
}

.pp-page { background: var(--pn-sfondo-pagina); }   /* grigio come la home */
/* l'header è in overlay (fixed) su tutte le viewport: serve aria in cima così i contenuti
   non finiscono sotto la pillola flottante (sulla home ci pensa il padding della hero). */
@media (min-width: 768px) { .pp-page { padding-top: 90px; } }
@media (max-width: 767.98px) { .pp-page { padding-top: 84px; } }
#offerte { scroll-margin-top: 110px; }

/* breadcrumb */
.pp-breadcrumb { font-size: .85rem; color: var(--pp-muted); }
.pp-breadcrumb a { color: var(--pp-muted); text-decoration: none; }
.pp-breadcrumb a:hover { color: var(--pp-accent); }
.pp-breadcrumb .sep { margin: 0 8px; opacity: .5; }

/* ============================================================
   HERO CARD
   ============================================================ */
.pp-hero {
  background: linear-gradient(180deg, #ffffff 0%, #fcfbff 100%);
  border: 1px solid var(--pp-line);
  border-radius: var(--pp-radius);
  box-shadow: var(--pp-shadow);
  padding: 20px;
}
.pp-hero__img {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #ffffff 0%, #f4f2fb 100%);
  border: 1px solid var(--pp-line);
  border-radius: var(--pn-raggio-lg);
  aspect-ratio: 1 / 1;      /* box quadrato */
  padding: 10px;
}
/* l'immagine riempie l'intero box grigio */
.pp-hero__img img { width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(20, 20, 50, .12)); }
.pp-hero__title { font-family: var(--pn-font-titoli); font-weight: 700; line-height: 1.2;
  color: var(--pp-ink); letter-spacing: -.01em; font-size: 1.5rem; }
.pp-from-label { color: var(--pp-muted); font-size: .82rem; font-weight: 500; }
.pp-price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.pp-from-price { font-size: 2rem; font-weight: 800; color: var(--pp-green); line-height: 1; letter-spacing: -.02em; }
.pp-original { color: var(--pp-original); text-decoration: line-through; font-size: 1rem; font-weight: 500; }
.pp-hero__desc { color: #3a414e; line-height: 1.6; }

/* bottoni hero */
.pp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: .95rem; padding: 11px 22px; border-radius: var(--pn-raggio-md);
  text-decoration: none; cursor: pointer; border: 1.5px solid var(--pp-accent);
  transition: background-color .15s, color .15s, transform .1s, box-shadow .15s; }
.pp-btn--solid { background: var(--pp-accent); color: #fff; }
.pp-btn--solid:hover { background: var(--pn-blu-scuro); border-color: var(--pn-blu-scuro); color: #fff; transform: translateY(-1px); }
.pp-btn--outline { background: #fff; color: var(--pp-accent); }
.pp-btn--outline:hover { background: var(--pp-filter-bg); color: var(--pp-accent); transform: translateY(-1px); }

/* card grafico prezzi */
.pp-chart-card { height: 100%; display: flex; flex-direction: column; justify-content: center; }
.pp-chart-card__label { font-size: .95rem; font-weight: 600; color: var(--pp-ink); margin-bottom: 6px; }
/* contenitore del grafico (riempito da js/price-chart.js) */
.pp-chart { position: relative; width: 100%; min-height: 230px; }
.pp-chart__svg { display: block; width: 100%; height: 230px; touch-action: pan-y; }
.pp-chart__axis { fill: var(--pp-muted); font-size: 11px; font-family: var(--pn-font-testo); }
.pp-chart__empty { color: var(--pp-muted); font-size: .9rem; padding: 24px 0; text-align: center; }
.pp-chart__tip {
  position: absolute; transform: translate(-50%, calc(-100% - 12px));
  background: #fff; border: 1px solid var(--pp-line); border-radius: 10px;
  padding: 6px 10px; box-shadow: 0 6px 18px rgba(20, 20, 50, .14);
  pointer-events: none; transition: opacity .12s ease; white-space: nowrap; z-index: 3;
}
.pp-chart__tip b { display: block; color: var(--pp-ink); font-size: .92rem; font-weight: 700; }
.pp-chart__tip span { color: var(--pp-muted); font-size: .72rem; }
.pp-chart__legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: .8rem; color: var(--pp-muted); }
.pp-chart__legend b { color: var(--pp-ink); font-weight: 700; }
.pp-chart__ldot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* ============================================================
   SEZIONE SERP (filtri + offerte) — sfondo lavanda full-bleed
   ============================================================ */
.pp-serp {
  background: var(--pp-lav);
  /* full-bleed: esce dal container e copre tutta la larghezza */
  margin-top: 24px;
  padding: 32px 0 64px;
}

/* --- Sidebar filtri --- */
/* Pulsante "Filtri" (solo mobile/tablet). Da ≥992px è nascosto (d-lg-none). */
.pp-filters-toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: 1.5px solid var(--pp-accent); color: var(--pp-accent);
  font-weight: 700; font-size: 1rem; padding: 13px 18px;
  border-radius: var(--pn-raggio-md); margin-bottom: 16px; cursor: pointer;
}
.pp-filters-toggle__chev { transition: transform .25s ease; }
.pp-filters-toggle[aria-expanded="true"] .pp-filters-toggle__chev { transform: rotate(180deg); }
/* pannello filtri: su mobile ha un po' d'aria sopra quando aperto */
@media (max-width: 991.98px) {
  #ppFilters.collapse.show, #ppFilters.collapsing {
    background: #fff; border-radius: var(--pn-raggio-lg); padding: 18px 18px 8px; margin-bottom: 8px;
    box-shadow: 0 6px 18px rgba(20, 20, 50, .06);
  }
}

.pp-filters__group { margin-bottom: 22px; }
.pp-filters__title { font-weight: 600; font-size: 1rem; color: var(--pp-ink); margin-bottom: 12px; }
.pp-price-inputs { display: flex; align-items: center; gap: 8px; }
.pp-price-inputs input {
  width: 100%; min-width: 0; background: var(--pp-filter-bg); border: none; border-radius: var(--pn-raggio-md);
  padding: 12px 14px; font-size: .95rem; color: var(--pp-ink); }
.pp-price-inputs input::placeholder { color: var(--pp-muted); }
.pp-price-inputs input:focus { outline: 2px solid var(--pn-blu-80); }
.pp-price-go { flex: 0 0 auto; width: 44px; height: 44px; border: none; border-radius: var(--pn-raggio-md);
  background: var(--pp-accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pp-price-go:hover { background: var(--pn-blu-scuro); }

.pp-check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.pp-check input { width: 20px; height: 20px; accent-color: var(--pp-orange); cursor: pointer; flex: 0 0 auto; }
.pp-check__name { font-weight: 600; color: var(--pp-ink); }
.pp-check__count { color: var(--pp-muted); font-weight: 600; }

.pp-rating-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.pp-rating-row .pp-stars { letter-spacing: 1px; }
.pp-rating-row small { color: var(--pp-muted); }
.pp-stars i { color: var(--pp-star); font-size: .95rem; }
.pp-stars i.empty { color: #c9cfe6; }

.pp-divider { border: 0; border-top: 1px solid var(--pn-blu-80); margin: 18px 0; opacity: .7; }

.pp-toggle { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.pp-toggle .form-check-input { width: 42px; height: 24px; margin: 0; cursor: pointer;
  background-color: #fff; border-color: var(--pn-blu-80); }
.pp-toggle .form-check-input:checked { background-color: var(--pp-accent); border-color: var(--pp-accent); }
.pp-toggle label { font-weight: 600; color: var(--pp-ink); cursor: pointer; }

/* --- Header lista offerte --- */
.pp-offers-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.pp-offers-count { font-family: var(--pn-font-titoli); font-size: 1.4rem; font-weight: 700; color: var(--pp-ink); }
.pp-sort { display: inline-flex; align-items: center; gap: 8px; color: var(--pp-muted); font-size: .9rem; }
.pp-sort select { border: none; background: transparent; font-weight: 600; color: var(--pp-ink); cursor: pointer; }

/* --- Card offerta (negozio) --- */
.pp-shop-card {
  display: flex; align-items: center; gap: 18px;
  background: #fff; border-radius: var(--pn-raggio-xl);
  padding: 18px 22px; text-decoration: none; color: inherit;
  box-shadow: 0 6px 18px rgba(20, 20, 50, .05);
  transition: transform .12s ease, box-shadow .18s ease; margin-bottom: 16px; }
.pp-shop-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(20, 20, 50, .12); color: inherit; }
.pp-shop-card__img { width: 110px; height: 110px; flex: 0 0 auto; object-fit: contain; }
.pp-shop-card__body { flex: 1 1 auto; min-width: 0; }
.pp-shop-card__title { font-family: var(--pn-font-titoli); font-weight: 700; font-size: 1.25rem; color: #111827;
  line-height: 1.3; margin: 0 0 8px; }
/* descrizione prodotto (solo nelle schede SERP) — max 2 righe */
.pp-shop-card__desc { color: #3a414e; font-size: .9rem; line-height: 1.45; margin: 0 0 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pp-shop-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pp-shop-merchant { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--pp-ink); font-size: .9rem; }
.pp-shop-merchant__logo { width: 24px; height: 24px; border-radius: 100px; background: var(--pp-filter-bg);
  display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; color: var(--pp-accent); }
.pp-pay { display: inline-flex; align-items: center; gap: 5px; }
.pp-pay__tile { width: 34px; height: 22px; border: 1px solid var(--pp-line); border-radius: 4px; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: .5rem; font-weight: 800; color: #555; line-height: 1; }
.pp-pay__tile svg { display: block; }
.pp-rating { display: inline-flex; align-items: center; gap: 5px; }
.pp-rating__score { font-weight: 700; color: var(--pp-ink); font-size: .9rem; }
.pp-shop-card__right { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pp-shop-card__from { color: var(--pp-muted); font-size: .8rem; }
.pp-shop-card__price { font-size: 1.4rem; font-weight: 800; color: var(--pp-green); line-height: 1; white-space: nowrap; }
.pp-shop-card__price s { color: var(--pp-original); font-size: .8rem; font-weight: 500; margin-left: 6px; }
.pp-shop-card__btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--pp-accent); color: #fff; border: none; border-radius: var(--pn-raggio-md);
  padding: 11px 24px; font-weight: 600; font-size: .92rem; text-decoration: none; white-space: nowrap; }
.pp-shop-card__btn:hover { background: var(--pn-blu-scuro); color: #fff; }
.pp-avail { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--pp-muted); }
.pp-avail .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pp-green); display: inline-block; }

/* ============================================================
   SERP — pagina risultati ricerca (riusa header/filtri/SERP della PDP)
   ============================================================ */
.pp-serp-title { font-family: var(--pn-font-titoli); font-weight: 700; color: var(--pp-ink);
  font-size: clamp(1.4rem, 3vw, 2rem); margin: 0; }
.pp-serp-title span { color: var(--pp-accent); }
.pp-serp-sub { color: var(--pp-muted); font-size: .95rem; margin-top: 4px; }

/* paginazione */
.pp-pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 36px; flex-wrap: wrap; }
.pp-pagination a, .pp-pagination span {
  min-width: 42px; height: 42px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--pn-raggio-md); text-decoration: none; color: var(--pp-accent); font-weight: 600;
  border: 1px solid transparent; }
.pp-pagination a:hover { background: #fff; }
.pp-pagination .is-active { background: var(--pp-accent); color: #fff; }
.pp-pagination .is-disabled { color: var(--pn-blu-80); pointer-events: none; }

/* ---- Sticky mobile buy bar ---- */
.pp-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(8px);
  border-top: 1px solid var(--pp-line); box-shadow: 0 -6px 20px rgba(0, 0, 0, .10);
  padding: 10px 14px; display: flex; align-items: center; gap: 12px; }
.pp-sticky__price { font-size: 1.3rem; font-weight: 800; color: var(--pp-green); white-space: nowrap; }
.pp-sticky__price small { color: var(--pp-muted); font-size: .7rem; font-weight: 500; display: block; }
.pp-sticky__cta { flex: 1; border: none; border-radius: var(--pn-raggio-md); color: #fff !important;
  padding: 12px 16px; font-weight: 700; text-decoration: none; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--pp-accent); }
@media (max-width: 767.98px) { body.pp-page { padding-bottom: 80px; } }

/* ---- Price-watcher modal ---- */
#price-watcher-modal .modal-content { border: none; border-radius: 18px; box-shadow: var(--pp-shadow); overflow: hidden; }
#price-watcher-modal .modal-header { border-bottom: 1px solid var(--pp-line); padding: 18px 20px; }
#price-watcher-modal .modal-title { font-family: var(--pn-font-titoli); font-weight: 800; color: var(--pp-ink); }
#price-watcher-form .form-control { border: 1px solid var(--pp-line); border-radius: var(--pn-raggio-md); padding: 12px 14px; font-size: 1rem; }
#price-watcher-form .form-control:focus { border-color: var(--pn-blu-60); box-shadow: 0 0 0 .2rem var(--pn-blu-90); }
#price-watcher-form .pp-submit { border: none; border-radius: var(--pn-raggio-md); color: #fff !important; font-weight: 700;
  padding: 12px 18px; background: var(--pp-accent); }
#price-watcher-form .pp-submit:hover { background: var(--pn-blu-scuro); }
#price-watcher-form .form-check-label { font-size: .85rem; color: var(--pp-muted); }
#price-watcher-form .form-check-input:checked { background-color: var(--pp-accent); border-color: var(--pp-accent); }
#price-watcher-form a { color: var(--pp-accent); font-weight: 600; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
  .pp-shop-card { flex-wrap: wrap; }
  .pp-shop-card__img { width: 80px; height: 80px; }
  .pp-shop-card__right { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center;
    justify-content: space-between; text-align: left; border-top: 1px solid var(--pp-line); padding-top: 12px; }
}
@media (max-width: 575.98px) {
  .pp-hero__title { font-size: 1.25rem; }
  .pp-from-price { font-size: 1.7rem; }
  .pp-shop-card__title { font-size: 1.05rem; }
  .pp-shop-card__btn { padding: 10px 16px; }
}
