/* =============================================================================
   ATTREZZATURABARMAN.IT - Single Product Page Style
   -----------------------------------------------------------------------------
   Salva questo file in: [tema-child]/css/single-product.css
   Caricato automaticamente SOLO nelle pagine prodotto tramite functions.php
   (funzione abm_enqueue_product_page_styles)
   ============================================================================= */

:root {
  --abm-accent: #FFCE53;        /* Oro - colore CTA principale */
  --abm-accent-dark: #e6b93d;   /* Variante scura per hover */
  --abm-text-dark: #1a1a1a;
  --abm-text-muted: #888888;
  --abm-border-light: #ececec;
  --abm-radius: 8px;
}

/* ==========================================================================
   1. IMMAGINI PRODOTTO - angoli arrotondati + ombra morbida
   ========================================================================== */
.single-product div.product .woocommerce-product-gallery {
  position: relative; /* necessario per posizionare i badge */
}

.single-product div.product .woocommerce-product-gallery img,
ul.products li.product img {
  border-radius: var(--abm-radius) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

ul.products li.product:hover img {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12) !important;
}

/* ==========================================================================
   2. BLOCCO PREZZO + PULSANTE AGGIUNGI AL CARRELLO
   Prezzo di listino: oro barrato | Prezzo di vendita: bianco
   ========================================================================== */
body.single-product .woocommerce div.product p.price,
body.single-product div.product p.price,
body.single-product div.product span.price,
body.single-product div.product p.price bdi,
body.single-product div.product p.price span,
body.single-product div.product p.price .amount,
body.single-product div.product p.price .woocommerce-Price-amount,
body.single-product div.product p.price .woocommerce-Price-currencySymbol {
  font-size: 24px !important;
  font-weight: 600;
  color: #ffffff !important;
  margin-bottom: 4px;
}

/* Prezzo di listino (barrato) -> oro */
body.single-product div.product p.price del,
body.single-product div.product p.price del *,
body.single-product div.product p.price del bdi,
body.single-product div.product p.price del span,
body.single-product div.product p.price del .amount,
body.single-product div.product p.price del .woocommerce-Price-amount,
body.single-product div.product p.price del .woocommerce-Price-currencySymbol {
  color: var(--ast-global-color-1, #FFCE53) !important;
  text-decoration: line-through !important;
  opacity: 1;
  font-size: 26px !important;
}

/* Prezzo di vendita (attuale) -> bianco */
body.single-product div.product p.price ins,
body.single-product div.product p.price ins *,
body.single-product div.product p.price ins bdi,
body.single-product div.product p.price ins span,
body.single-product div.product p.price ins .amount,
body.single-product div.product p.price ins .woocommerce-Price-amount,
body.single-product div.product p.price ins .woocommerce-Price-currencySymbol {
  color: #ffffff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 24px !important;
}

.single-product div.product form.cart .button,
.single-product div.product .single_add_to_cart_button {
  display: block;
  width: 100%;
  background-color: var(--abm-accent) !important;
  color: #111111 !important;
  border: none !important;
  border-radius: 6px;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.single-product div.product form.cart .button:hover,
.single-product div.product .single_add_to_cart_button:hover {
  background-color: var(--abm-accent-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(201, 162, 39, 0.35);
}

.single-product div.product form.cart .button:active,
.single-product div.product .single_add_to_cart_button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(201, 162, 39, 0.3);
}

/* Su desktop il bottone non deve necessariamente essere a piena larghezza
   se preferisci un pulsante più compatto, rimuovi il blocco sotto */
@media (min-width: 769px) {
  .single-product div.product form.cart .button,
  .single-product div.product .single_add_to_cart_button {
    max-width: 380px;
  }
}

@media (max-width: 768px) {
  .single-product div.product form.cart .button,
  .single-product div.product .single_add_to_cart_button {
    padding: 15px 20px;
    font-size: 14px;
  }
}

/* ==========================================================================
   3. METADATI DISCRETI (SKU, categorie, tag) - spostati in fondo dal PHP
   ========================================================================== */
.single-product .product_meta {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--abm-border-light);
  font-size: 12px;
  color: var(--abm-text-muted);
  line-height: 1.8;
}

.single-product .product_meta > span {
  display: block;
}

/* ==========================================================================
   4. INFO SPEDIZIONE / CONSEGNA STIMATA
   ========================================================================== */
.abm-delivery-info {
  margin: 16px 0 20px 0;
  font-size: 14px;
}

.abm-free-shipping {
  color: #2e7d32;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px 0;
}

.abm-icon-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #2e7d32;
  color: #fff;
  font-size: 10px;
}

.abm-shipping-note {
  color: var(--abm-text-muted);
  margin: 0 0 4px 0;
}

.abm-delivery-estimate {
  color: #555555;
  margin: 0;
}

/* ==========================================================================
   5. BADGE DINAMICI (offerta / scorte basse / ultimo rimasto)
   ========================================================================== */
.abm-badges-wrap {
  position: static;          /* nel flusso normale, sotto i metadati prodotto */
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0 0;
}

.abm-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #ffffff;
  white-space: nowrap;
}

.abm-badge-sale {
  background-color: var(--abm-accent);
  color: #111111;
}

.abm-badge-lowstock {
  background-color: #d9822b;
}

.abm-badge-lastone {
  background-color: #c0392b;
  animation: abmPulse 1.8s infinite;
}

@keyframes abmPulse {
  0%   { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

/* ==========================================================================
   9. VARIANTI / SWATCHES (plugin Variation Swatches - cfvsw)

   ATTENZIONE: esistono DUE tipi di swatch:
   - LABEL (testo, es. "30/45ml")  -> riquadro nero, bordo/testo bianco
   - COLORE (nessun testo, il colore E' lo swatch) -> sfondo lasciato al plugin
   In entrambi i casi, quando selezionato -> bordo oro.
   ========================================================================== */
.cfvsw-swatches-container {
  display: flex !important;
  flex-wrap: wrap;
  gap: 10px !important;
  margin: 6px 0 12px 0;
}

/* --- Regole COMUNI a tutti gli swatch (niente background qui!) --- */
.cfvsw-swatches-option {
  border: 1px solid #ffffff !important;
  border-radius: 8px !important;
  cursor: pointer;
  box-shadow: none !important;
  outline: none !important;
  transition: border-color 0.3s ease, color 0.3s ease !important;
}

/* --- Swatch TESTUALI (es. 30/45ml): riquadro nero adattato al testo --- */
.cfvsw-swatches-option.cfvsw-label-option {
  background-color: #0d0d0d !important;
  background: #0d0d0d !important;
  color: #ffffff !important;
  padding: 10px 18px !important;
  min-width: auto !important;   /* si adatta al testo contenuto */
  min-height: auto !important;
  width: auto !important;
  height: auto !important;
  text-align: center;
  font-size: 14px !important;
  font-weight: 500;
  line-height: 1.4 !important;
  white-space: nowrap;
}

.cfvsw-swatches-option.cfvsw-label-option * {
  color: inherit !important;
  background: transparent !important;
}

/* --- Swatch COLORE: NON tocchiamo lo sfondo (è il colore del prodotto),
       diamo solo forma e dimensione leggibili --- */
.cfvsw-swatches-option:not(.cfvsw-label-option) {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  border-radius: 8px !important;
}

/* --- Hover (entrambi i tipi) --- */
.cfvsw-swatches-option:hover {
  border-color: var(--abm-accent) !important;
}

.cfvsw-swatches-option.cfvsw-label-option:hover {
  color: var(--abm-accent) !important;
}

/* --- SELEZIONATO -> bordo oro (spesso, ben visibile anche sui colori) --- */
.cfvsw-swatches-option.cfvsw-selected-swatch,
.cfvsw-swatches-option[aria-checked="true"] {
  border: 2px solid var(--abm-accent) !important;
  box-shadow: none !important;
}

/* Solo lo swatch TESTUALE selezionato cambia anche il colore del testo */
.cfvsw-swatches-option.cfvsw-label-option.cfvsw-selected-swatch {
  background-color: #0d0d0d !important;
  color: var(--abm-accent) !important;
}

/* --- Variante non disponibile --- */
.cfvsw-swatches-option.cfvsw-out-of-stock,
.cfvsw-swatches-option.cfvsw-disabled {
  opacity: 0.35 !important;
  cursor: not-allowed;
}

/* Link "Svuota" / reset varianti -> NASCOSTO (non necessario) */
.reset_variations,
a.reset_variations {
  display: none !important;
}

/* ==========================================================================
   10. RISPETTO ACCESSIBILITÀ - riduzione animazioni
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .cfvsw-swatches-option {
    transition: none !important;
  }
}

/* ==========================================================================
   11. CATEGORIA NEI METADATI - oro fisso, nessun cambio al hover
   ========================================================================== */
.abm-product-meta .posted_in,
.abm-product-meta .posted_in a,
.abm-product-meta .posted_in a:hover,
.abm-product-meta .posted_in a:focus,
.abm-product-meta .posted_in a:visited,
.product_meta .posted_in a,
.product_meta .posted_in a:hover {
  color: var(--abm-accent) !important;
  text-decoration: none !important;
}

.abm-product-meta,
.abm-product-meta .sku_wrapper,
.abm-product-meta .sku {
  color: rgba(255, 255, 255, 0.75) !important;
}

/* ==========================================================================
   12. FRECCE NAVIGAZIONE PRODOTTO (precedente / successivo)
   Sfondo nero, testo oro, riquadro arrotondato con bordo oro
   ========================================================================== */
/* Il riquadro va SOLO sul link esterno */
.ast-product-navigation-wrapper .product-links a,
.ast-product-navigation-wrapper > .product-links > a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background-color: #0d0d0d !important;
  background: #0d0d0d !important;
  color: var(--abm-accent) !important;
  border: 1px solid var(--abm-accent) !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  transition: all 0.3s ease !important;
}

/* Gli elementi INTERNI non devono avere bordo o sfondo propri
   (altrimenti si crea un doppio riquadro) */
.ast-product-navigation-wrapper .ast-product-icon-previous,
.ast-product-navigation-wrapper .ast-product-icon-next,
.ast-product-navigation-wrapper .ast-icon,
.ast-product-navigation-wrapper .icon-arrow,
.ast-product-navigation-wrapper a i,
.ast-product-navigation-wrapper a span {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  color: inherit !important;
}

.ast-product-navigation-wrapper a svg,
.ast-product-navigation-wrapper a svg path,
.product-links a svg,
.product-links a svg path {
  fill: var(--abm-accent) !important;
  color: var(--abm-accent) !important;
}

.ast-product-navigation-wrapper a:hover,
.product-links a:hover {
  background-color: var(--abm-accent) !important;
  color: #111111 !important;
}

.ast-product-navigation-wrapper a:hover svg,
.ast-product-navigation-wrapper a:hover svg path,
.product-links a:hover svg path {
  fill: #111111 !important;
}

/* ==========================================================================
   13. ICONA CARRELLO FLOTTANTE - sfondo oro
   ========================================================================== */
.moderncart-floating-cart-button,
button.moderncart-floating-cart-button {
  background-color: var(--abm-accent) !important;
  background: var(--abm-accent) !important;
  color: #111111 !important;
}

.moderncart-floating-cart-button svg,
.moderncart-floating-cart-button svg path,
.moderncart-floating-cart-button i {
  fill: #111111 !important;
  color: #111111 !important;
}

/* ==========================================================================
 * PRODOTTI CORRELATI / UP-SELL / CROSS-SELL: stesse card del catalogo
 * --------------------------------------------------------------------------
 * Su scheda prodotto catalog-ui.css NON e' caricato: i correlati avevano
 * immagini distorte (object-fit:fill) e griglia Astra non responsive. Qui
 * replichiamo il trattamento catalogo: riquadro immagine fisso 1:1 con
 * letterbox bianco, e griglia responsive con DUE colonne su mobile (come
 * nelle altre categorie).
 * ========================================================================== */
.related.products ul.products,
.up-sells.products ul.products,
.cross-sells ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin: 0;
}

.related.products ul.products li.product,
.up-sells.products ul.products li.product,
.cross-sells ul.products li.product {
  width: auto !important;
  float: none !important;
  margin: 0 !important;
}

/* Immagine: riquadro fisso 1:1, prodotto intero su fondo bianco (letterbox) */
.related.products ul.products li.product img,
.up-sells.products ul.products li.product img,
.cross-sells ul.products li.product img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  background-color: #ffffff;
  padding: 8px;
  box-sizing: border-box;
  border-radius: 12px !important;
}

@media (max-width: 1024px) {
  .related.products ul.products,
  .up-sells.products ul.products,
  .cross-sells ul.products { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}

@media (max-width: 767px) {
  .related.products ul.products,
  .up-sells.products ul.products,
  .cross-sells ul.products { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
