/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~      SERVICE LIST V11.0 (ULTIMATE PRO TABLE REFINED)        ~
~      Hybrid table/accordion with progressive disclosure     ~
~      Based on the Ultimate Pro design but with explicit     ~
~      chevron placement and price column separation.         ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/* --- Container Principale --- */
/*
 * Primary container: encases all service rows. Large border radius on desktop, full
 * width on mobile. Uses a soft shadow and light border to separate from
 * surrounding content.
 */
.product-variations-accordion {
  /* Rimosso margin verticale: la spaziatura esterna viene gestita globalmente in product.css */
  background: #ffffff;
  /* Uniforma il border-radius e la shadow con gli altri blocchi */
  border-radius: var(--bspc-radius-large, 18px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
  isolation: isolate;
}

/* --- Singola Card (Item) --- */
/*
 * Each service row acts as a clickable accordion header. Highlight slightly
 * on tap and remove bottom border from the last item. A subtle color change
 * on active provides tactile feedback on touch devices.
 */
.product-variations-accordion__item {
  position: relative;
  border-bottom: 1px solid #f2f2f7;
  transition: background-color 0.2s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.product-variations-accordion__item:last-child {
  border-bottom: none;
}
.product-variations-accordion__item:active {
  background-color: #f9f9f9;
}

/* --- ROW: Icona | Titolo | Prezzo | Chevron --- */
/*
 * Header layout: icon, text block, price, chevron. The price and
 * chevron occupy their own columns to provide a clear separation and
 * ensure adequate space for long titles on desktop. On mobile this will
 * collapse to a more compact arrangement.
 */
.variation-header {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  /* Center items vertically so icons and text align nicely */
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  width: 100%;
  box-sizing: border-box;
}

.variation-header:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 14px;
}

/* 1. Icona */
/*
 * Icon container: neutral background with rounded corners and a fixed size.
 */
.variation-icon-box {
  width: 48px;
  height: 48px;
  background: #f5f5f7;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1d1d1f;
  flex-shrink: 0;
}
.variation-icon-box img,
.variation-icon-box svg {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

/* 2. Titolo */
/*
 * Title styles: prominent weight and slightly larger size. The overflow
 * is hidden to prevent line breaks on long titles; this is particularly
 * important on desktop where the price sits alongside.
 */
/*
 * Title styles: allow wrapping on long labels to prevent overflow
 * on desktop while still keeping the row compact. Instead of forcing
 * a single line with `white-space: nowrap`, we allow the title to
 * wrap naturally and break long words. We still preserve the strong
 * weight and sizing defined previously.
 */
.variation-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1d1d1f;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Allow multiple lines and break long words */
  /* Allow the title to wrap naturally without breaking words in unnatural places */
  white-space: normal;
  /* Break long words only when necessary to prevent overflow */
  overflow-wrap: break-word;
  /* Avoid breaking words at arbitrary points */
  word-break: normal;
}

/*
 * Price row for mobile. Hidden on larger screens and displayed only
 * on small viewports. It positions the price (or “Su Richiesta” badge)
 * alongside a chevron in a single row beneath the title and snippet.
 */
.variation-price-mobile {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

/* 3. Prezzo (Bold) */
/*
 * Price container: large bold type. An inner <del> can be included for
 * crossed-out pricing. White-space is preserved to avoid wrapping.
 */
.variation-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1d1d1f;
  white-space: nowrap;
  letter-spacing: -0.03em;
}
.variation-price del {
  display: block;
  font-size: 0.6em;
  color: #999;
  font-weight: 500;
  text-align: right;
}

/* Badge Su Richiesta */
/*
 * Badge used when the price is not available. Keeps the design cohesive
 * by using neutral colours and uppercase lettering.
 */
.price-badge-request {
  display: inline-block;
  background: #f2f2f7;
  color: #86868b;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

/* 4. Chevron */
/*
 * Chevron control: indicates the expand/collapse state. Rotates when open and
 * changes colour to highlight activation. Sized smaller than the price to
 * maintain a balanced look.
 */
/*
 * Chevron control: indicate lo stato di espansione/collasso.
 * Aumentiamo le dimensioni per migliorarne la visibilità sia su desktop
 * che su mobile. Il colore di default rimane un grigio neutro e cambia
 * quando la voce è aperta (vedi regola più sotto).
 */
.variation-chevron {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b1b1b8;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), color 0.3s;
}
.variation-chevron svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.5px;
}

/* Rotazione quando aperto */
/* When expanded rotate and recolor the chevron */
.product-variations-accordion__item.is-open .variation-chevron {
  transform: rotate(180deg);
  color: #0071e3;
}

/* --- CONTENUTO ESPANSO --- */
/*
 * Expanded content area: collapses by default via zero-height grid row. When
 * the parent item has the `is-open` class the row expands to show full
 * description and actions. The content uses flexbox to stack the
 * description and action buttons nicely.
 */
.product-variations-accordion__content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: #fff;
  content-visibility: auto;
}
.product-variations-accordion__item.is-open .product-variations-accordion__content {
  grid-template-rows: 1fr;
}
.variation-content-inner {
  overflow: hidden;
}
.variation-actions-wrapper {
  padding: 0 24px 24px 88px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.variation-full-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #1d1d1f;
  /* hidden by default; revealed when item is open */
  display: none;
  margin-bottom: 12px;
}

/* Show full description when the item is open */
.product-variations-accordion__item.is-open .variation-full-text {
  display: block;
  animation: bpcAccordionFadeIn 0.4s ease;
}

/* Hide snippet when item is open */
.product-variations-accordion__item.is-open .variation-snippet-wrapper {
  display: none;
}

/* [Theme Architect] Prefisso keyframes per evitare collisioni tra CSS caricati su pagine diverse. */
@keyframes bpcAccordionFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bpc-action-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.bpc-btn-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  min-width: 140px;
}
.bpc-btn-action:active {
  transform: scale(0.97);
}
.bpc-btn-action.primary {
  background: #0071e3;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.3);
}
.bpc-btn-action.primary:hover {
  background: #0077ed;
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.4);
}
.bpc-btn-action.secondary {
  background: #1d1d1f;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.bpc-btn-action.whatsapp {
  background: #25d366;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.25);
}
.btn-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/*
 * Middle column containing the title, snippet and (on mobile) the price. Uses
 * a vertical flex layout so that the snippet wraps below the title. The
 * `min-width: 0` ensures long text truncates gracefully.
 */
.variation-center-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* Wrapper for the description preview when collapsed. It limits the height
 * to approximately two lines and overlays a fade-out gradient to hint that
 * more content is available on expand.
 */
.variation-snippet-wrapper {
  position: relative;
  max-height: 3.2em;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.variation-snippet {
  font-size: 0.9rem;
  color: #86868b;
  line-height: 1.5;
  margin: 0;
}
.product-variations-accordion__item:not(.is-open) .variation-snippet-wrapper::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 24px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
  pointer-events: none;
}

/* Right-hand column for price and chevron: stacked on desktop so price sits
 * above the chevron; aligns items to the end for a tidy look.
 */
.variation-right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  height: 100%;
  gap: 4px;
}

/* Responsività mobile */
@media (max-width: 768px) {
  .product-variations-accordion {
    /* La larghezza e i margini laterali sono gestiti da product.css.
       Manteniamo solo bordi, ombra e overflow per evitare conflitti. */
    border-radius: var(--bspc-radius-large, 18px);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.05);
    overflow: hidden;
  }
  .variation-header {
    padding: 16px 20px;
    gap: 14px;
    /* Reduce to three columns on mobile: icon, text and chevron. The price will be displayed
     * in the `.variation-price-mobile` row within the text column. */
    grid-template-columns: auto 1fr auto;
  }
  .variation-icon-box {
    width: 44px;
    height: 44px;
  }
  .variation-title {
    font-size: 1.05rem;
  }
  /* On mobile, show a truncated snippet instead of hiding it completely */
  .variation-snippet-wrapper {
    max-height: 2.4em;
    overflow: hidden;
    display: block;
  }
  .variation-price {
    font-size: 1.15rem;
    text-align: right;
    margin-top: 2px;
  }
  /* Display the mobile price row and hide the desktop price column */
  .variation-price-mobile {
    display: flex;
  }
  .variation-right-col {
    display: none;
  }
  .variation-actions-wrapper {
    padding: 0 20px 24px 20px;
  }
  .bpc-action-grid {
    flex-direction: column;
  }
  .bpc-btn-action {
    width: 100%;
    padding: 16px;
  }

  /*
   * Mobile chevron (all'interno del badge prezzo su schermi piccoli).
   * Ingrandiamo l'icona per renderla coerente con il nuovo formato della
   * freccia desktop e migliorare l'usabilità su dispositivi touch.
   */
  .mobile-chevron svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5px;
  }
}
