/*
 * 20BLACK — FINAL OVERRIDES
 * Questo file viene caricato per ultimo e definisce le regole definitive.
 * Risolve tutti i conflitti di specificity e duplicazioni nel CSS precedente.
 */

/* ================================================================
   PRODUCT CARD — REGOLE DEFINITIVE, UNICA FONTE DI VERITA'
   ================================================================ */

/* Base card */
.product-card {
  position: relative;
  background: #0f0f0f;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  outline: 1px solid rgba(255,255,255,0.04);
  transition: outline-color 0.3s;
}
.product-card:hover { outline-color: rgba(200,169,110,0.25); }

/* Media container — aspect ratio FISSO */
.product-card .product-card-media,
.product-card-media {
  position: relative !important;
  aspect-ratio: 3/4 !important;   /* costumi da bagno: verticale */
  overflow: hidden !important;
  background: #111 !important;
  flex-shrink: 0 !important;
  width: 100% !important;
  /* NO height auto/100% — è l'aspect-ratio che controlla l'altezza */
}

/* Immagine — riempie il media container */
.product-card .product-card-img,
.product-card-img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center top !important;
  transition: transform 0.8s ease, filter 0.5s ease !important;
}

.product-card:hover .product-card-img {
  transform: scale(1.05) !important;
  filter: brightness(0.75) !important;
}

/* Immagine hover */
.product-card .product-card-img-hover,
.product-card-img-hover {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  opacity: 0 !important;
  transition: opacity 0.5s ease !important;
}
.product-card:hover .product-card-img-hover { opacity: 1 !important; }

/* Placeholder quando non c'è immagine */
.product-card-img-placeholder {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: rgba(200,169,110,0.15) !important;
}

/* Overlay gradiente */
.product-card-media::after {
  content: '' !important;
  position: absolute !important;
  inset: 0 !important;
  background: linear-gradient(to bottom, transparent 45%, rgba(10,10,10,0.75) 100%) !important;
  opacity: 0 !important;
  transition: opacity 0.4s !important;
  z-index: 1 !important;
  pointer-events: none !important;
}
.product-card:hover .product-card-media::after { opacity: 1 !important; }

/* Info area */
.product-card .product-card-info,
.product-card-info {
  padding: 0.85rem 1rem 1rem !important;
  background: #0a0a0a !important;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.3rem !important;
  border-left: 2px solid transparent !important;
  transition: border-color 0.3s !important;
}
.product-card:hover .product-card-info {
  border-left-color: var(--color-accent, #c8a96e) !important;
}

.product-card-category {
  font-family: var(--font-mono, 'DM Mono', monospace) !important;
  font-size: 0.58rem !important;
  letter-spacing: 0.2em !important;
  text-transform: uppercase !important;
  color: rgba(200,169,110,0.6) !important;
}

.product-card-name {
  font-family: var(--font-display, 'Cormorant Garamond', serif) !important;
  font-size: 1rem !important;
  font-weight: 400 !important;
  line-height: 1.25 !important;
  color: rgba(248,246,242,0.92) !important;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
}

.product-card-price {
  font-family: var(--font-body, 'Jost', sans-serif) !important;
  font-size: 0.88rem !important;
  color: rgba(248,246,242,0.8) !important;
  margin-top: auto !important;
}

/* Actions bar */
.product-card-actions {
  display: flex !important;
  gap: 0.5rem !important;
  padding: 0 1rem 0.85rem !important;
  background: #0a0a0a !important;
}

/* Add to cart button */
.product-card-actions .btn-add-cart {
  flex: 1 !important;
  background: var(--color-accent, #c8a96e) !important;
  color: #0a0a0a !important;
  border: none !important;
  padding: 0.6rem 0.75rem !important;
  font-family: var(--font-mono, 'DM Mono', monospace) !important;
  font-size: 0.62rem !important;
  letter-spacing: 0.15em !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
}
.product-card-actions .btn-add-cart:hover { background: #d4b87a !important; }
.product-card-actions .btn-add-cart.is-added { background: #2a9d8f !important; color: #fff !important; }

/* View link */
.product-card-view {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 38px !important;
  flex-shrink: 0 !important;
  background: rgba(255,255,255,0.06) !important;
  color: rgba(248,246,242,0.7) !important;
  text-decoration: none !important;
  transition: background 0.2s !important;
  border: none !important;
}
.product-card-view:hover { background: rgba(200,169,110,0.15) !important; }

/* Wishlist btn */
.product-card .wishlist-btn {
  position: absolute !important;
  top: 0.65rem !important;
  right: 0.65rem !important;
  z-index: 4 !important;
  background: rgba(10,10,10,0.6) !important;
  border: none !important;
  padding: 0.35rem !important;
  border-radius: 50% !important;
  color: rgba(255,255,255,0.5) !important;
  cursor: pointer !important;
  transition: color 0.2s, background 0.2s !important;
  backdrop-filter: blur(4px) !important;
}
.product-card .wishlist-btn:hover,
.product-card .wishlist-btn.is-active { color: var(--color-accent, #c8a96e) !important; background: rgba(10,10,10,0.85) !important; }

/* ================================================================
   PRODUCT GRIDS — layout definitivo per ogni contesto
   ================================================================ */

/* --- Homepage: .tb-products-scroll --- */
.tb-products-scroll {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 2px !important;
  overflow: visible !important;
}

/* --- WC Shop loop: ul.products --- */
.woocommerce ul.products,
.woocommerce-page ul.products {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 2px !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 0 2rem !important;
}

/* Il <li> è trasparente */
.woocommerce ul.products li.product {
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  width: auto !important;
  display: block !important;
  background: transparent !important;
}

/* --- Tablet 769–1024px: 2 colonne --- */
@media (max-width: 1024px) {
  .tb-products-scroll,
  .woocommerce ul.products,
  .woocommerce-page ul.products {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* --- Mobile ≤768px: 2 colonne fisse (NO carosello su shop) --- */
@media (max-width: 768px) {
  .tb-products-scroll,
  .woocommerce ul.products,
  .woocommerce-page ul.products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2px !important;
    overflow: visible !important;
    display: grid !important;
  }
  .product-card .product-card-name { font-size: 0.85rem !important; }
  .product-card .product-card-info { padding: 0.65rem 0.75rem 0.75rem !important; }
  .product-card-actions .btn-add-cart { font-size: 0.58rem !important; padding: 0.5rem !important; }
}

/* ================================================================
   SHOP LAYOUT CON SIDEBAR FILTRI
   ================================================================ */

.tb-shop-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  align-items: start;
}

/* Sidebar filtri */
.tb-filters-sidebar {
  position: sticky;
  top: calc(var(--stack-h, 72px) + 1rem);
  background: #111;
  border: 1px solid rgba(255,255,255,0.06);
}

.tb-filter-group {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.tb-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(248,246,242,0.55);
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: color 0.2s;
}
.tb-filter-title:hover { color: rgba(248,246,242,0.9); }

.tb-filter-title .tb-filter-arrow {
  font-size: 0.7rem;
  transition: transform 0.25s;
}
.tb-filter-group.is-open .tb-filter-arrow { transform: rotate(180deg); }

.tb-filter-body {
  padding: 0.25rem 1.1rem 1rem;
  display: none;
}
.tb-filter-group.is-open .tb-filter-body { display: block; }

/* Checkbox filtri */
.tb-filter-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  cursor: pointer;
  font-size: 0.82rem;
  color: rgba(248,246,242,0.55);
  transition: color 0.2s;
}
.tb-filter-option:hover { color: rgba(248,246,242,0.9); }
.tb-filter-option input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--color-accent, #c8a96e);
  cursor: pointer;
  flex-shrink: 0;
}

/* Swatch colori */
.tb-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0;
}
.tb-color-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}
.tb-color-swatch:hover { transform: scale(1.15); }
.tb-color-swatch.active {
  border-color: var(--color-accent, #c8a96e);
  box-shadow: 0 0 0 2px rgba(200,169,110,0.3);
}

/* Range prezzo */
.tb-price-range { padding: 0.5rem 0; }
.tb-price-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.tb-price-inputs input[type="number"] {
  width: 72px;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(248,246,242,0.8);
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-mono, 'DM Mono', monospace);
  -moz-appearance: textfield;
}
.tb-price-inputs input::-webkit-outer-spin-button,
.tb-price-inputs input::-webkit-inner-spin-button { -webkit-appearance: none; }
.tb-price-inputs span { color: rgba(248,246,242,0.3); font-size: 0.78rem; }

.tb-price-slider { padding: 0.25rem 0; }
.tb-price-slider input[type="range"] {
  width: 100%;
  accent-color: var(--color-accent, #c8a96e);
  cursor: pointer;
}

.tb-filter-apply {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.75rem;
  background: var(--color-accent, #c8a96e);
  color: #0a0a0a;
  border: none;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
}
.tb-filter-apply:hover { background: #d4b87a; }

/* Reset filtri link */
.tb-filters-reset {
  display: block;
  text-align: center;
  padding: 0.75rem;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(248,246,242,0.25);
  text-decoration: none;
  border-top: 1px solid rgba(255,255,255,0.04);
  transition: color 0.2s;
}
.tb-filters-reset:hover { color: var(--color-accent, #c8a96e); }

/* Mobile: sidebar collapsable */
@media (max-width: 1024px) {
  .tb-shop-layout { grid-template-columns: 1fr; }
  .tb-filters-sidebar { position: static; }
  .tb-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .tb-filters-sidebar:not(.is-open) .tb-filter-group { display: none; }
  .tb-filters-sidebar:not(.is-open) .tb-filters-reset { display: none; }
}

/* ================================================================
   HEADER LOGO — regole definitive
   ================================================================ */

.site-header { z-index: 900 !important; }
.site-logo { display: flex; align-items: center; }

/* Su sfondo scuro (header trasparente o blur) → logo bianco */
.site-header .site-logo-img--light {
  display: block !important;
  height: 42px !important;
  width: auto !important;
  opacity: 1 !important;
  position: static !important;
}
.site-header .site-logo-img--dark {
  display: none !important;
  height: 0 !important;
  width: 0 !important;
}

/* Se header ha sfondo bianco (stile 'white' dal customizer) → logo nero */
body.header-style-white .site-header.is-solid .site-logo-img--light {
  display: none !important;
}
body.header-style-white .site-header.is-solid .site-logo-img--dark {
  display: block !important;
  height: 42px !important;
  width: auto !important;
  opacity: 1 !important;
}

@media (max-width: 768px) {
  .site-header .site-logo-img--light { height: 34px !important; }
}

/* ================================================================
   SEZIONE SHOP HERO — altezza controllata
   ================================================================ */
.tb-shop-hero {
  position: relative;
  height: clamp(180px, 28vh, 320px) !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: flex-end !important;
  background: #111 !important;
}
.tb-shop-hero img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* ================================================================
   SPACING FIX — sezioni homepage senza padding eccessivo
   ================================================================ */

/* Le sezioni con sfondo nero contiguo non devono avere padding eccessivo */
.tb-shop-preview { padding: 3rem 0 4rem !important; }

#featured,
.featured-product { padding: 0 !important; }

/* Elimina gap tra sezioni dello stesso colore (nero su nero) */
.section-dark + .section-dark,
.section-dark + #featured,
#featured + .section-dark,
.tb-shop-preview + .section-dark {
  margin-top: 0 !important;
}

/* Riduci padding generico della .section a valori ragionevoli */
.section {
  padding: 4rem 0 !important;
}

/* Sezioni specifiche con padding custom */
.hero-slideshow + * { margin-top: 0; }
.marquee-section { padding: 0 !important; }

/* Prodotto in evidenza: padding verticale controllato */
#featured .featured-product {
  padding: 4rem 0 !important;
}

/* ================================================================
   FIX DEFINITIVO — spazio nero tra header sezione e prodotti
   ================================================================ */

/* Sezione nuovi arrivi: padding compatto */
#shop-preview,
.tb-shop-preview {
  padding: 2.5rem 0 0 !important;
  background: #0a0a0a !important;
}

/* Header della sezione: niente margin doppio */
.tb-shop-header {
  padding: 0 var(--container-pad, 2rem) !important;
  margin-bottom: 1.5rem !important;
}

/* Titolo più compatto nella sezione prodotti */
.tb-shop-preview .section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem) !important;
  margin: 0.25rem 0 0 !important;
  line-height: 1.15 !important;
}

/* .reveal non deve aggiungere spazio verticale extra */
.tb-shop-header .reveal {
  opacity: 1 !important;
  transform: none !important;
  /* Override dell'animazione che teneva il div spostato */
}

/* Griglia prodotti: zero margine top */
.tb-products-scroll {
  margin-top: 0 !important;
}

/* Container dentro la sezione: niente padding top */
.tb-shop-preview .container,
.tb-shop-preview > .container {
  padding-top: 0 !important;
}

/* Sezione featured: immediatamente dopo i prodotti, zero gap */
#featured,
.featured-product-wrap {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

#featured .featured-product {
  padding: 3rem 0 !important;
}

/* Elimina spazio tra sezioni dello stesso colore */
.section-dark + .section-dark { margin-top: 0 !important; padding-top: 2rem !important; }
.section-dark + #featured     { margin-top: 0 !important; }
#featured + .section-dark     { margin-top: 0 !important; }

/* .section padding ridotto globalmente */
.section {
  padding: 3.5rem 0 !important;
}
