/**
 * @file
 * Product page — comprehensive styling.
 *
 * Brand colors:
 *   Blue (primary):  #08a6e3
 *   Green (success):  #00746b
 *
 * Provides consistent typography, taxonomy chips, image gallery fixes,
 * characteristics layout, price display, and general product page polish.
 */

/* ═══════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES — Brand palette
   ═══════════════════════════════════════════════════════════════ */
:root {
  --em-blue: #08a6e3;
  --em-blue-dark: #0789ba;
  --em-blue-light: #e6f6fc;
  --em-blue-lighter: #f0f9fd;
  --em-blue-border: #b3e2f5;
  --em-green: #00746b;
  --em-green-dark: #005d56;
  --em-green-light: #e6f3f2;
  --em-green-border: #99ccc8;
  --em-text: #212529;
  --em-text-muted: #6c757d;
  --em-border: #dee2e6;
  --em-bg-light: #f8f9fa;
}

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY — Consistent font sizing
   ═══════════════════════════════════════════════════════════════ */

/* Product title */
.field--name-title h1,
.field--name-title .field__item {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.15rem;
  color: var(--em-text);
  font-family: inherit;
}

/* Reference — subtle inline label */
.field--name-referencia {
  font-size: 0.8rem;
  color: var(--em-text-muted);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.35em;
}

.field--name-referencia .field__label {
  display: inline;
  font-weight: 600;
  font-size: 0.7rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0;
}

.field--name-referencia .field__label::after {
  content: '';
}

.field--name-referencia .field__item {
  display: inline;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  color: #555;
  background: var(--em-bg-light);
  padding: 0.12em 0.45em;
  border-radius: 3px;
  border: 1px solid var(--em-border);
}

/* ═══════════════════════════════════════════════════════════════
   TAXONOMY CHIPS — All blue, unified container
   ═══════════════════════════════════════════════════════════════ */

/* Combined chip container — single flex row for ALL chips
   (brand + collections + highlights merged in PHP).
   The .product-chips-combined class is on each field__item wrapper;
   we make the parent .content div the flex container and flatten wrappers. */
.block-field-blockcommerce-productphysicalproduct-brand > .content {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

/* Make each field__item wrapper transparent to flex flow */
.product-chips-combined {
  display: contents;
}

/* Hide label */
.product-chips-combined .field__label,
.block-field-blockcommerce-productphysicalproduct-brand .field__label {
  display: none !important;
}

/* Hide the now-empty collections and highlights blocks entirely */
.block-field-blockcommerce-productphysicalproduct-collections,
.block-field-blockcommerce-productphysicaldestaques-do-produto {
  display: none !important;
}

/* Base chip style — ALL blue pill */
.product-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3em 0.85em;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none !important;
  border-radius: 50px;
  transition: all 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
  background-color: var(--em-blue-light);
  color: var(--em-blue-dark) !important;
  border: 1px solid var(--em-blue-border);
}

.product-chip:hover {
  text-decoration: none !important;
  background-color: var(--em-blue);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(8, 166, 227, 0.2);
}

.product-chip:active {
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   IMAGE GALLERY — Contained sizing, proper aspect ratio
   ═══════════════════════════════════════════════════════════════ */

/* Main product image container */
.bootstrap-basic-image-gallery {
  text-align: center;
  background: #fff;
}

/* Clickable main image wrapper */
.bootstrap-basic-image-gallery .main-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  cursor: zoom-in;
  min-height: 200px;
}

/* Main product image — not too big, properly contained */
.bootstrap-basic-image-gallery .main-image img {
  max-width: 85%;
  max-height: 380px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

/* Thumbnails */
.bootstrap-basic-image-gallery .thumbnails,
.bootstrap-basic-image-gallery .thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.6rem;
}

.bootstrap-basic-image-gallery .thumbnail-item img,
.bootstrap-basic-image-gallery .thumb-row img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 2px solid var(--em-border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  padding: 2px;
  background: #fff;
}

.bootstrap-basic-image-gallery .thumbnail-item.active img,
.bootstrap-basic-image-gallery .thumbnail-item:hover img,
.bootstrap-basic-image-gallery .thumb-row img:hover,
.bootstrap-basic-image-gallery .thumb-row img.active {
  border-color: var(--em-blue);
  box-shadow: 0 0 0 2px rgba(8, 166, 227, 0.2);
}

/* Belgrade image list override */
.image-list .image-item img {
  height: 64px !important;
  width: 64px !important;
  object-fit: contain !important;
  padding: 2px;
  border: 2px solid var(--em-border);
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.15s;
}

.image-list .image-item.active img,
.image-list .image-item:hover img {
  border-color: var(--em-blue);
  box-shadow: 0 0 0 2px rgba(8, 166, 227, 0.2);
  opacity: 1;
}

/* Modal zoom — full size */
.bootstrap-basic-image-gallery .modal .carousel-item img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  margin: 0 auto;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   PRICE — Clean discount display, brand colors
   ═══════════════════════════════════════════════════════════════ */

/* Price section spacing */
.field--name-price {
  margin: 0.75rem 0;
  padding: 0.25rem 0;
}

/* Discount container */
.price-discount {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5em;
  line-height: 1.3;
}

/* Sale price — green (brand success) */
.price-discount__sale {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--em-green);
}

/* Original price — subtle strikethrough */
.price-discount__original {
  font-size: 0.95rem;
  color: #999;
}

.price-discount__original del {
  text-decoration: line-through;
  text-decoration-color: #bbb;
}

/* Regular price (not discounted) — also green */
.commerce-price-calculated,
.field--name-price .field__item {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--em-green);
}

/* Commerce price formatter override — hide the ugly percentage */
.commerce-price-formatter span:last-child {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   ADD TO CART — Clean styling, native button color
   ═══════════════════════════════════════════════════════════════ */

/* Quantity row — inline label + input */
.field--name-variations .field--name-quantity {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

/* Quantity label — normal case */
.field--name-variations .field--name-quantity label,
.field--name-variations label[for*="quantity"],
.field--name-variations label[for*="edit-quantity"] {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--em-text-muted);
  margin-bottom: 0;
  white-space: nowrap;
}

/* Quantity input */
.field--name-variations .form-number,
.field--name-variations input[type="number"] {
  max-width: 65px;
  text-align: center;
  border-radius: 6px;
  border: 1px solid var(--em-border);
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Remove extra wrapper margin from form-item */
.field--name-variations .form-item-quantity-0-value {
  margin-bottom: 0;
}

/* Add to cart button — btn-primary applied via form_alter */
.field--name-variations .form-actions .btn,
.field--name-variations .form-actions .button,
.field--name-variations .form-actions input[type="submit"] {
  display: block;
  width: 100%;
  padding: 0.7rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  text-transform: none;
  letter-spacing: 0;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

/* Hide the basket/cart SVG icon from Belgrade (safety net) */
.field--name-variations .form-actions .bi-btn-basket,
.field--name-variations .form-actions .bi-btn-add {
  background-image: none !important;
  padding-left: 2rem;
}

.field--name-variations .form-actions .btn:hover,
.field--name-variations .form-actions .button:hover,
.field--name-variations .form-actions input[type="submit"]:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.field--name-variations .form-actions .btn:active {
  transform: translateY(0);
}

/* Space between quantity and button */
.field--name-variations .form-actions {
  margin-top: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   CHARACTERISTICS — Dimensions & Volume as specs grid
   ═══════════════════════════════════════════════════════════════ */

.field--name-altura,
.field--name-largura,
.field--name-profundidade,
.field--name-volume {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  padding: 0.3em 0.65em;
  background: var(--em-bg-light);
  border-radius: 6px;
  margin: 0.15em 0.2em;
  font-size: 0.78rem;
  border: 1px solid var(--em-border);
}

.field--name-altura .field__label,
.field--name-largura .field__label,
.field--name-profundidade .field__label,
.field--name-volume .field__label {
  font-weight: 600;
  color: var(--em-text-muted);
  font-size: 0.72rem;
  text-transform: capitalize;
  margin-bottom: 0;
}

.field--name-altura .field__item,
.field--name-largura .field__item,
.field--name-profundidade .field__item,
.field--name-volume .field__item {
  font-weight: 600;
  color: var(--em-text);
  font-size: 0.78rem;
}

/* Unit labels */
.field--name-altura .field__item::after,
.field--name-largura .field__item::after,
.field--name-profundidade .field__item::after {
  content: ' cm';
  font-weight: 400;
  color: #999;
  font-size: 0.85em;
}

.field--name-volume .field__item::after {
  content: ' L';
  font-weight: 400;
  color: #999;
  font-size: 0.85em;
}

/* ═══════════════════════════════════════════════════════════════
   STOCK INDICATOR — Brand colors
   ═══════════════════════════════════════════════════════════════ */

.stock-indicator {
  margin: 0.6rem 0;
  font-size: 0.82rem;
  border-radius: 6px;
  padding: 0.35em 0.75em;
}

.stock-indicator__icon {
  font-size: 0.9em;
  font-weight: 700;
}

/* In stock — brand green */
.stock-indicator--ok {
  background-color: var(--em-green-light);
  color: var(--em-green);
  border: 1px solid var(--em-green-border);
}

/* Low stock — amber */
.stock-indicator--low {
  background-color: #fff8e1;
  color: #e65100;
  border: 1px solid #ffcc80;
}

/* Out of stock — muted red */
.stock-indicator--out {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* ═══════════════════════════════════════════════════════════════
   BODY / DESCRIPTION field
   ═══════════════════════════════════════════════════════════════ */

.field--name-body {
  font-size: 0.88rem;
  line-height: 1.65;
  color: #444;
  margin: 0.5rem 0;
}

/* ═══════════════════════════════════════════════════════════════
   ETIQUETA
   ═══════════════════════════════════════════════════════════════ */

.field--name-etiqueta {
  margin-bottom: 0.4rem;
}

/* ═══════════════════════════════════════════════════════════════
   FINANCING BLOCK — Brand blue header
   ═══════════════════════════════════════════════════════════════ */

.financing-info-block .financing-header,
.financing-info-block h3 {
  background-color: var(--em-blue) !important;
}

/* ═══════════════════════════════════════════════════════════════
   GENERAL LAYOUT SPACING — Tighter vertical rhythm
   ═══════════════════════════════════════════════════════════════ */

/* All layout builder blocks on product page — minimal gap */
.layout-builder__layout .block-layout-builder {
  margin-bottom: 0.2rem;
}

/* Chip block (the brand block that now holds ALL chips) */
.block-field-blockcommerce-productphysicalproduct-brand {
  margin-bottom: 0.4rem !important;
}

/* Remove .content wrapper padding inside LB blocks */
.block-layout-builder > .content {
  padding: 0;
}

/* Title h1 — remove default Bootstrap m-0 unless already set */
.block-field-blockcommerce-productphysicaltitle h1.m-0 {
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   PRODUCT TEASER CONTEXT — Smaller sizes
   ═══════════════════════════════════════════════════════════════ */

/* -- Product info: override Belgrade's single-row flex layout -- */
.product-teaser .product-info,
.product .product-info {
  height: auto !important;
  min-height: 4rem;
  flex-wrap: wrap;
  padding: 0.4rem 0;
  row-gap: 0;
}

/* Title takes full width on its own row */
.product-teaser .product-info .product-title,
.product .product-info .product-title {
  width: 100%;
  padding-right: 0;
  line-height: 1.3;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Stretched-link — keep static so ::after covers the whole card */
.product-teaser .product-info .stretched-link,
.product .product-info .stretched-link {
  position: static;
}

/* Reference field — full width, subtle style */
.product-teaser .product-info .field--name-referencia,
.product .product-info .field--name-referencia {
  width: 100%;
  font-size: 0.72rem;
  color: #888;
  order: 2;
  margin-bottom: 0.15rem;
}

/* Price — left-aligned on its own row */
.product-teaser .product-info .field--name-price,
.product .product-info .field--name-price {
  font-weight: 700;
  font-size: 1rem;
  order: 3;
  margin-right: auto;
}

/* Stock indicator in teaser — compact, right side of price row */
.product-teaser .product-info .stock-indicator,
.product .product-info .stock-indicator {
  font-size: 0.7rem;
  order: 4;
  margin-left: auto;
  padding: 0.15em 0.5em;
}

/* Hover state — keep Belgrade's hover effect but adapt for new layout */
.product:hover .product-info {
  padding: 0.4rem 1rem !important;
}

.product:hover .product-info .product-title {
  padding-right: 0;
}

.product:hover .product-info .field--name-referencia {
  color: rgba(255, 255, 255, 0.7);
}

.product-teaser .product-chip {
  font-size: 0.68rem;
  padding: 0.18em 0.5em;
}

.product-teaser .price-discount__sale {
  font-size: 1rem;
}

.product-teaser .price-discount__original {
  font-size: 0.78rem;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile-first approach
   ═══════════════════════════════════════════════════════════════ */

/* ── Tablet (≤ 991px) — layout stacks to single column ──────── */
@media (max-width: 991px) {
  /* Image takes full width on stack */
  .bootstrap-basic-image-gallery .main-image {
    padding: 0.75rem;
  }

  .bootstrap-basic-image-gallery .main-image img {
    max-height: 320px;
    max-width: 90%;
  }

  /* Title slightly smaller */
  .field--name-title h1,
  .field--name-title .field__item {
    font-size: 1.25rem;
  }

  /* Price section */
  .price-discount__sale {
    font-size: 1.4rem;
  }

  .commerce-price-calculated,
  .field--name-price .field__item {
    font-size: 1.3rem;
  }
}

/* ── Phone (≤ 767px) — compact layout ─────────────────────── */
@media (max-width: 767px) {
  /* Image */
  .bootstrap-basic-image-gallery .main-image {
    padding: 0.5rem;
    border-radius: 6px;
    min-height: 150px;
  }

  .bootstrap-basic-image-gallery .main-image img {
    max-height: 240px;
    max-width: 95%;
  }

  /* Thumbnails smaller */
  .bootstrap-basic-image-gallery .thumbnail-item img,
  .bootstrap-basic-image-gallery .thumb-row img {
    width: 48px;
    height: 48px;
  }

  .image-list .image-item img {
    height: 48px !important;
    width: 48px !important;
  }

  /* Chips — slightly smaller on mobile */
  .product-chip {
    font-size: 0.7rem;
    padding: 0.25em 0.65em;
  }

  /* Title */
  .field--name-title h1,
  .field--name-title .field__item {
    font-size: 1.15rem;
  }

  /* Reference */
  .field--name-referencia {
    flex-wrap: wrap;
  }

  /* Price */
  .price-discount__sale {
    font-size: 1.3rem;
  }

  .price-discount__original {
    font-size: 0.85rem;
  }

  .commerce-price-calculated,
  .field--name-price .field__item {
    font-size: 1.2rem;
  }

  .field--name-price {
    margin: 0.5rem 0;
  }

  /* Button — full width, bigger tap target */
  .field--name-variations .form-actions .btn,
  .field--name-variations .form-actions input[type="submit"] {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    min-height: 48px;
  }

  /* Quantity row */
  .field--name-variations .field--name-quantity {
    gap: 0.5rem;
  }

  .field--name-variations input[type="number"] {
    max-width: 60px;
    padding: 0.4rem;
    min-height: 44px;
  }

  /* Specs — wrap tighter */
  .field--name-altura,
  .field--name-largura,
  .field--name-profundidade,
  .field--name-volume {
    font-size: 0.72rem;
    padding: 0.25em 0.5em;
  }

  /* Stock indicator */
  .stock-indicator {
    font-size: 0.78rem;
    margin: 0.4rem 0;
  }

  /* Financing block */
  .financing-info-block {
    font-size: 0.85rem;
  }

  /* Layout blocks tighter on mobile */
  .layout-builder__layout .block-layout-builder {
    margin-bottom: 0.15rem;
  }
}

/* ── Small Phone (≤ 480px) — extra compact ─────────────────── */
@media (max-width: 480px) {
  .bootstrap-basic-image-gallery .main-image img {
    max-height: 200px;
    max-width: 100%;
  }

  .field--name-title h1,
  .field--name-title .field__item {
    font-size: 1.05rem;
  }

  .product-chip {
    font-size: 0.65rem;
    padding: 0.2em 0.55em;
  }

  .price-discount__sale {
    font-size: 1.15rem;
  }

  .field--name-referencia .field__item {
    font-size: 0.72rem;
  }

  /* Ensure image border doesn't eat space */
  .bootstrap-basic-image-gallery .main-image {
    padding: 0.35rem;
  }
}
