/* ── SaveTag Calculator Widget ─────────────────────── */

:root {
  --stc-green:      #008845;
  --stc-green-dark: #006633;
  --stc-green-lite: #e6f4ed;
  --stc-dark:       #111111;
  --stc-text:       #2c2c2c;
  --stc-muted:      #717171;
  --stc-border:     #e4e4e4;
  --stc-bg:         #f8f8f6;
  --stc-white:      #ffffff;
  --stc-shadow-grn: 0 3px 12px rgba(0,136,69,.22);
}

/* ── Outer wrapper ── */
.stc-wrap {
  background: #ffffff;
  border: 1px solid var(--stc-border);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  padding: 10px 28px;
  font-family: 'Roboto', sans-serif;
  color: var(--stc-text);
  /* Altezza = 1/3 × 0.45 della larghezza → riduzione 55% */
  aspect-ratio: 20 / 3;
  box-sizing: border-box;
}

/* ── Inner grid ── */
.stc-inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: stretch;
}

/* ── Left column ── */
.stc-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

/* Nascosti per mancanza di spazio nella versione compatta */
.stc-subtitle,
.stc-note,
.stc-ticks { display: none; }

/* ── Left: header ── */
.stc-eyebrow {
  display: inline-flex; align-items: center; gap: 5px;
  align-self: flex-start;
  font-size: .55rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--stc-green);
  background: var(--stc-green-lite);
  border: 1px solid rgba(0,136,69,.2);
  border-radius: 20px; padding: 2px 8px; margin-bottom: 4px;
}

.stc-title {
  font-family: 'Roboto', sans-serif;
  font-size: 1.15rem;
  font-weight: 700; color: var(--stc-dark);
  line-height: 1.1; margin-bottom: 0;
}

.stc-sliders {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 8px;
}

/* ── Slider group ── */
.stc-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 4px;
}

.stc-label {
  font-size: .88rem; font-weight: 500;
  color: var(--stc-text);
}

.stc-val {
  font-family: 'Roboto', sans-serif;
  font-size: 1.15rem; font-weight: 700;
  color: var(--stc-green); line-height: 1;
  transition: transform .1s;
}
.stc-val.bump { transform: scale(1.15); }

.stc-unit {
  font-size: .6rem; color: var(--stc-muted);
  margin-left: 2px; font-weight: 400;
}

.stc-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--stc-green) var(--pct, 20%), var(--stc-border) var(--pct, 20%));
  transition: background .05s;
}
.stc-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: #ffffff; border: 2px solid var(--stc-green);
  box-shadow: 0 1px 6px rgba(0,0,0,.15), 0 0 0 2px rgba(0,136,69,.1);
  cursor: grab; transition: transform .15s, box-shadow .15s;
}
.stc-range::-webkit-slider-thumb:active {
  cursor: grabbing; transform: scale(1.12);
  box-shadow: 0 2px 10px rgba(0,0,0,.2), 0 0 0 4px rgba(0,136,69,.18);
}
.stc-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #ffffff; border: 2px solid var(--stc-green);
  cursor: grab;
}

.stc-ticks {
  justify-content: space-between;
  margin-top: 3px;
  font-size: .58rem; color: var(--stc-muted); opacity: .65;
}

/* ── Right: result card ── */
.stc-right {
  display: flex;
  flex-direction: column;
}

.stc-card {
  background: var(--stc-bg);
  border-radius: 10px;
  padding: 10px 16px;
  border: 1px solid var(--stc-border);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stc-card-label {
  font-size: .55rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--stc-muted); margin-bottom: 1px;
}

.stc-amount {
  font-family: 'Roboto', sans-serif;
  font-size: 2rem;
  font-weight: 700; color: var(--stc-green); line-height: 1;
  margin-bottom: 1px;
  transition: transform .15s ease;
}
.stc-amount.bump { transform: scale(1.04); }

.stc-desc {
  font-size: .65rem; color: var(--stc-muted); margin-bottom: 7px;
}

.stc-breakdown {
  background: #ffffff; border-radius: 6px;
  padding: 5px 10px; margin-bottom: 6px;
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid var(--stc-border);
}

/* Nascondi le prime due righe — mostra solo "Guadagno netto" */
.stc-row { display: none; }
.stc-row.total {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; color: var(--stc-dark);
  font-size: .9rem;
}
.stc-row.total strong {
  color: var(--stc-green);
  font-size: 1rem;
}

.stc-roi {
  display: flex; align-items: center; gap: 5px;
  font-size: .78rem; color: var(--stc-green); font-weight: 600;
  background: var(--stc-green-lite); border-radius: 5px;
  padding: 4px 8px; margin-bottom: 7px;
}
.stc-roi svg { flex-shrink: 0; }

.stc-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%;
  background: var(--stc-green);
  color: #ffffff;
  padding: 7px 16px; border-radius: 6px;
  font-family: 'Roboto', sans-serif; font-weight: 700; font-size: .8rem;
  text-decoration: none;
  box-shadow: var(--stc-shadow-grn);
  transition: background .18s, transform .15s, box-shadow .15s;
}
.stc-cta:hover {
  background: var(--stc-green-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,136,69,.28);
  color: #ffffff;
}

/* ── Responsive: sotto 840px torna a layout verticale senza aspect-ratio ── */
@media (max-width: 840px) {
  .stc-wrap {
    aspect-ratio: unset;
    padding: 24px 18px;
    overflow: visible;
  }
  .stc-inner {
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
  }
  .stc-subtitle,
  .stc-note { display: block; }
  .stc-ticks { display: flex; }
  .stc-row { display: flex; }
  .stc-right { flex-direction: column; }
  .stc-card { flex: none; padding: 16px; }
  .stc-amount { font-size: 2.4rem; }
  .stc-label { font-size: .9rem; }
  .stc-row.total { font-size: 1rem; }
  .stc-row.total strong { font-size: 1.1rem; }
  .stc-roi { font-size: .85rem; }
}
