/* ============================================================
   PrezzoTop – Indice di Convenienza
   Versione: 3.0.0
   Design: Dark hero · Score editoriale · Ring SVG · Body bianco
   ============================================================ */

/* ── Token locali ── */
.ptop-ci-card {
  --a:  #7c3aed;
  --al: #a78bfa;
  --ab: rgba(124,58,237,.15);

  font-family: -apple-system, "SF Pro Display", "Segoe UI Variable", system-ui, sans-serif;
  border-radius: 22px;
  overflow: hidden;
  margin: 20px 0;
  box-shadow:
    0 2px 8px  rgba(0,0,0,.08),
    0 12px 40px rgba(0,0,0,.10);
  transition: opacity .4s cubic-bezier(.4,0,.2,1),
              transform .4s cubic-bezier(.4,0,.2,1);
}

.ptop-ci-loading {
  opacity: 0;
  transform: translateY(10px);
}

/* ──────────────────────────────────────────
   FASCE COLORE
   Allineate con PHP (ptop-helpers.php)
   e JS (ptop-price-index.js)
────────────────────────────────────────── */
.ptop-ci--top {
  --a:  #059669;
  --al: #34d399;
}
.ptop-ci--good {
  --a:  #7c3aed;
  --al: #a78bfa;
}
.ptop-ci--medium {
  --a:  #d97706;
  --al: #fbbf24;
}
.ptop-ci--low {
  --a:  #ea580c;
  --al: #fb923c;
}
.ptop-ci--bad {
  --a:  #dc2626;
  --al: #f87171;
}
.ptop-ci--flat {
  --a:  #6b7280;
  --al: #d1d5db;
}

/* ──────────────────────────────────────────
   HERO — dark profondo stile PrezzoTop
────────────────────────────────────────── */
.ptop-ci-hero {
  background: radial-gradient(
    ellipse at 70% -20%,
    #3b1a6e 0%,
    #1a0e2e 55%,
    #0f0a1a 100%
  );
  padding: 24px 22px 20px;
  position: relative;
  overflow: hidden;
}

/* Bagliore decorativo viola */
.ptop-ci-hero::before {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,.18) 0%, transparent 70%);
  top: -60px;
  right: -60px;
  pointer-events: none;
}

/* Eyebrow */
.ptop-ci-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-bottom: 16px;
}

.ptop-ci-eyebrow-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--al);
  box-shadow: 0 0 6px var(--al);
  flex-shrink: 0;
}

/* Riga principale: score grande + ring */
.ptop-ci-hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* Score numerico editoriale */
.ptop-ci-score-num {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: -.06em;
  line-height: .9;
  color: #fff;
}

.ptop-ci-score-num span {
  font-size: 22px;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  letter-spacing: -.02em;
}

.ptop-ci-score-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--al);
  letter-spacing: -.01em;
}

/* ──────────────────────────────────────────
   RING SVG animato
   Struttura HTML attesa:
   <div class="ptop-ci-ring">
     <svg viewBox="0 0 80 80">
       <circle class="ptop-ci-ring-bg" cx="40" cy="40" r="33" fill="none" stroke-width="5"/>
       <circle class="ptop-ci-ring-arc" cx="40" cy="40" r="33" fill="none" stroke-width="5"
               stroke-dasharray="207.3" stroke-dashoffset="207.3"/>
     </svg>
     <div class="ptop-ci-ring-inner">
       <span class="ptop-ci-ring-pct">0%</span>
     </div>
   </div>
   Il JS imposta stroke-dashoffset = 207.3 * (1 - score/100)
────────────────────────────────────────── */
.ptop-ci-ring {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  position: relative;
}

.ptop-ci-ring svg {
  width: 80px;
  height: 80px;
}

.ptop-ci-ring-bg {
  stroke: rgba(255,255,255,.08);
}

.ptop-ci-ring-arc {
  stroke: var(--al);
  stroke-linecap: round;
  transform-origin: center;
  transform: rotate(-90deg);
  transition: stroke-dashoffset .9s cubic-bezier(.4,0,.2,1);
  filter: drop-shadow(0 0 4px var(--al));
}

.ptop-ci-ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptop-ci-ring-pct {
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,.5);
  letter-spacing: .04em;
}

/* ──────────────────────────────────────────
   PILL VERDICT (stile badge PrezzoTop)
────────────────────────────────────────── */
.ptop-ci-verdict {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  letter-spacing: .01em;
}

.ptop-ci-verdict-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--al);
  flex-shrink: 0;
}

/* ──────────────────────────────────────────
   BODY — bianco, contrasto con hero
────────────────────────────────────────── */
.ptop-ci-body {
  background: #fff;
  padding: 18px 18px 20px;
}

/* Barra sottile colore fascia */
.ptop-ci-track {
  height: 3px;
  background: #f0f0ed;
  border-radius: 999px;
  margin-bottom: 18px;
  overflow: hidden;
}

.ptop-ci-track-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--a);
  width: 0;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}

/* ──────────────────────────────────────────
   METRICHE — griglia 2 colonne
────────────────────────────────────────── */
.ptop-ci-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.ptop-ci-metric {
  background: #f8f8f6;
  border-radius: 14px;
  padding: 11px 13px;
}

.ptop-ci-metric span {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #b0b0aa;
  margin-bottom: 5px;
  line-height: 1;
}

.ptop-ci-metric strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: #111;
  line-height: 1.1;
}

/* Cella Range 90g — larghezza piena con barra visiva */
.ptop-ci-metric--wide {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ptop-ci-metric--wide span {
  margin-bottom: 0;
  white-space: nowrap;
}

.ptop-ci-metric--wide strong {
  font-size: 12px;
  color: #aaa;
  white-space: nowrap;
}

/* Barra range con dot posizionato dal JS */
.ptop-ci-rangebar {
  flex: 1;
  height: 3px;
  background: #e8e8e4;
  border-radius: 999px;
  position: relative;
}

.ptop-ci-rangebar-dot {
  position: absolute;
  top: -4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--a);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* ──────────────────────────────────────────
   PULSANTE TOGGLE DETTAGLI
────────────────────────────────────────── */
.ptop-ci-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f8f6;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: #666;
  letter-spacing: .02em;
  text-transform: uppercase;
  transition: background .15s;
}

.ptop-ci-toggle:hover {
  background: #f0f0ec;
}

.ptop-ci-chv {
  font-size: 10px;
  color: #bbb;
  display: inline-block;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.ptop-ci-toggle[aria-expanded="true"] .ptop-ci-chv {
  transform: rotate(180deg);
}

/* ──────────────────────────────────────────
   PANNELLO DETTAGLI
────────────────────────────────────────── */
.ptop-ci-details {
  margin-top: 10px;
}

.ptop-ci-details[hidden] {
  display: none;
}

/* Sub-score factors */
.ptop-ci-factors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.ptop-ci-factor {
  background: #f8f8f6;
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.ptop-ci-factor-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #bbb;
}

.ptop-ci-factor-val {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.04em;
  color: var(--a);
}

/* Lista note */
.ptop-ci-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ptop-ci-list li {
  font-size: 11px;
  color: #999;
  line-height: 1.4;
  padding-left: 12px;
  position: relative;
}

.ptop-ci-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--a);
}

/* Nota a piè */
.ptop-ci-footnote {
  font-size: 10px;
  color: #ccc;
  letter-spacing: .02em;
}

/* ──────────────────────────────────────────
   SEO — fuori schermo, solo per crawler
────────────────────────────────────────── */
.ptop-ci-seo {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ──────────────────────────────────────────
   RISPETTA REDUCED-MOTION
────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ptop-ci-card,
  .ptop-ci-ring-arc,
  .ptop-ci-track-fill,
  .ptop-ci-chv {
    transition: none !important;
    animation: none !important;
    filter: none !important;
  }
}
