/*
 * vandrangl-art – shop.css
 * Product grid, filter sidebar, single product, variations.
 * No WooCommerce default classes used here.
 *
 * Sections:
 *  1. Product Grid (Archive)
 *  2. Product Card
 *  3. Filter Sidebar / Panel
 *  4. Filter Tags
 *  5. Infinite Scroll Loader
 *  6. Single Product
 *  7. Variation Selector
 */

/* ============================================================
   1. PRODUCT GRID (Archive)
   ============================================================ */
.vr-product-archive {
  padding-block: var(--space-lg);
}

.vr-product-archive__layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-lg);
  align-items: start;
}

@media (max-width: 768px) {
  .vr-product-archive__layout {
    grid-template-columns: 1fr;
  }
}

.vr-product-grid {
  display: grid;
  grid-template-columns: var(--shop-columns); /* shared with .vr-hero */
  gap: var(--shop-gap);
}

@media (max-width: 900px) {
  .vr-product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   2. PRODUCT CARD
   ============================================================ */
.vr-product-card {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.vr-product-card__image-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: var(--color-border);
}

.vr-product-card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.vr-product-card:hover .vr-product-card__image-wrap img {
  transform: scale(1.04);
}

.vr-product-card__image-flip {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.vr-product-card:hover .vr-product-card__image-flip {
  opacity: 1;
}

.vr-product-card__body {
  padding: var(--space-sm) 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
}

.vr-product-card__title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.vr-product-card__title a {
  color: inherit;
}

.vr-product-card__price {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
}

.vr-product-card__badge {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  background-color: var(--color-accent);
  color: var(--color-text);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
}

/* ============================================================
   3. FILTER SIDEBAR / PANEL
   ============================================================ */
.vr-filter-panel {
  position: sticky;
  top: calc(var(--header-height) + var(--space-md));
}

.vr-filter-panel__heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
  color: var(--color-muted);
}

.vr-filter-group {
  margin-bottom: var(--space-lg);
}

.vr-filter-group__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
  display: block;
}

/* ============================================================
   4. FILTER TAGS
   ============================================================ */
.vr-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.vr-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  font-size: 0.8rem;
  cursor: pointer;
  background: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.vr-filter-tag:hover,
.vr-filter-tag[aria-pressed="true"] {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

.vr-filter-active-bar {
  margin-bottom: var(--space-md);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
}

.vr-filter-active-bar__label {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.vr-filter-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background-color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.vr-filter-active-chip__remove {
  background: none;
  border: none;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

/* ============================================================
   5. INFINITE SCROLL LOADER
   ============================================================ */
.vr-load-sentinel {
  height: 1px;
  width: 100%;
}

.vr-loading-indicator {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-lg);
  color: var(--color-muted);
  font-size: 0.85rem;
}

.vr-no-more-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-md);
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ============================================================
   6. SINGLE PRODUCT
   ============================================================ */

/* Breadcrumb – horizontal inline list */
.vr-breadcrumb {
  margin-bottom: var(--space-md);
}

.vr-breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.vr-breadcrumb__item a {
  color: var(--color-muted);
  text-decoration: none;
}

.vr-breadcrumb__item a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* last crumb = current page, no link */
.vr-breadcrumb__item:last-child {
  color: var(--color-text);
  font-weight: 600;
}

.vr-breadcrumb__sep {
  padding-inline: 6px;
  color: var(--color-muted);
  user-select: none;
}

.vr-single-product {
  padding-block: var(--space-lg);
}

.vr-single-product__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}

@media (max-width: 768px) {
  .vr-single-product__layout {
    grid-template-columns: 1fr;
  }
}

/* Gallery */
.vr-product-gallery {
  position: sticky;
  top: calc(var(--header-height) + var(--space-md));
  /* Prevent the gallery from ever growing wider than its grid column */
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

/*
 * Catch-all: any <img> injected by WooCommerce gallery plugins
 * (WooGallery, TP Image Flipper, etc.) must stay within the column.
 */
.vr-product-gallery img {
  max-width: 100%;
  height: auto;
  display: block;
}

.vr-product-gallery__main {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: var(--color-border);
  margin-bottom: var(--space-sm);
}

.vr-product-gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vr-product-gallery__thumbs {
  display: flex;
  gap: var(--space-xs);
}

.vr-product-gallery__thumb {
  width: 64px;
  height: 64px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.vr-product-gallery__thumb--active,
.vr-product-gallery__thumb:hover {
  border-color: var(--color-accent);
}

.vr-product-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Product info panel */
.vr-product-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.vr-product-info__title {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.vr-product-info__creator {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.vr-product-info__price-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.vr-product-info__price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
}

.vr-product-info__price del {
  color: var(--color-muted);
  font-size: 1rem;
  font-weight: 400;
}

.vr-product-info__vat {
  font-size: 0.85em;
  color: var(--color-accent);
}

.vr-product-info__attrs {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: 0.9rem;
}

.vr-product-info__attr {
  display: flex;
  gap: var(--space-sm);
}

.vr-product-info__attr-label {
  font-weight: 700;
  min-width: 80px;
}

/* ============================================================
   7. VARIATION SELECTOR
   ============================================================ */
.vr-variation-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.vr-variation-selector__label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.vr-variation-selector__select {
width: 60%;
    padding: 1.2rem 1.5rem;
  border: 1px solid var(--color-border);
  background-color: var(--color-bg);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%232d2d2d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: calc(var(--space-md) * 2 + 12px);
}

.vr-add-to-cart-btn {
  display: block;
    width: 60%;
    padding: 1.5rem 1.5rem 1.35rem;
  background-color: var(--color-text);
  color: var(--color-bg);
  border: none;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-align: center;
}

.vr-add-to-cart-btn:hover {
  background-color: var(--color-accent);
  color: var(--color-text);
}

.vr-add-to-cart-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Stock notice */
.vr-stock-notice {
  font-size: 0.8rem;
  font-weight: 600;
}

.vr-stock-notice--in     { color: var(--color-accent); }
.vr-stock-notice--low    { color: #e07b00; }
.vr-stock-notice--out    { color: #cc0000; }

/* Free delivery inline badge */
.vr-free-delivery {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-accent);
}

.vr-free-delivery__link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.vr-free-delivery__link:hover {
  opacity: 0.75;
}

/* Add-to-cart wrap: quantity + button row */
.vr-add-to-cart-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Quantity picker */
.vr-quantity-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  border: 1px solid var(--color-border);
  width: fit-content;
}

.vr-quantity-btn {
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}

.vr-quantity-btn:hover:not(:disabled) {
  background-color: var(--color-border);
}

.vr-quantity-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.vr-quantity-display {
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
}

/* Add-to-cart button states */
.vr-add-to-cart-btn--loading {
  opacity: 0.7;
  cursor: wait;
}

.vr-add-to-cart-btn--success {
  background-color: var(--color-accent);
  color: var(--color-text);
}

.vr-add-to-cart-btn--outofstock {
  background-color: #aaa;
  color: var(--color-bg);
  opacity: 1; /* override :disabled opacity — use color instead */
}

/* Cart error message */
.vr-cart-error {
  color: #cc0000;
  font-size: 0.85rem;
}

/* Variation selected-value hint */
.vr-variation-selector__selected-val {
  font-weight: 400;
  color: var(--color-muted);
  font-size: 0.8em;
}

/* Product description section (below fold) */
.vr-product-description {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
}

.vr-product-description__heading {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

.vr-product-description__body {
  max-width: 720px;
  line-height: 1.8;
}

/* ============================================================
   PRODUKT-INFO GRID (3 Spalten, unterhalb der Hauptansicht)
   Spalte 1: Kategorie-Infobereich
   Spalte 2: Featured Image der gemappten Kategorie-Info-Seite
   Spalte 3: Lieferung & Retoure (Platzhalter)
   ============================================================ */
.vr-product-info-grid-section {
  margin-top: var(--space-xl);
}

.vr-product-info__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}

@media (max-width: 768px) {
  .vr-product-info__grid {
    grid-template-columns: 1fr;
  }
}

/* Spalte 2: Kategorie-Bild */
.vr-product-info__cat-image {
  width: 100%;
}

.vr-product-info__cat-img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
}

.vr-product-info__col {
  min-width: 0;
}

.vr-product-info__col h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

.vr-product-info__col p {
  line-height: 1.8;
}

/* Kategorie-Info: Gutenberg-Block-Content normalisieren */
.vr-category-info > * + * {
  margin-top: var(--space-sm);
}

/* "Part of" / related product promo */
.vr-part-of {
  padding: var(--space-md);
  background-color: var(--color-border);
  background-size: cover;
  background-position: center;
  position: relative;
}

.vr-part-of__content {
  position: relative;
  z-index: 1;
  color: var(--color-bg);
}

/* ============================================================
   8. SINGLE PRODUCT – FILTER TAG LINKS
   Allow visitors to browse other products with same
   color / style / size taxonomy term.
   ============================================================ */
.vr-product-filter-tags__heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
}

.vr-product-filter-tags {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.vr-product-filter-tags__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.vr-product-filter-tags__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  min-width: 56px;
  flex-shrink: 0;
}

.vr-product-filter-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px 2px;
  border: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  line-height: 1.6;
}

.vr-product-filter-tag:hover {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  text-decoration: none;
}

/* ============================================================
   9. SINGLE PRODUCT – RELATED PRODUCTS STRIP
   4-column grid below the main product layout.
   ============================================================ */
.vr-related-products {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
}

.vr-related-products__heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin-bottom: var(--space-md);
}

.vr-related-products__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

@media (max-width: 900px) {
  .vr-related-products__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .vr-related-products__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
}

/* ============================================================
   10. WC SHORTCODE LOOP (front-page "Newest Products" etc.)
   The WC [products] shortcode renders via our override at
   woocommerce/content-product.php, which outputs .vr-product-card
   inside a WC <ul class="products">.
   These rules handle the <ul> wrapper so it matches the archive grid.
   ============================================================ */

/* Reset WC default list styles on the wrapper */
.woocommerce ul.products,
.wc-shortcode-products ul.products {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: var(--shop-columns); /* shared with .vr-hero + .vr-product-grid */
  gap: var(--shop-gap);
}

/* Reset WC styles on each <li> so our .vr-product-card takes full control */
.woocommerce ul.products li.product,
.wc-shortcode-products ul.products li.product {
  margin: 0;
  padding: 0;
  float: none;
  width: auto;
  clear: none;
}

/* Mobile: 2 columns */
@media (max-width: 900px) {
  .woocommerce ul.products,
  .wc-shortcode-products ul.products {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Heading above shortcode output (if any) – match archive style */
.woocommerce .woocommerce-products-header__title,
.wc-shortcode-products .woocommerce-products-header__title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin-bottom: var(--space-md);
}

/* ============================================================
   11. WC GUTENBERG PRODUCT BLOCK
   The "Newest Products" (and similar) Gutenberg blocks output
   .wc-block-grid structure — different from shortcodes and
   classic WC templates. Styled here to match .vr-product-card.

   DOM structure:
   ul.wc-block-grid
     li.wc-block-grid__product
       a.wc-block-grid__product-link
         div.wc-block-grid__product-image
         div.wc-block-grid__product-title   ← inside <a>
       div.wc-block-grid__product-price     ← sibling after <a>
       div.wc-block-grid__product-add-to-cart
   ============================================================ */

/* Grid wrapper: respect block's own column setting (has-4-columns etc.) */
.wc-block-grid {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Each product item */
.wc-block-grid__product {
  list-style: none;
  display: flex;
  flex-direction: column;
}

/* Product link: block-level, no underline */
.wc-block-grid__product-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  flex: 1;
}

/* Image container: square aspect ratio + overflow clip */
.wc-block-grid__product-image {
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background-color: #f5f5f5;
  flex: 1;
}

.wc-block-grid__product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  max-width: none;         /* override global img rule */
  transition: transform 0.4s ease;
}

.wc-block-grid__product:hover .wc-block-grid__product-image img {
  transform: scale(1.04);
}

/* Title: small, matches .vr-product-card__title */
.wc-block-grid__product-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: var(--space-sm);
  text-decoration: none;
}

/* Price: accent colour, small, matches .vr-product-card__price */
.wc-block-grid__product-price {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent);
  padding-bottom: var(--space-sm);
  margin-top: 0;
}

.wc-block-grid__product-price .woocommerce-Price-amount,
.wc-block-grid__product-price .price {
  font-size: inherit;
  font-weight: inherit;
  color: var(--color-accent);
}

/* Hide elements not needed in this layout */
.wc-block-grid__product-rating,
.wc-block-grid__product-add-to-cart,
.wc-block-grid__product-sku-number {
  display: none;
}

/* Mobile: block itself uses WC-generated has-N-columns classes,
   override to 2 cols on small screens */
@media (max-width: 900px) {
  .wc-block-grid.has-4-columns,
  .wc-block-grid.has-3-columns {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ============================================================
   12. CATEGORY PAGE HEADER
   Shown on is_product_category() pages above the product grid.
   Layout: [image 60% | name + description 40%]
   Rendered by woocommerce/partials/category-header.php.
   ============================================================ */

.vr-cat-header {
  display: flex;
  height: 40vh;
  min-height: 220px;
  margin-bottom: var(--space-lg); /* ≥ 2rem gap to product grid below */
  overflow: hidden;
}

/* Left panel: category background image */
.vr-cat-header__image {
  flex: 0 0 60%;
  background-size: cover;
  background-position: center;
}

/* Right panel: name + description, vertically centred */
.vr-cat-header__info {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-lg) var(--space-lg) var(--space-lg) var(--space-xl);
  gap: var(--space-md);
}

/* No image: info panel expands to full width */
.vr-cat-header--no-image .vr-cat-header__image {
  display: none;
}
.vr-cat-header--no-image .vr-cat-header__info {
  flex: 1;
  padding-left: 0;
}

.vr-cat-header__title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
  line-height: 1.15;
}

.vr-cat-header__desc {
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: var(--line-height);
  max-width: 48ch;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .vr-cat-header {
    flex-direction: column;
    height: auto;
  }

  .vr-cat-header__image {
    flex: 0 0 auto;
    height: 40vw;
    min-height: 160px;
  }

  .vr-cat-header__info {
    flex: 1;
    padding: var(--space-md);
  }

  .vr-cat-header__title {
    font-size: 1.4rem;
  }
}
