/* BlackBird – Configuratore prodotto (layout pulito + modali affidabili)
   v2.1 — 2025-09-08
   - Sistema layout desktop/mobile
   - Canvas centrato e container a larghezza corretta
   - Price bar flessibile (niente larghezze fisse)
   - Nasconde i <select> "Colore Nome/Numero" e usa veri modali
   - Modali robusti con classe .is-open (compatibile con i temi)
*/

.bb-configurator {
  --bg: #fff;
  --text: #111827;
  --muted: #6B7280;
  --muted-2: #9CA3AF;
  --panel: #ffffff;
  --line: #E5E7EB;
  --header: #E5E7EB;
  --header-active: #D1D5DB;
  --yellow: #FFD700;
  --yellow-2: #FFC700;
  --vh-pad: 170px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  color: var(--text);
  margin-top: 30px;
}




/* Nasconde il pulsante di aggiunta al carrello Woo predefinito nella pagina prodotto */
:is(.elementor-widget-woocommerce-product-add-to-cart, .woocommerce div.product .elementor-widget-woocommerce-product-add-to-cart, .elementor-widget-wc-add-to-cart, .woocommerce div.product .elementor-widget-wc-add-to-cart) form.cart.variations_form .woocommerce-variation-add-to-cart,
:is(.elementor-widget-woocommerce-product-add-to-cart, .woocommerce div.product .elementor-widget-woocommerce-product-add-to-cart, .elementor-widget-wc-add-to-cart, .woocommerce div.product .elementor-widget-wc-add-to-cart) form.cart:not(.grouped_form):not(.variations_form) {
  display: none !important;
  flex-wrap: nowrap;
}




/* Dots colore sempre pieni */
.bb-swatch .color-preview-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c, #ddd) !important;
  border: 1px solid #c9c9c9;
}

.bb-swatch.is-active .color-preview-swatch,
.bb-swatch:focus-visible .color-preview-swatch {
  outline: 2px solid #222;
  outline-offset: 2px;
}

/* Badge nelle intestazioni della sidebar */
.sidebar .sidebar-header .bb-mini-badge {
  float: right;
  background: #6b6b6b;
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 18px;
  opacity: .9;
  font-style: normal;
}

.bb-font-demo {
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  line-height: 1.1;
  font-size: 20px;
  background: #fff;
}

/* la mini-swatch è ora il “bottone” */
.bb-textcolor-picker .bb-swatch-inline {
  cursor: pointer;
}

.bb-textcolor-picker .bb-swatch-inline:focus {
  outline: 2px solid #111;
  outline-offset: 2px;
}

/* se nel markup fosse rimasto un vecchio bottone, nascondilo */
.bb-open-color-btn {
  display: none !important;
}


/* Hide di sicurezza dei select testo/numero (JS li nasconde comunque) */
.bb-textcolor-picker .bb-select-with-swatch select {
  display: none !important;
}

.bb-textcolor-picker .bb-select-with-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bb-textcolor-picker .bb-swatch-inline {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid #c9c9c9;
  background: #ddd;
}

/* Nascondi il resto del template prodotto */
.bb-configurator .product_title,
.bb-configurator .summary,
.bb-configurator .entry-summary,
.bb-configurator .woocommerce-product-gallery,
.bb-configurator .woocommerce-tabs,
.bb-configurator .related,
.bb-configurator .upsells {
  display: none !important;
}

.bb-configurator-mode .elementor-element.addtocart-blackbird,
.bb-configurator-mode .elementor-element.addtocart-blackbird .stock {
  display: none !important;
}

.bb-configurator .sidebar-header {
  scroll-margin-top: 72px !important;
}

/* ===== Layout base ===== */
.bb-configurator .main-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 16px 14px;
  display: grid;
  grid-template-columns: 380px 1fr;
  /* sidebar + canvas */
  gap: 24px;
  align-items: start;
}

.bb-configurator .sidebar {
  grid-column: 1;
  grid-row: 1;
}


.bb-font-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 99998;
  display: none
}

.bb-font-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  width: min(940px, 92vw);
  max-height: min(80vh, 1000px);
  display: none;
  overflow: hidden
}

.bb-font-modal.is-open,
.bb-font-modal-backdrop.is-open {
  display: block
}

.bb-font-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  max-height: 64vh;
  overflow: auto
}

.font-tile {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  cursor: pointer
}

.font-tile img {
  display: block;
  width: 100%;
  max-height: 110px;
  object-fit: contain;
  background: #fff
}

.bb-empty {
  padding: 12px;
  color: #666
}

.bb-logo-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 99998;
  display: none
}

.bb-logo-modal {
  position: fixed;
  inset: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  width: min(940px, 92vw);
  max-height: min(80vh, 1000px);
  display: none;
  overflow: hidden
}

.bb-logo-modal header {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between
}

.bb-logo-modal .bb-logo-search {
  flex: 1;
  display: flex;
  gap: 8px
}

.bb-logo-modal .bb-logo-search input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px
}

.bb-logo-modal .bb-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  overflow: auto;
  max-height: 64vh
}

.bb-logo-modal .thumb {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  cursor: pointer;
  transition: .15s box-shadow
}

.bb-logo-modal .thumb:hover {
  box-shadow: 0 0 0 2px #409eff33
}

.bb-logo-modal .thumb img {
  display: block;
  width: 100%;
  max-height: 110px;
  object-fit: contain;
  background: #fff
}

.bb-logo-modal footer {
  padding: 10px 16px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 8px
}

.bb-hidden {
  display: none !important
}

.link {
  background: none;
  border: none;
  padding: 0;
  color: #0a58ca;
  text-decoration: underline;
  cursor: pointer
}


@media (min-width:1025px) {
  .bb-configurator .sidebar {
    position: sticky;
    top: 16px;
    width: auto;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background-color: #000;
    padding-right: 16px; /* 🔹 spazio interno extra per Firefox */
    background-image: linear-gradient(to right, transparent calc(100% - 12px), #000 calc(100% - 12px)); /* maschera nera sotto la scrollbar */
    background-clip: padding-box;
    scrollbar-width: auto;
    scrollbar-color: rgb(255, 254, 254) rgb(6, 6, 6);
    margin-right: -10px; /* Compensa lo spazio della scrollbar */
  }
  @supports (-webkit-appearance: none) {
    /* Solo browser WebKit (Chrome, Edge, Safari, Opera) */
    .bb-configurator .sidebar {
      padding-right: 0px !important; /* più attaccata su Chrome */
      
}
  }

  /* Chrome, Edge, Opera */
  .bb-configurator .sidebar::-webkit-scrollbar {
    width: 8px;
  }

  .bb-configurator .sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
  }

  .bb-configurator .sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background-clip: content-box;
  }

  .bb-configurator .sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.6);
  }
}


/* ===== Canvas e contenitore immagine ===== */
.bb-configurator .image-container {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  width: clamp(320px, 60vw, 1600px);
  max-width: 100%;
  margin-inline: auto;

  background: #f9f9f9;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: clamp(8px, 1.2vw, 20px);
}

.bb-configurator #customizationCanvas {
  display: block;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  width: min(100%, calc((100vh - var(--vh-pad)) * 4 / 3));
  height: auto;
  background: #fff;
  border-radius: 6px;
  object-fit: contain;
}

/* ===== Price bar flessibile sotto al canvas ===== */
.bb-configurator .image-container>.price-bar {
  position: static !important;
  transform: none !important;
  width: 100% !important;
  max-width: none !important;
  margin-top: 12px !important;
  padding: 10px 12px !important;
  background: #fff !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .03) !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.bb-configurator .image-container>.price-bar .price-chip {
  background: #E6E6E6;
  color: #000;
  padding: 10px 14px;
  border-radius: 8px;
  min-width: 120px;
  text-align: center;
}

.bb-configurator .image-container>.price-bar .bar-actions {
  margin-left: auto;
  padding: 0;
  display: flex;
  gap: 12px;
  background: transparent;
  border-radius: 8px;
}

.bb-configurator .image-container>.price-bar .bar-actions .btn-save,
.bb-configurator .image-container>.price-bar .bar-actions .btn-help {
  background: #111;
  border: none;
  color: #fff;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 8px;
  font-weight: 800;
}

.bb-configurator .image-container>.price-bar .bar-actions .btn-save:hover,
.bb-configurator .image-container>.price-bar .bar-actions .btn-help:hover {
  opacity: .9
}

/* ===== Desktop big ===== */
@media (min-width:1440px) {
  .bb-configurator {
    --vh-pad: 150px;
  }
}

@media (min-width:1680px) {
  .bb-configurator {
    --vh-pad: 130px;
  }
}

/* ===== UI generica ===== */
.bb-configurator .acc-toggle {
  display: none;
}

.bb-configurator .sidebar-step {
  margin: 0 0 10px;
}

.bb-configurator .sidebar-header {
  background: var(--header);
  border-radius: 4px;
  height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: #374151;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .2px;
}

.bb-configurator .acc-toggle:checked+.sidebar-header {
  background: var(--header-active);
  border-radius: 4px 4px 0 0;
  /* Remove bottom radius when active */
}

.bb-configurator .sidebar-header .next-in-header {
  background: var(--yellow);
  border-radius: 9999px;
  padding: 0 16px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #000;
}

.bb-configurator .sidebar-header .next-in-header:hover {
  background: var(--yellow-2);
  transform: translateY(-1px);
}

.bb-configurator .sidebar-step-content {
  background: #fff;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 10px 10px;
  margin-top: -2px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transition: max-height .28s ease, opacity .22s ease;
  padding: 0 12px 0;
}

.bb-configurator .acc-toggle:checked+.sidebar-header+.sidebar-step-content {
  max-height: none;
  opacity: 1;
  visibility: visible;
  padding: 10px 12px 12px;
  border-radius: 0 0 0px 0px !important;
}

/* rows/inputs */
.bb-configurator .field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #F3F4F6;
  border-radius: 10px;
  margin: 10px 0;
}

.bb-configurator .field-row label {
  font-size: 13px;
  color: #374151;
  font-weight: 700;
  white-space: nowrap;
}

.bb-configurator .field-row select,
.bb-configurator .field-row input[type="text"] {
  flex: 1;
  background: #E5E7EB;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

/* Palette Colori */
.bb-configurator .colors-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
  margin-top: 8px;
}

.bb-configurator .color-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: start;
  gap: 12px 16px;
  padding: 10px 0;
  border-bottom: 1px dashed #e5e7eb;
}

.bb-configurator .color-row>span {
  font-weight: 700;
  color: #374151;
  line-height: 32px;
}

.bb-configurator .swatches {
  display: grid;
  grid-template-columns: repeat(7, 22px);
  grid-auto-rows: 22px;
  gap: 10px;
}

.bb-configurator .bb-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
}

.bb-configurator .bb-swatch:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.bb-configurator .bb-swatch .color-preview-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: var(--c, #e5e7eb);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.bb-configurator .bb-swatch[data-value]::after {
  content: attr(data-value);
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  background: #111;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

.bb-configurator .bb-swatch:hover::after {
  opacity: 1;
}

/* LOGHI */

.bb-configurator .logos-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.bb-configurator .logos-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.bb-configurator .logos-row>span:first-child {
  font-size: 14px;
  color: #374151;
  line-height: 1.2;
  flex-shrink: 0;
  margin-top: 2px;
}

.bb-configurator .logos-row .boxes {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  align-items: start;
}

.bb-configurator .logos-row .boxes input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bb-configurator .logos-row .boxes button.bb-logo-picker-btn {
  align-self: start;
  flex-shrink: 0;
}

.bb-configurator .logos-row .boxes::-webkit-scrollbar {
  height: 6px;
}

.bb-configurator .logos-row .boxes::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}


.little_bb_product-preview {
  display: flex;
  align-items: flex-start;
  border: 1px solid #ddd;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 6px;
}

.little_bb_product-image img {
  max-width: 160px;
  margin-right: 15px;
  border-radius: 15px;
}

.little_bb_product-info {
  flex: 1;
}

.little_bb_product-title {
  margin: 0 0 5px 0;
  font-size: 13px !important;
}

.little_bb_product-title a {
  text-decoration: none;
  color: #333;
}

.little_bb_product-price {
  color: #e74c3c;
  font-weight: bold;
  margin-bottom: 5px;
}

.little_bb_product-availability {
  margin-bottom: 10px;
  font-size: 14px;
}

.little_bb_in-stock {
  color: green;
}

.little_bb_out-of-stock {
  color: red;
}

.little_bb_add-to-cart {
  display: inline-block;
  background: #007cba;
  color: #fff;
  padding: 6px 12px;
  text-decoration: none;
  border-radius: 10px;
  transition: background 0.3s;
}

.little_bb_add-to-cart:hover {
  background: #005a87;
}

.save-button-def {
  display: inline-block;
  width: 100%;
  background-color: var(--yellow) !important; /* bright yellow */
  color: #000 !important; /* black text */
  border: none !important;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.1s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Hover */
.save-button-def:hover {
  background-color: var(--yellow) !important; /* slightly darker yellow */
  color: #000 !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Active (when clicked) */
.save-button-def:active {
  background-color: var(--yellow) !important; /* deeper yellow on click */
  color: #000 !important;
  transform: scale(0.98); /* subtle press effect */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Focus (keyboard navigation) */
.save-button-def:focus {
  outline: 3px solid var(--yellow) !important; /* yellow outline */
  outline-offset: 2px;
  background-color: var(--yellow) !important;
  color: #000 !important;
}

/* Disabled */
.save-button-def:disabled {
  background-color: #f5f5f5 !important;
  color: #999 !important;
  cursor: not-allowed;
  box-shadow: none;
}



/* Step actions */
.bb-configurator .back-step-button {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}

.bb-configurator .back-step-button::before {
  content: '<';
  margin-right: 4px;
}

.bb-configurator .next-step-button {
  background: var(--yellow);
  color: #000;
  border: none;
  border-radius: 9999px;
  height: 44px;
  padding: 0 24px;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  text-transform: uppercase;
}

.bb-configurator .next-step-button:hover {
  background: var(--yellow-2);
  transform: translateY(-1px);
}

/* Header overlay & strip */
.bb-configurator .preview-head {
  position: absolute;
  top: 8px;
  right: 16px;
  display: flex;
  gap: 18px;
  font-size: 10px;
  color: #8b8b8b;
}

.bb-configurator .parts-strip {
  position: absolute;
  top: 36px;
  right: 36px;
  display: flex;
  gap: 14px;
}

.bb-configurator .parts-strip img {
  max-height: 90px;
  border-radius: 2px;
  display: block;
}

/* ===== Modali COLORE (Numero / Nome) — robusti ===== */
.bb-picked-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #374151
}

.bb-picked-label .chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #c9c9c9
}

.bb-open-color-btn {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  font-size: 12px
}

.bb-open-color-btn:hover {
  opacity: .9
}

/* Stato di default: nascosti, anche se un tema mette display:block */
.bb-color-modal-backdrop,
.bb-color-modal {
  display: none;
}

.bb-color-modal-backdrop.is-open,
.bb-color-modal.is-open {
  display: block !important;
}

.bb-color-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 99980;
}

.bb-color-modal {
  position: fixed;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  z-index: 99990;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  width: min(860px, 92vw);
  max-height: min(80vh, 1000px);
  overflow: hidden
}

.bb-color-modal header {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between
}

.bb-color-modal header strong {
  font-size: 14px
}

.bb-color-modal .bb-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  overflow: auto;
  max-height: 64vh
}

.bb-color-modal .choice {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  transition: .15s box-shadow, .15s transform;
  text-align: center
}

.bb-color-modal .choice:hover {
  box-shadow: 0 0 0 2px #409eff33;
  transform: translateY(-1px)
}

.bb-color-modal .swatch {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  border: 1px solid #d0d0d0;
  margin: 0 auto 8px;
  background: var(--c, #ddd);
  display: block
}

.bb-color-modal .label {
  display: block;
  font-size: 12px;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.bb-color-modal footer {
  padding: 10px 16px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 8px
}

.bb-color-modal .link {
  background: #FFD700;
  color: #000;
  border: none;
  border-radius: 9999px;
  height: 44px;
  padding: 0 24px;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  text-transform: uppercase;
  text-decoration: none;
}

.bb-color-modal .link:hover {
  background: #FFC700;
  transform: translateY(-1px);
}

/* ===== Modale LOGHI — stessa logica di open/close a classi ===== */
.bb-logo-modal-backdrop,
.bb-logo-modal {
  display: none;
}

.bb-logo-modal-backdrop.is-open,
.bb-logo-modal.is-open {
  display: block !important;
}

.bb-logo-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 99998;
}

.bb-logo-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  width: min(940px, 92vw);
  max-height: min(80vh, 1000px);
  overflow: hidden
}

.bb-logo-modal header {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between
}

.bb-logo-modal .bb-logo-search {
  flex: 1;
  display: flex;
  gap: 8px
}

.bb-logo-modal .bb-logo-search input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px
}

.bb-logo-modal .bb-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  overflow: auto;
  max-height: 64vh
}

.bb-logo-modal .thumb {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  cursor: pointer;
  transition: .15s box-shadow
}

.bb-logo-modal .thumb:hover {
  box-shadow: 0 0 0 2px #409eff33
}

.bb-logo-modal .thumb img {
  display: block;
  width: 100%;
  max-height: 110px;
  object-fit: contain;
  background: #fff
}

.bb-logo-modal footer {
  padding: 10px 16px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 8px
}

.bb-hidden {
  display: none !important
}

.link {
  background: #FFD700;
  color: #000;
  border: none;
  border-radius: 9999px;
  height: 44px;
  padding: 0 24px;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  text-transform: uppercase;
  text-decoration: none;
}

.link:hover {
  background: #FFC700;
  transform: translateY(-1px);
}

/* -------------------------
   Mobile tweaks
   ------------------------- */
@media (max-width:1024px) {
  .bb-configurator .main-container {
    grid-template-columns: 1fr;
    padding: 0 1px 18px;
  }

  .bb-configurator .sidebar {
    margin-top: 0 !important;
    position: static;
    top: auto;
  }

  .bb-configurator .parts-strip {
    display: none;
  }

  .bb-configurator .image-container {
    padding: 10px;
    grid-column: 1;
    width: 100%;
    max-width: none;
  }

  .bb-configurator #customizationCanvas {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    margin: 0 auto;
  }

  .bb-configurator .image-container>.price-bar {
    margin-top: 10px !important;
  }

  .bb-configurator .price-bar {
    flex-direction: row;
    align-items: center;
  }

  .bb-configurator .price-chip {
    min-width: unset;
    width: auto;
  }

  .bb-configurator .bar-actions {
    margin-left: auto;
    justify-content: flex-end;
  }

  .bb-configurator .next-step-button {
    width: 100%;
  }

  .bb-configurator .field-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .bb-configurator .field-row label {
    font-size: 12px;
  }
}

@media (max-width:640px) {
  .bb-configurator .image-container {
    grid-column: 1;
    grid-row: 1;
  }

  .bb-configurator .sidebar {
    grid-column: 1;
    grid-row: 2;
  }

  /* Centra le palette Colori su telefoni */
  .bb-configurator .colors-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    justify-items: center;
  }

  .bb-configurator .color-row {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 8px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
    text-align: center;
  }

  .bb-configurator .colors-grid .color-row:first-child {
    padding-top: 12px;
  }

  .bb-configurator .color-row>span {
    line-height: 1.25;
    margin: 0 auto;
    word-break: break-word;
  }

  .bb-configurator .swatches {
    display: grid !important;
    grid-template-columns: repeat(7, 22px);
    grid-auto-rows: 22px;
    gap: 10px;
    justify-content: center;
    margin-inline: auto;
  }

  .bb-configurator .bb-swatch {
    position: relative;
  }

  .bb-configurator .bb-swatch::before {
    content: "";
    position: absolute;
    inset: -10px;
  }

  /* target più grande */
}

/* Telefoni stretti */
@media (max-width:480px) {
  .bb-configurator .sidebar-header {
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
  }

  .bb-configurator .next-step-button {
    width: 100%;
    height: 42px;
    padding: 0 18px;
  }

  .bb-configurator .price-chip {
    min-width: unset;
  }
}


/* --- LOGHI: metti i boxes (azioni) sotto al nome --- */
#bb-loghi-container .logos-row {
  display: grid;
  grid-template-areas:
    "label"
    "actions";
  grid-template-columns: 1fr;
  row-gap: 6px;
  padding: 6px 0;
}

#bb-loghi-container .logos-row>span {
  grid-area: label;
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}

#bb-loghi-container .logos-row .boxes {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* anteprima + pulsanti più minuti (resta tutto su una riga dentro 'actions') */
#bb-loghi-container .bb-logo-picker-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 9999px;
}

#bb-loghi-container .bb-logo-picked {
  gap: 6px;
}

#bb-loghi-container .bb-logo-picked img {
  width: 48px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}

#bb-loghi-container .bb-logo-remove {
  font-size: 12px;
}

/* anche la riga “Logo cliente …” in colonna (label sopra, input sotto) */
#bb-loghi-container .field-row {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 6px;
  margin: 4px 0 12px;
}

#bb-loghi-container .field-row label {
  font-size: 12px;
  margin: 0;
}

#bb-loghi-container input[type="file"] {
  font-size: 12px;
  padding: 6px;
}

/* forza layout a una colonna anche su schermi larghi (override di regole precedenti) */
@media (min-width:900px) {
  #bb-loghi-container .logos-row {
    grid-template-columns: 1fr;
  }

  #bb-loghi-container .field-row {
    grid-template-columns: 1fr;
  }
}




/* ======= Font chooser modals ======= */
#bb-font-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 9997;
  display: none;
}

#bb-font-backdrop.is-open {
  display: block;
}

.bb-font-modal {
  position: fixed;
  inset: 6% 8% auto 8%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 45px rgba(0, 0, 0, .25);
  z-index: 9998;
  display: none;
  padding: 16px 18px;
  max-height: 88vh;
  overflow: auto;
  margin: 25% 40%;
}

.bb-font-modal.is-open {
  display: block;
}

.bb-font-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.bb-font-modal h3 {
  margin: 0;
  font: 600 18px/1.2 system-ui, sans-serif;
}

.bb-font-modal .bb-close {
  border: 0;
  background: #f3f3f3;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.bb-font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.bb-font-card {
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: #fff;
  transition: box-shadow .15s, transform .08s;
}

.bb-font-card:hover {
  box-shadow: 0 3px 12px rgba(0, 0, 0, .08);
  transform: translateY(-1px);
}

.bb-font-card img {
  width: auto;
  height: auto;
  display: block;
  border-radius: 8px;
}

.bb-font-card span {
  font: 500 12px/1.25 system-ui, sans-serif;
  color: #333;
  text-align: center;
}

.bb-font-card[aria-selected="true"] {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.bb-open-font-btn {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e5e5;
  background: #fafafa;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.bb-open-font-btn:hover {
  background: #f3f3f3;
}



/* 0) Buttons that open the modals: no border / no color */
.bb-open-font-btn {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: inherit !important;
  padding: 0 !important;
  /* looks like plain text */
  border-radius: 0 !important;
  /* kill the pill shape */
  font: 600 15px/1.3 system-ui, sans-serif;
  cursor: pointer;
}

.bb-open-font-btn:hover,
.bb-open-font-btn:active {
  background: transparent !important;
  box-shadow: none !important;
}

.bb-open-font-btn:focus {
  outline: auto;
  /* keep accessibility focus */
}

/* 1) Cards inside the modal: borderless, neutral */
.bb-font-card {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.bb-font-card:hover {
  box-shadow: none !important;
  transform: none !important;
}

.bb-font-card[aria-selected="true"] {
  outline: none !important;
  /* no selection ring color */
}

/* 2) Preview images stay clean */
.bb-font-card img {
  border: 0 !important;
  border-radius: 8px;
}


.bb-close {
  background: #FFD700 !important;
  color: #000 !important;
  border: none !important;
  border-radius: 9999px !important;
  height: 44px !important;
  padding: 0 24px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  font-size: 13px !important;
  text-transform: uppercase !important;
  text-decoration: none !important;
}



@media (max-width: 768px) {
  .bb-configurator .image-container {
    grid-column: 1 / -1;
    width: 100%;
  }
}