/*
 * Variation Selector block — styles.
 *
 * Ported from Bionnovation (sc-archive-variations.css). Class names are kept
 * identical so knowledge and overrides transfer 1:1. Adjust colors and tokens
 * to the new theme's theme.json presets as needed — Bionnovation-specific
 * presets used below: --wp--preset--color--gold-10, --gold-30, --black-40,
 * --red, --blue, and --container-border-radius / --inline-spacer.
 *
 * BLOCK-THEME CHANGE
 * ──────────────────
 * The block itself only renders .sc-av-wrap. The card container / media /
 * title classes below are NOT output by the block anymore — apply them as
 * "Additional CSS class(es)" on core blocks inside the Product Template to
 * recreate the Bionnovation card:
 *
 *   Product Template (each item)        → li gets its own styles from theme
 *     Group (or Columns)                → add class: sc-av-card
 *       Product Image                   → add class: sc-av-card-media
 *       Group (Stack)                   → add class: sc-av-card-body
 *         Product Title                 → add class: sc-av-card-title
 *         Variation Selector (block)    → outputs .sc-av-wrap itself
 *
 * CLASS REFERENCE
 * ───────────────
 * .sc-av-card                 Outer card container: grid (media | body).
 * .sc-av-card--single         Modifier: single product page variant.
 * .sc-av-card-media           Product image column.
 * .sc-av-card-body            Body column — title + variation selector.
 * .sc-av-card-title           Product title.
 * .sc-av-card-desc            Short product description.
 *
 * .sc-av-wrap                 Block output wrapper.
 * .sc-av-wrap--variable       Modifier: variable product (has dropdowns).
 * .sc-av-wrap--simple         Modifier: simple product (no dropdowns).
 * .sc-av-wrap--unavailable    Modifier: not purchasable / out of stock.
 * .sc-av-wrap--fallback       Modifier: variable w/o attributes ("View product" link).
 *
 * .sc-av-selects              Container for attribute rows (variable only).
 * .sc-av-attribute            Single attribute row.
 * .sc-av-select               Attribute <select>.
 *
 * .sc-av-actions              Flex row: qty | meta | button.
 * .sc-av-qty                  Qty wrapper: minus / input / plus.
 * .sc-av-qty-btn              Shared class on − and + buttons.
 * .sc-av-qty-minus            Decrease qty button.
 * .sc-av-qty-plus             Increase qty button.
 * .sc-av-qty-input            Qty number input.
 *
 * .sc-av-meta                 Stacked column inside actions row.
 * .sc-av-sku-wrap             SKU wrapper (sits above the price).
 * .sc-av-sku                  Live SKU value (aria-live).
 * .sc-av-price                Price HTML span (below SKU).
 *
 * .sc-av-btn                  Add-to-cart / status button (or fallback link).
 * .sc-av-message              Status message area (aria-live).
 * .sc-av-message--success     Modifier: confirmation.
 * .sc-av-message--error       Modifier: error.
 * .sc-av-message--warning     Modifier: out-of-stock notice.
 */

/* ── Card (apply classes to core blocks — see header note) ───────────────── */

.product-grid-wrapper .product {
  display: grid;
  background: #fff;
  border-radius: var(--container-radius);
  box-shadow: var(--component-box-shadow);
  padding: ;
  box-sizing: border-box;
  height: 100%;
  overflow: hidden;
}

.product-grid-wrapper .product h2 {
  margin: 0 !important;
}

.product-grid-wrapper .product h2 a {
  font-size: .7rem !important;
  background: var(--blue) !important;
  margin: 0 !important;
  padding: .25rem .75rem !important;
  line-height: 1.1;
  font-weight: 400 !important;
  color: #fff;
  display: grid;
  align-items: center;
  height: 2.5rem;
  grid-template-columns: 1fr auto;
}

.product-grid-wrapper .product h2 a::after {
  content: 'Details';
  border-radius: 1rem;
  height: 1.5rem;
  padding: .5rem .75rem;
  color: black;
  font-size: .5rem;
  background: #fff;
}

.product-grid-wrapper .wc-block-components-product-image img {
  width: 100% !important;
  max-width: 12rem;
  margin-block: auto;
  margin-top: .5rem;
  margin-bottom: -1.5rem;
  height: 4rem !important;
}

.sc-av-wrap {
  margin: auto .75rem .75rem .75rem;
}


/* ── Selects ─────────────────────────────────────────────────────────────── */

.sc-av-select {
  margin-bottom: 1rem;
  -moz-appearance: none;
  -webkit-appearance: none;
  color: black;
  border: 1px solid #000;
  display: block;
  overflow: hidden;
  border-radius: .125rem;
  padding: .25rem 2rem .25rem .75rem;
  text-overflow: ellipsis;
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.5rem;
  height: 2rem;
  box-shadow: var(--component-box-shadow);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13.41 8.12'%3E%3Cpolyline points='.71 .71 6.71 6.71 12.71 .71' style='fill:none;stroke:%230050c8;stroke-miterlimit:10;stroke-width:2px;'/%3E%3C/svg%3E");
  background-position: calc(100% - .5rem) center;
  background-repeat: no-repeat;
  background-size: .85rem;
  cursor: pointer;
  z-index: 2;
  position: relative;
}

.sc-av-select option:disabled {
  opacity: 0.4;
}

/* ── Actions row ─────────────────────────────────────────────────────────── */
/*
 * Flex row with three sections:
 *   [qty controls]  [meta: sku above / price below]  [add-to-cart button]
 */

.sc-av-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Qty controls ────────────────────────────────────────────────────────── */
/* Layout and appearance are provided by WooCommerce Blocks via the
 * wc-block-components-quantity-selector classes applied to the wrapper,
 * buttons, and input. Override here only if needed. */

.sc-av-qty-btn {
  cursor: pointer;
  user-select: none;
}

.sc-av-wrap .wc-block-components-quantity-selector {
  height: 2rem;
  width: 92px;
  background: #ffffff;
  box-shadow: var(--component-box-shadow);
  border-color: var(--wp--preset--color--black-40);
}

.sc-av-qty-input.wc-block-components-quantity-selector__input {
  min-width: 30px !important;
}

.sc-av-qty-btn.wc-block-components-quantity-selector__button {
  min-width: 30px !important;
}

/* ── Meta column (SKU above, price below) ────────────────────────────────── */

.sc-av-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: end;
  flex: 1;           /* grows to fill space between qty and button */
  min-width: 0;      /* allows text to truncate if needed */
}

.sc-av-sku-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 0.6rem;
  opacity: 0.7;
  line-height: 1;
  color: #666666;
}

/* Hide SKU row when SKU value is empty. */
.sc-av-sku-wrap:has(.sc-av-sku:empty) {
  display: none;
}

.sc-av-price {
  display: block;
  line-height: 1;
  font-size: .9rem;
  font-weight: 600;
}

/* ── Add-to-cart button (also styles the fallback link) ──────────────────── */

.sc-av-btn {
  cursor: pointer;
  flex-shrink: 0;
  display: inline-block;
  height: 2rem;
  padding: .5rem .75rem;
  line-height: 1rem;
  background: linear-gradient(45deg, rgba(0,80,200,1) 10%, rgba(0,155,250,1) 90%);
  border-radius: 2rem;
  box-shadow: var(--component-box-shadow);
  border: none;
  color: #fff;
  font-size: .65rem;
  text-decoration: none;
  text-align: center;
}

.sc-av-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ── Message area ────────────────────────────────────────────────────────── */

.sc-av-message {
  opacity: 0;
  line-height: 1rem;
  height: 2rem;
  border-top-right-radius: .25rem;
  border-top-left-radius: .25rem;
  padding: .25rem .5rem .5rem .5rem;
  margin-bottom: -.5rem;
  transition: all .5s linear;
  font-size: 0.75rem;
  background-color: transparent;
  color: #fff;
  position: relative;
  z-index: 1;
}

.sc-av-wrap--simple .sc-av-message {
  padding: .25rem .5rem;
  border-radius: .25rem;
  margin-bottom: .5rem;
  height: 1.5rem;
}

/* Override these colors in your theme for brand palette. */
.sc-av-message--success { background-color: var(--lt-blue); opacity: 1; }
.sc-av-message--error   { background-color: var(--magenta); opacity: 1; }
.sc-av-message--warning { background-color: var(--lt-grey-blue); opacity: 1; }
