/* NaturalSynth — Valori Nutrizionali — ns_nutrizionali v1.2 */

/* ══════════════════════════════════════════════════════════════════
   SEZIONE PRINCIPALE
══════════════════════════════════════════════════════════════════ */

.ns-product-sheet {
  margin-top: 2rem;
  margin-bottom: 2rem;
  font-family: inherit;
}

/* Header del blocco */
.ns-sheet-header {
  display: flex;
  align-items: center;
  background: #2c3e50;
  padding: 13px 20px;
  border-radius: 4px 4px 0 0;
}

.ns-sheet-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
}

/* Corpo del blocco */
.ns-sheet-body {
  background: #fff;
  border: 1px solid #dde3ea;
  border-top: none;
  border-radius: 0 0 4px 4px;
  padding: 28px 24px;
}

/* ══════════════════════════════════════════════════════════════════
   SOTTOSEZIONI
══════════════════════════════════════════════════════════════════ */

.ns-sheet-block {
  margin-bottom: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid #edf2f7;
}

.ns-sheet-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.ns-block-title {
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #2c3e50;
  margin-bottom: 14px !important;
  padding-bottom: 7px;
  border-bottom: 2px solid #3498db;
  display: inline-block;
}

/* Contenuto testo (modo_uso, formato) */
.ns-block-content p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #444;
  line-height: 1.65;
}

.ns-block-content p:last-child {
  margin-bottom: 0;
}

.ns-block-content ul,
.ns-block-content ol {
  padding-left: 1.2rem;
  margin-bottom: 0;
}

.ns-block-content li {
  font-size: 0.9rem;
  color: #444;
  line-height: 1.65;
  margin-bottom: 0.3rem;
}

/* ══════════════════════════════════════════════════════════════════
   AVVERTENZE
══════════════════════════════════════════════════════════════════ */

.ns-warnings-content {
  background: #fffbf0;
  border: 1px solid #f0d980;
  border-left: 4px solid #f0b429;
  border-radius: 0 4px 4px 0;
  padding: 14px 16px;
}

.ns-warnings-content p,
.ns-warnings-content li {
  font-size: 0.85rem;
  color: #5a4600;
  line-height: 1.6;
}

.ns-default-warnings {
  margin: 0;
  padding-left: 1.2rem;
}

.ns-default-warnings li {
  margin-bottom: 0.25rem;
}

.ns-default-warnings li:last-child {
  margin-bottom: 0;
}

/* ══════════════════════════════════════════════════════════════════
   TABELLA NUTRIZIONALE — DESKTOP
   Visibile su schermi ≥ 768px.
══════════════════════════════════════════════════════════════════ */

.ns-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-left: -2px;
  margin-right: -2px;
}

.ns-nutrition-table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid #dde3ea;
  border-radius: 3px;
}

/* Intestazione */
.ns-nutrition-table thead tr {
  background-color: #2c3e50;
}

.ns-nutrition-table thead th {
  padding: 10px 14px;
  color: #fff;
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none;
  white-space: nowrap;
}

.ns-nutrition-table thead th.ns-col-nutrient {
  text-align: left;
  min-width: 140px;
}

.ns-nutrition-table thead th.ns-col-value,
.ns-nutrition-table thead th.ns-col-vnr {
  text-align: right;
  min-width: 80px;
}

/* Righe corpo */
.ns-nutrition-table tbody tr {
  border-bottom: 1px solid #e8ecf0;
}

.ns-nutrition-table tbody tr:nth-child(even) {
  background-color: #f7f9fb;
}

.ns-nutrition-table tbody tr:last-child {
  border-bottom: 2px solid #2c3e50;
}

.ns-nutrition-table tbody td {
  padding: 8px 14px;
  vertical-align: middle;
  color: #333;
}

.ns-nutrition-table tbody td.ns-col-nutrient {
  text-align: left;
}

.ns-nutrition-table tbody td.ns-col-value,
.ns-nutrition-table tbody td.ns-col-vnr {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Riga header sottosezione (is_bold=1) */
.ns-nutrition-table tbody tr.ns-row-header td {
  font-weight: 700;
  background-color: #eaf0f6;
  color: #1a2a3a;
}

.ns-nutrition-table tbody tr.ns-row-header td.ns-col-nutrient {
  border-left: 3px solid #3498db;
  padding-left: 11px;
}

/* Nota VNR */
.ns-vnr-note {
  font-size: 0.72rem;
  color: #999;
  margin-top: 8px;
  margin-bottom: 0;
}

/* ══════════════════════════════════════════════════════════════════
   INGREDIENTI
══════════════════════════════════════════════════════════════════ */

.ns-ingredients-content {
  background: #f8fcf8;
  border: 1px solid #d4e8d4;
  border-left: 4px solid #5cb85c;
  border-radius: 0 4px 4px 0;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: #333;
  line-height: 1.7;
}

/* ══════════════════════════════════════════════════════════════════
   ANCHOR BUTTON (right-column prodotto)
══════════════════════════════════════════════════════════════════ */

.ns-anchor-wrapper {
  margin-top: 10px;
}

.ns-anchor-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f0f4f8;
  border: 1px solid #c8d6e5;
  border-radius: 4px;
  color: #2c3e50;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}

.ns-anchor-btn:hover,
.ns-anchor-btn:focus {
  background: #dde8f4;
  border-color: #3498db;
  color: #1a2a3a;
  text-decoration: none !important;
}

.ns-anchor-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE TABLET — leggero adattamento padding/font
   768px → 481px
══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .ns-sheet-body {
    padding: 20px 16px;
  }

  .ns-nutrition-table thead th,
  .ns-nutrition-table tbody td {
    padding: 7px 10px;
    font-size: 0.82rem;
  }
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE — Layout card verticale senza swipe
   ≤ 600px: tabella classica → card per nutriente
   Nessun overflow orizzontale. Tutto leggibile nella viewport.
══════════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {

  /* Rimuovi l'overflow scroll: non serve più */
  .ns-table-scroll {
    overflow-x: visible;
    margin: 0;
  }

  /* Tabella e corpo → blocchi a tutta larghezza */
  .ns-nutrition-table,
  .ns-nutrition-table tbody {
    display: block;
    width: 100%;
    border: none;
    min-width: 0;
  }

  /* Nascondi header: le label vengono dai data-label ::before */
  .ns-nutrition-table thead {
    display: none;
  }

  /* ── Ogni riga → card ────────────────────────────────────── */
  .ns-nutrition-table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid #dde3ea;
    border-radius: 5px;
    margin-bottom: 6px;
    padding: 10px 12px 6px;
  }

  /* Zebra off su mobile — ogni card ha già il suo bordo */
  .ns-nutrition-table tbody tr:nth-child(even) {
    background: #fff;
  }

  /* Card header nutriente (is_bold) */
  .ns-nutrition-table tbody tr.ns-row-header {
    background: #eaf0f6;
    border-left: 3px solid #3498db;
    border-bottom: 1px solid #c8d9ea;
  }

  /* Reset: nessun border-bottom sull'ultima riga (già hanno card) */
  .ns-nutrition-table tbody tr:last-child {
    border-bottom: 1px solid #dde3ea;
  }

  /* ── Celle come righe flex label:valore ─────────────────── */
  .ns-nutrition-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
    border: none;
    background: transparent !important;
    font-size: 0.86rem;
    color: #333;
    white-space: normal;
  }

  /* ── Nome nutriente: titolo bold della card ─────────────── */
  .ns-nutrition-table tbody td.ns-col-nutrient {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a2a3a;
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
  }

  /* Header row: rimuovi bordo sinistro extra sulla cella (è già sulla card) */
  .ns-nutrition-table tbody tr.ns-row-header td.ns-col-nutrient {
    border-left: none;
    padding-left: 0;
    color: #1a3a5c;
  }

  /* ── Label automatica via ::before (attr data-label) ────── */
  .ns-nutrition-table tbody td.ns-col-value::before,
  .ns-nutrition-table tbody td.ns-col-vnr::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.78rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    padding-right: 8px;
  }

  /* Valore a destra */
  .ns-nutrition-table tbody td.ns-col-value,
  .ns-nutrition-table tbody td.ns-col-vnr {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  /* ── Adattamenti generali della sezione su mobile ─────── */
  .ns-sheet-body {
    padding: 16px 14px;
  }

  .ns-sheet-header {
    padding: 11px 16px;
  }

  .ns-block-title {
    font-size: 0.78rem !important;
  }

  .ns-block-content p,
  .ns-block-content li {
    font-size: 0.86rem;
  }

  .ns-warnings-content p,
  .ns-warnings-content li {
    font-size: 0.82rem;
  }
}
