/* Comparatore multi-offerta Dagiashi */
.offers-compare {
  --oc-accent: #c45c26;
  --oc-ink: #1a1a1a;
  --oc-muted: #5c5c5c;
  --oc-line: #d8e2e4;
  --oc-best: #eef8f2;
  --oc-best-ink: #1f6b3a;
  --oc-panel: #ffffff;
  margin: 2.5rem 0 1rem;
  padding-block: clamp(1.35rem, 3vw, 2rem);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(247, 251, 251, 0.92) 100%);
  border-block: 1px solid rgba(0, 113, 133, 0.1);
}

.offers-compare .shell {
  background: var(--oc-panel);
  border: 1px solid rgba(0, 113, 133, 0.16);
  border-radius: 12px;
  padding: clamp(1.15rem, 2.5vw, 1.75rem);
  box-shadow:
    0 1px 2px rgba(15, 17, 17, 0.04),
    0 10px 32px rgba(0, 113, 133, 0.1);
}

.offers-compare__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}

.offers-compare__title {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  letter-spacing: -0.02em;
  color: var(--oc-ink);
}

.offers-compare__lead {
  margin: 0.25rem 0 0;
  color: var(--oc-muted);
  font-size: 0.95rem;
  max-width: 42rem;
}

.offers-compare__sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.offers-compare__sort select {
  border: 1px solid var(--oc-line);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  background: #fff;
}

.offers-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--oc-line);
  border-radius: 10px;
  background: #fafcfd;
  max-width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.offers-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.95rem;
}

.offers-table th,
.offers-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--oc-line);
  vertical-align: middle;
}

.offers-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--oc-muted);
  background: #edf3f4;
  border-bottom: 1px solid #cfd9dc;
}

.offers-table tr:last-child td {
  border-bottom: 0;
}

.offers-table tr.is-best {
  background: var(--oc-best);
  box-shadow: inset 3px 0 0 #1f6b3a;
}

.offers-badge-best {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--oc-best-ink);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.offers-merchant {
  font-weight: 600;
  color: var(--oc-ink);
}

.offers-trust {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--oc-muted);
}

.offers-trust__bar {
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: #e8e4de;
  overflow: hidden;
}

.offers-trust__fill {
  height: 100%;
  background: var(--oc-accent);
}

.offers-price {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.offers-total {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--oc-muted);
}

.offers-ship-free {
  color: var(--oc-best-ink);
  font-weight: 600;
}

.offers-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  background: var(--oc-accent);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease;
}

.offers-cta:hover {
  background: #a84b1c;
  transform: translateY(-1px);
}

.buybox-compare-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #f3efe8;
  color: var(--oc-ink);
  font-size: 0.85rem;
  font-weight: 600;
}

.buybox-compare-pill a {
  color: var(--oc-accent);
}

.price-alert {
  position: relative;
  z-index: 2;
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px dashed var(--oc-line);
  border-radius: 10px;
  background: #fcfaf7;
}

.price-alert--dagiashi {
  margin-top: 1.35rem;
  padding: 1.1rem 1.15rem 1.15rem;
  border: 1px solid rgba(0, 113, 133, 0.22);
  border-left: 4px solid #007185;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 113, 133, 0.07) 0%, rgba(199, 81, 31, 0.05) 100%);
  box-shadow: 0 4px 18px rgba(0, 113, 133, 0.1);
}

.price-alert--dagiashi .price-alert__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.35rem;
}

.price-alert--dagiashi .price-alert__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #0e7490 0%, #007185 100%);
}

.price-alert--dagiashi .price-alert__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--oc-ink, #0f1111);
}

.price-alert--dagiashi .price-alert__hint {
  margin-bottom: 0.85rem;
  font-size: 0.86rem;
  line-height: 1.5;
}

.price-alert--dagiashi .price-alert__form input {
  border-color: rgba(0, 113, 133, 0.28);
  background: #fff;
}

.price-alert--dagiashi .price-alert__form input:focus {
  outline: 2px solid rgba(0, 113, 133, 0.25);
  border-color: #007185;
}

.price-alert--dagiashi .price-alert__form button {
  background: linear-gradient(135deg, #0e7490 0%, #007185 52%, #005f6b 100%);
  border: 1px solid #005f6b;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(0, 113, 133, 0.18);
}

.price-alert--dagiashi .price-alert__form button:hover {
  filter: brightness(1.05);
}

.price-alert__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.price-alert__hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--oc-muted);
}

.price-alert__form {
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .price-alert__form {
    grid-template-columns: 1fr 7rem auto;
    align-items: end;
  }

  .price-alert__form .price-alert__msg {
    grid-column: 1 / -1;
  }
}

.price-alert__form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--oc-muted);
}

.price-alert__form input {
  border: 1px solid var(--oc-line);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font: inherit;
}

.price-alert__form button {
  border: 0;
  border-radius: 6px;
  padding: 0.55rem 0.9rem;
  background: var(--oc-ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}

.price-alert__form button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.price-alert__msg {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

.price-alert__msg.is-ok {
  color: var(--oc-best-ink);
}

.price-alert__msg.is-err {
  color: #9b2c2c;
}

/* Tema scuro: stessi token del sito (html[data-theme="dark"]) */
html[data-theme="dark"] .offers-compare {
  --oc-ink: #f2efe9;
  --oc-muted: #b0aaa0;
  --oc-line: #3f3c37;
  --oc-best: #1a2a1f;
  --oc-best-ink: #8fd4a8;
  --oc-panel: #1e293b;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.45) 0%, rgba(30, 41, 59, 0.72) 100%);
  border-block-color: rgba(125, 211, 252, 0.12);
}

html[data-theme="dark"] .offers-compare .shell {
  background: var(--oc-panel);
  border-color: rgba(125, 211, 252, 0.18);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .offers-table-wrap {
  background: #151922;
  border-color: var(--oc-line);
}

html[data-theme="dark"] .offers-table th {
  background: #252320;
}

html[data-theme="dark"] .offers-compare__sort select,
html[data-theme="dark"] .price-alert__form input {
  background: #1c1b19;
  color: var(--oc-ink);
  border-color: var(--oc-line);
}

html[data-theme="dark"] .offers-trust__bar {
  background: #3a3834;
}

html[data-theme="dark"] .buybox-compare-pill {
  background: #2a2824;
}

html[data-theme="dark"] .price-alert {
  background: #252320;
  border-color: var(--oc-line);
  color: var(--oc-ink);
}

html[data-theme="dark"] .price-alert--dagiashi {
  background: linear-gradient(135deg, rgba(0, 113, 133, 0.16) 0%, rgba(199, 81, 31, 0.1) 100%);
  border-color: rgba(125, 211, 252, 0.22);
  border-left-color: #7dd3fc;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .price-alert--dagiashi .price-alert__form input {
  background: var(--surface-2, #1e293b);
  border-color: var(--border-strong, #334155);
  color: var(--text, #f8fafc);
}

html[data-theme="dark"] .price-alert--dagiashi .price-alert__form button {
  background: linear-gradient(135deg, #0e7490 0%, #007185 52%, #005f6b 100%);
  color: #fff;
  border-color: #005f6b;
}

html[data-theme="dark"] .price-alert__title {
  color: var(--oc-ink);
}

html[data-theme="dark"] .price-alert__msg.is-err {
  color: #f0a0a0;
}

.card-offers-count,
.card-discount-badge {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.card-offers-count {
  color: var(--oc-muted, #5c5c5c);
}

.card-discount-badge {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #1f6b3a;
  color: #fff;
}

.card-price-from {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.1rem;
}

@media (max-width: 720px) {
  .offers-compare {
    margin: 1.5rem 0 0.75rem;
  }

  .offers-compare__head {
    flex-direction: column;
    align-items: stretch;
  }

  .offers-compare__sort {
    width: 100%;
    justify-content: space-between;
  }

  .offers-compare__sort select {
    flex: 1;
    min-height: 44px;
    font-size: 16px;
  }

  /* Mobile: card per offerta — niente scroll orizzontale */
  .offers-compare .shell {
    padding: 1rem 0.85rem 1.05rem;
    border-radius: 10px;
  }

  .offers-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    border-radius: 0;
  }

  .offers-table {
    min-width: 0;
    display: block;
  }

  .offers-table thead {
    display: none;
  }

  .offers-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .offers-table tr {
    display: block;
    border: 1px solid var(--oc-line);
    border-radius: 12px;
    background: #fff;
    padding: 0.85rem 0.9rem 0.75rem;
    box-shadow: 0 1px 3px rgba(15, 17, 17, 0.05);
  }

  .offers-table tr.is-best {
    border-color: var(--oc-best-ink);
    box-shadow: 0 0 0 1px var(--oc-best-ink);
  }

  .offers-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--oc-line);
    text-align: right;
  }

  .offers-table td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--oc-muted);
    text-align: left;
    flex: 0 0 38%;
  }

  .offers-table td:first-child {
    display: block;
    border-bottom: 1px solid var(--oc-line);
    padding-bottom: 0.65rem;
    margin-bottom: 0.15rem;
    text-align: left;
  }

  .offers-table td:first-child::before {
    display: none;
  }

  .offers-table td:last-child {
    border-bottom: 0;
    padding-top: 0.65rem;
    flex-direction: column;
    align-items: stretch;
  }

  .offers-table td:last-child::before {
    display: none;
  }

  .offers-table td:last-child .offers-cta {
    width: 100%;
    min-height: 48px;
    font-size: 0.95rem;
  }

  .offers-price {
    white-space: normal;
  }

  .offers-table th:nth-child(4),
  .offers-table td:nth-child(4) {
    display: flex;
  }
}
