/* =============================================================
   SALA BOTTONI - VARIANTE A: DARK MIGLIORATO (default v118.10)
   -------------------------------------------------------------
   Mantiene lo schema scuro attuale ma alza i contrasti:
   - testi #ffffff puro (anziche crema #fff2cf -> piu nitido al sole)
   - bordo bottoni 3px giallo saturo #ffd640
   - tap area .sb-chip min-height 96px (era 84px)
   - badge verde piu saturo
   Pensato per: ambienti con riflessi laterali, perito che alza
   schermo verso ombra. Sfondo nero assorbe i riflessi del cielo.
   ============================================================= */

/* Modal full screen */
#salaBottoniModal {
  background: #0a0e16 !important;
}

/* Header sticky */
#salaBottoniModal > div:first-child {
  background: #0d1018 !important;
  border-bottom: 2px solid #ffd640 !important;
  color: #ffffff !important;
}
#salaBottoniTitolo { color: #ffffff !important; font-weight: 800 !important; }
#salaBottoniSub   { color: #ffffff !important; opacity: .85 !important; }

/* Barra ricerca */
#salaBottoniRicercaBar { background: #0d1018 !important; border-bottom: 1px solid #1f2a3a !important; }
#salaBottoniRicercaInput {
  background: #11161f !important;
  color: #ffffff !important;
  border: 2px solid #ffd640 !important;
  font-weight: 700 !important;
}
#salaBottoniRicercaInput::placeholder { color: #ffffff !important; opacity: .55 !important; }
#salaBottoniRicercaClear { background: #23303e !important; color: #ffffff !important; }

/* Barra categorie */
#salaBottoniCategorieBar { background: #0d1018 !important; border-bottom: 1px solid #1f2a3a !important; }

/* Griglia — v118.9.6 DINAMICA: minmax adatta colonne, altezza AUTO (no più cut)
   align-items:start = ogni bottone si dimensiona da solo, niente stretch forzato */
#salaBottoniGriglia {
  background: #11161f !important;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
  grid-auto-rows: auto !important;
  align-items: start !important;
}
#salaBottoniLoading { color: #ffffff !important; opacity: .8 !important; }

/* v118.9.2: categoria chip "spenta" (Opzione A) - zona non ha bottoni di quella cat */
.sb-cat-chip.sb-cat-vuota {
  background: #11161f;
  color: #555;
  cursor: not-allowed;
  opacity: 0.4;
  text-decoration: line-through;
}
.sb-cat-chip.sb-cat-vuota:hover { background: #11161f; }

/* v118.9.2: riga "Piu' usati" sopra la griglia normale */
.sb-piu-usati-titolo {
  grid-column: 1 / -1;
  color: #ffd640;
  font-size: .85rem;
  font-weight: 800;
  padding: 8px 4px 4px;
  letter-spacing: .3px;
}
.sb-tutti-titolo {
  grid-column: 1 / -1;
  color: #fff2cf;
  font-size: .8rem;
  font-weight: 700;
  padding: 14px 4px 4px;
  opacity: .7;
  border-top: 1px solid #1f2a3a;
  margin-top: 6px;
}
.sb-chip.sb-chip-preferito {
  border-bottom-color: #ff9800;
  box-shadow: 0 3px 8px rgba(255, 152, 0, 0.25);
}
/* v118.9.7: stella INLINE dentro il nome componente (no più absolute -> no overlap) */
.sb-chip-stella {
  display: inline-block;
  font-size: .9rem;
  color: #ffd640;
  margin-right: 2px;
  vertical-align: baseline;
}

/* Chip categorie filtri */
.sb-cat-chip {
  background: #23303e; color: #ffffff; border: 0; padding: 6px 12px;
  border-radius: 8px; cursor: pointer; font-size: .85rem; font-weight: 800;
  min-height: 40px; flex-shrink: 0; white-space: nowrap;
}
.sb-cat-chip.attiva {
  background: #ffd640; color: #1a1a1a; box-shadow: 0 0 0 2px #ffffff inset;
}

/* Contatore */
.sb-conteggio {
  background: #0d1018; color: #ffffff; opacity: .7;
  font-size: .82rem; padding: 6px 14px; flex-shrink: 0;
  border-top: 1px solid #1f2a3a; text-align: center; font-weight: 600;
}

/* Bottone combinazione - OUTDOOR FIRST: piu grande, piu contrasto */
.sb-chip {
  background: #1f2a1e;
  color: #ffffff;
  border: 0;
  border-bottom: 3px solid #ffd640;
  border-radius: 12px;
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  min-height: 96px;
  box-shadow: 0 3px 8px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.sb-chip:active { transform: scale(.97); }
.sb-chip.selezionato {
  background: #2a3a26;
  border-bottom-color: #ff7700;
  box-shadow: 0 0 0 3px #ffd640 inset, 0 3px 8px rgba(0,0,0,.4);
}
.sb-chip-comp {
  font-size: clamp(.92rem, 2.6vw, 1.05rem);
  font-weight: 800;
  color: #ffd640;
  line-height: 1.18;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.sb-chip-cf {
  font-size: clamp(.78rem, 2.2vw, .88rem);
  font-weight: 700;
  color: #ffffff;
  opacity: .95;
  line-height: 1.25;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.sb-chip-codes {
  font-size: .72rem;
  opacity: .65;
  color: #ffffff;
  font-family: monospace;
  margin-top: auto;
}
.sb-chip-macro {
  font-size: .68rem;
  font-weight: 800;
  color: #ffaa33;
  letter-spacing: .5px;
  text-transform: uppercase;
  opacity: 1;
  margin-bottom: 2px;
}
.sb-chip-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #1b5e20;
  color: #ffffff;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: .72rem;
  font-weight: 800;
  border: 1px solid #66bb6a;
}

/* Footer */
#salaBottoniModal > div:last-child {
  background: #0d1018 !important;
  color: #ffffff !important;
  border-top: 2px solid #1f2a3a !important;
}

/* Chip gravita C0-C3 — v118.9.6 footer compatto: min 44px touch-safe (Apple HIG) */
.sb-grav-chip {
  background: #23303e;
  color: #ffffff;
  border: 0;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 800;
  font-size: .85rem;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  min-width: 58px;
  flex-shrink: 0;
}
.sb-grav-chip.selezionato {
  background: #ffd640;
  color: #1a1a1a;
  box-shadow: 0 0 0 2px #ffffff inset;
}
.sb-grav-chip-small {
  display: block;
  font-size: .70rem;
  font-weight: 600;
  opacity: .85;
  margin-top: 2px;
}

/* Bottoni azione footer */
#salaBottoniAggiungi {
  background: #ffd640 !important;
  color: #1a1a1a !important;
  border-bottom: 3px solid #e68900 !important;
  font-weight: 800 !important;
}
#salaBottoniAnnulla {
  background: #23303e !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Empty state */
.sb-empty {
  grid-column: 1/-1;
  text-align: center;
  color: #ffffff;
  opacity: .8;
  padding: 40px 20px;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 600;
}

/* v118.9.4 ROLLBACK: sezione v118.9.3 rimossa (layout responsive ha rotto la griglia
   con sovrapposizioni). Ritorno al layout v118.9.2 stabile. */

/* v118.9.6 — MOBILE (≤600px): minmax 130, bottone compatto ma codici visibili */
/* v118.9.19 Giuseppe 07/06/2026: fix OVERLAP — gap 12px (era 6), align-self start esplicito,
   row-gap separato per spazio verticale extra (codici/sinonimi su 3+ righe non si sovrappongono). */
@media (max-width: 600px) {
  #salaBottoniGriglia {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 12px 6px !important;          /* row-gap 12px, col-gap 6px */
    padding: 8px !important;
  }
  .sb-chip {
    min-height: 88px;
    padding: 10px 10px !important;
    align-self: start !important;       /* niente stretch -> altezza propria */
    position: relative;                  /* ancora per sb-chip-badge absolute */
  }
  .sb-chip-comp { font-size: .92rem; }
  .sb-chip-cf   { font-size: .78rem; }
  .sb-chip-sinonimi { font-size: .70rem; line-height: 1.15; }
  .sb-chip-codes { opacity: .4 !important; font-size: .66rem; }
  /* v118.9.19: posizione (Faro AS) — chip dorata accanto al nome componente */
  .sb-chip-pos {
    display: inline-block;
    background: #ffd640;
    color: #1a1a1a;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: .78rem;
    font-weight: 800;
    margin-left: 2px;
    vertical-align: baseline;
  }
  /* Header mini su mobile: titolo più stretto, icone più piccole */
  #salaBottoniHeader { padding: 6px 8px !important; gap: 4px !important; }
  #salaBottoniTitolo { font-size: .9rem !important; }
}
/* v118.9.19: .sb-chip-pos anche desktop/tablet (default) */
.sb-chip-pos {
  display: inline-block;
  background: #ffd640;
  color: #1a1a1a;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: .8rem;
  font-weight: 800;
  margin-left: 4px;
  vertical-align: baseline;
}

/* v118.9.21 Giuseppe 07/06/2026: iconcina toggle preferiti del perito (alto-dx tile) */
.sb-chip { position: relative; }
.sb-chip-stella-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 28px;
  min-width: 28px;
  padding: 2px 6px;
  background: transparent;
  color: #ffd640;
  border: 1.5px solid #ffd640;
  border-radius: 14px;
  font-size: .8rem;
  font-weight: 800;
  cursor: pointer;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.sb-chip-stella-toggle.sb-pref-add {
  background: rgba(255,214,64,0.08);
}
.sb-chip-stella-toggle.sb-pref-mio {
  background: #ffd640;
  color: #1a1a1a;
}
.sb-chip-stella-toggle.sb-pref-globale {
  border-color: #ff9800;
  color: #ff9800;
  cursor: default;
  background: transparent;
}
.sb-chip-stella-toggle:active { transform: scale(.92); }

/* v118.9.6 — TABLET (601-1024px): 3-4 colonne larghe */
@media (min-width: 601px) and (max-width: 1024px) {
  #salaBottoniGriglia {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
  }
  .sb-chip { min-height: 100px; }
}

/* v118.9.6 — DESKTOP (≥1025px): cards larghe leggibili */
@media (min-width: 1025px) {
  #salaBottoniGriglia {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  }
  .sb-chip { min-height: 110px; }
}
