/*
 * Makerique Boutique theme for OpenCart 4
 * Copyright (c) 2026 Heliopsy. All Rights Reserved.
 * https://makerique.com
 * SPDX-License-Identifier: LicenseRef-Proprietary
 * Proprietary and confidential. Unauthorized copying, distribution, or
 * modification of this file, by any means, is strictly prohibited.
 */

/* =========================================================================
   Makerique Boutique — Product component styles
   Product page (product/product.twig), product card (product/thumb.twig)
   and related grid (product/related.twig). Everything styles off the CSS
   custom properties defined in makerique.css — do not hard-code colours,
   fonts or radii here.
   ========================================================================= */

/* ---- 1. Product page layout ----------------------------------------- */
.mr-product { padding-top: 1.5rem; padding-bottom: 1rem; }
.mr-product .breadcrumb { margin-bottom: 1.25rem; }

.mr-product-main {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
@media (max-width: 767.98px) {
  .mr-product-main { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ---- 2. Gallery ------------------------------------------------------ */
.mr-gallery { position: sticky; top: 1.5rem; }
@media (max-width: 991.98px) { .mr-gallery { position: static; } }

.mr-gallery-main {
  position: relative;
  display: block;
  border-radius: var(--mr-radius);
  overflow: hidden;
  background: var(--mr-surface);
  border: 1px solid var(--mr-border);
  box-shadow: var(--mr-shadow);
}
.mr-gallery-main img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: transform .45s ease;
}
.mr-gallery-main:hover img { transform: scale(1.03); }
.mr-gallery-zoom {
  position: absolute;
  right: .7rem; bottom: .7rem;
  z-index: 2;
  width: 2.2rem; height: 2.2rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--mr-radius-pill);
  background: rgba(255, 255, 255, .9);
  color: var(--mr-heading);
  box-shadow: var(--mr-shadow);
  font-size: .85rem;
  pointer-events: none;
}

.mr-gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: .6rem;
  margin-top: .8rem;
}
.mr-gallery-thumbs a {
  display: block;
  border-radius: var(--mr-radius-sm);
  overflow: hidden;
  border: 1px solid var(--mr-border);
  background: var(--mr-surface);
  transition: border-color var(--mr-transition), box-shadow var(--mr-transition);
}
.mr-gallery-thumbs a:hover { border-color: var(--mr-primary); box-shadow: var(--mr-shadow); }
.mr-gallery-thumbs img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }

/* ---- 3. Product info column ------------------------------------------ */
.mr-product-info .mr-badge-stack {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-bottom: .85rem;
}
.mr-product-title {
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  margin: 0 0 .4rem;
  line-height: 1.15;
}
.mr-product-meta {
  list-style: none; margin: 0 0 1rem; padding: 0;
  color: var(--mr-muted); font-size: .9rem;
}
.mr-product-meta li { display: inline-block; margin-right: 1.1rem; }
.mr-product-meta a { color: var(--mr-link); }

.mr-product-rating { margin-bottom: .9rem; }
.mr-product-rating .rating { display: inline-flex; align-items: center; gap: .5rem; }
.mr-product-rating a { font-size: .88rem; color: var(--mr-muted); }
.mr-product-rating a:hover { color: var(--mr-primary); }
.mr-product-rating .fa-star.fa-solid { color: var(--mr-accent); }

/* ---- 4. Price block -------------------------------------------------- */
.mr-price {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .6rem;
  margin: 0 0 .4rem;
}
.mr-price .price-new {
  font-family: var(--mr-font-price);
  font-size: 2rem; font-weight: 700; color: var(--mr-heading);
}
.mr-price.is-special .price-new { color: var(--mr-sale); }
.mr-price .price-old {
  font-size: 1.15rem; color: var(--mr-muted);
  text-decoration: line-through; font-weight: 400;
}
.mr-price-extra { list-style: none; margin: 0 0 1rem; padding: 0; color: var(--mr-muted); font-size: .85rem; }
.mr-price-extra li { margin-bottom: .15rem; }
.mr-price-discounts { border-top: 1px solid var(--mr-border); margin-top: .5rem; padding-top: .5rem; }

/* ---- 5. Product-type messaging (digital / physical) ------------------ */
.mr-type-note {
  display: flex; gap: .7rem; align-items: flex-start;
  border-radius: var(--mr-radius-sm);
  padding: .85rem 1rem;
  margin: 0 0 1.25rem;
  font-size: .9rem; line-height: 1.5;
  background: var(--mr-surface-2);
  border: 1px solid var(--mr-border);
}
.mr-type-note .mr-type-icon { font-size: 1.15rem; line-height: 1.3; }
.mr-type-note strong { color: var(--mr-heading); display: block; margin-bottom: .1rem; }
.mr-type-note--digital { border-left: 3px solid var(--mr-badge-digital); }
.mr-type-note--physical { border-left: 3px solid var(--mr-badge-physical); }
.mr-type-note--rts { border-left: 3px solid var(--mr-badge-rts); }
.mr-type-note--mto { border-left: 3px solid var(--mr-badge-mto); }

/* ---- 6. Buy box (options / qty / cart) ------------------------------- */
.mr-buybox { margin-top: .25rem; }
.mr-buybox hr { border-color: var(--mr-border); opacity: 1; margin: 1.4rem 0; }
.mr-buybox h3 {
  font-size: 1.1rem; margin-bottom: .8rem;
}
.mr-buybox .form-label { font-weight: 600; color: var(--mr-heading); }
.mr-buybox .required .form-label::after { content: " *"; color: var(--mr-sale); }
.mr-buybox .form-check-label img { border-radius: var(--mr-radius-sm); margin-right: .4rem; }

.mr-cart-row { margin-top: 1.2rem; }
.mr-cart-row .input-group-text {
  background: var(--mr-surface-2);
  border-color: var(--mr-border-strong);
  color: var(--mr-heading);
  font-weight: 500;
}
.mr-cart-row #input-quantity {
  flex: 0 0 5rem;
  width: 5rem;
  min-width: 5rem;
  max-width: 5rem;
  text-align: center;
  border: 1px solid var(--mr-border-strong);
  background: var(--mr-surface);
  color: var(--mr-text);
}
.mr-cart-row #button-cart { flex: 1 1 auto; font-weight: 600; }

.mr-actions { display: flex; gap: .5rem; margin-top: 1rem; }
.mr-actions .btn { display: inline-flex; align-items: center; gap: .45rem; }

/* ---- 7. Tabs / description ------------------------------------------- */
.mr-product-tabs { margin-top: clamp(2rem, 5vw, 3.5rem); }
.mr-product-tabs .nav-tabs { border-bottom: 1px solid var(--mr-border); gap: .25rem; }
.mr-product-tabs .nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--mr-muted);
  font-family: var(--mr-font-heading);
  font-weight: 600;
  padding: .7rem 1.1rem;
  background: transparent;
}
.mr-product-tabs .nav-tabs .nav-link:hover { color: var(--mr-heading); }
.mr-product-tabs .nav-tabs .nav-link.active {
  color: var(--mr-primary);
  border-bottom-color: var(--mr-primary);
  background: transparent;
}
.mr-product-tabs .tab-content { padding-top: 1.5rem; line-height: var(--mr-lh-base); }
.mr-product-tabs .tab-content img { border-radius: var(--mr-radius); }
.mr-product-tabs .table { color: var(--mr-text); }
.mr-product-tabs .table td { border-color: var(--mr-border); }

/* ---- 8. Related products grid ---------------------------------------- */
.mr-related { margin-top: clamp(2.5rem, 6vw, 4rem); }
.mr-related .mr-section-head { text-align: left; margin-bottom: 1.5rem; }

/* ---- 9. Product card (thumb) badge stack ----------------------------- */
.product-thumb .image .mr-badge-stack a { display: block; }
/* Card is a flex column so the action row pins to the bottom, INSIDE the border
   (fixes buttons overflowing the content box in equal-height grid rows). */
.product-thumb { display: flex; flex-direction: column; }
.product-thumb .content { display: flex; flex-direction: column; flex: 1 1 auto; }
.product-thumb .content > form { margin-top: auto; }

.product-thumb .content .button {
  /* OpenCart core stylesheet.css sets .button { position: absolute } — that pulls
     the row out of flow and sizes it to the card, so the last (Compare) button
     bleeds past the card edge. Force normal flow so the buttons fit the card. */
  position: static;
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem; margin-top: .8rem;
  width: 100%;
}
.product-thumb .content .button button {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--mr-border-strong);
  background: var(--mr-surface);
  color: var(--mr-heading);
  border-radius: var(--mr-radius-sm);
  padding: .5rem;
  transition: background var(--mr-transition), color var(--mr-transition), border-color var(--mr-transition);
}
.product-thumb .content .button button:first-child {
  flex: 2 1 0;
  background: var(--mr-primary);
  border-color: var(--mr-primary);
  color: #fff;
}
/* Add-to-cart label length: a longer label (Bulgarian "Добави в количка", a skin or
   custom CSS that prints the text on the card) must never push the wishlist,
   compare, quick view or express-order buttons out. The cart button wraps and keeps
   min-width 0; --mr-cart-flex lets a skin give it its own full-width row
   (--mr-cart-flex: 1 1 100%); every button in a row shares the row height. */
.product-thumb .content .button { align-items: stretch; }
.product-thumb .content .button button:first-child {
  flex: var(--mr-cart-flex, 2 1 0);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  text-align: center;
}
.product-thumb .content .button button:not(:first-child):not(.mr-fo-open--card):not(.mr-buynow--card) { flex: 1 1 0; min-width: 2.4rem; }
/* Phones: compact, same-height card actions. Cart on its own full-width row, wishlist
   and compare (when shown) share one fixed-height icon row, express order is one line.
   Fixed 8px gaps, nothing stretches; the form already sits at the bottom of the card
   (margin-top:auto), so rows of cards share a height without dead space around the buttons. */
@media (max-width: 767.98px) {
  /* OpenCart core pads the description and gives it a 45px bottom margin; on a phone
     card that is dead space between the price and the buttons. */
  .product-thumb .content .description { margin: 0 0 6px; padding: .4rem 0 0; }
  .product-thumb .content form .button {
    gap: 8px; margin-top: 10px; align-items: stretch; align-content: flex-start;
  }
  .product-thumb .content form .button button {
    box-sizing: border-box; height: 40px; min-height: 40px; margin: 0; padding: 0 .5rem;
    font-size: .8rem; line-height: 1.2;
  }
  .product-thumb .content form .button button:first-child {
    flex: var(--mr-cart-flex, 1 1 100%); height: auto; padding: .35rem .5rem;
  }
  .product-thumb .content form .button button:not(:first-child):not(.mr-fo-open--card):not(.mr-buynow--card) {
    flex: 1 1 0; min-width: 2.4rem;
  }
  .product-thumb .content form .button button.mr-fo-open.mr-fo-open--card,
  .product-thumb .content form .button button.mr-buynow--card {
    flex: 1 0 100%; width: 100%; margin: 0; padding: 0 .4rem; gap: .35rem;
    font-size: .75rem; white-space: nowrap; overflow-wrap: normal;
  }
  .product-thumb .content form .button button.mr-fo-open--card i { flex: 0 0 auto; margin: 0; }
}
/* Very narrow phones: the express label may wrap rather than clip. */
@media (max-width: 359.98px) {
  .product-thumb .content form .button button.mr-fo-open.mr-fo-open--card,
  .product-thumb .content form .button button.mr-buynow--card { white-space: normal; height: auto; padding: .3rem .4rem; }
}
.product-thumb .content .button button:first-child:hover {
  background: var(--mr-primary-600);
  border-color: var(--mr-primary-600);
}
.product-thumb .content .button button:hover {
  background: var(--mr-surface-2);
  border-color: var(--mr-border-strong);
}
.product-thumb .content .rating { margin-top: .5rem; }
.product-thumb .content .rating .fa-star.fa-solid { color: var(--mr-accent); }
.product-thumb .price-tax { display: block; font-size: .78rem; color: var(--mr-muted); font-weight: 400; }

/* ---- Digital-goods block (product page; shown for digital products) ---- */
.mr-digital-block {
  background: var(--mr-surface-2);
  border: 1px solid var(--mr-border);
  border-radius: var(--mr-radius);
  padding: .9rem 1.1rem;
  margin: 0 0 1.2rem;
}
.mr-digital-instant { font-weight: 600; color: var(--mr-primary); margin: 0 0 .5rem; }
.mr-digital-instant i { color: var(--mr-accent); margin-right: .35rem; }
.mr-digital-meta { margin: 0; display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--mr-text); }
.mr-digital-meta i { color: var(--mr-muted); margin-right: .35rem; width: 1rem; text-align: center; }

/* ── Digital watermark preview (MR: Products → Digital → Watermark) ──────────
   A visual, diagonal watermark overlaid on the digital-product gallery image to
   deter casual copying of the shown preview. It is a deterrent only — the actual
   deliverable is a download file OpenCart releases only after purchase. Sits
   above the image but below the zoom affordance; never intercepts clicks. */
.mr-gallery-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: clamp(1.5rem, 6vw, 3rem);
  line-height: 1;
  white-space: nowrap;
  color: rgba(255, 255, 255, .55);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transform: rotate(-28deg);
  -webkit-user-select: none;
  user-select: none;
}
/* Subtle repeated tint behind the label so it reads on light and dark images. */
.mr-gallery--watermark .mr-gallery-main::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    -28deg,
    rgba(0, 0, 0, .04) 0,
    rgba(0, 0, 0, .04) 2px,
    transparent 2px,
    transparent 26px
  );
}

/* Digital preview watermark carried into the magnific lightbox (see product.twig).
   Mirrors the diagonal card overlay so the popped image isn't a clean copy. */
.mfp-figure { position: relative; }
.mr-mfp-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: rgba(255, 255, 255, .55);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: clamp(1.5rem, 6vw, 3rem);
  transform: rotate(-28deg);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  z-index: 2;
}

/* ── Quick Checkout "Buy it now" button (theme_makerique_qc_*) ───────────
   Injected by the footer script on the enabled surfaces. Off by default. */
.mr-buynow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid var(--mr-primary, #b4694e);
  background: var(--mr-primary, #b4694e);
  color: #fff;
  border-radius: var(--mr-radius-pill, 999px);
  padding: .5rem 1.1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background var(--mr-transition, .2s), border-color var(--mr-transition, .2s), color var(--mr-transition, .2s);
}
.mr-buynow:hover {
  background: var(--mr-primary-600, #8f5340);
  border-color: var(--mr-primary-600, #8f5340);
  color: #fff;
}
.mr-buynow--card { flex: 1 0 100%; margin-top: .45rem; } /* full-width row under the icon buttons */
/* On cards the Buy-it-now is a <button> inside `.product-thumb .content .button`,
   so the generic `.button button` rule (higher specificity) was overriding both
   its flex-basis (forcing it to share the icon row, wrap its label and blow up the
   row height) and its pill styling. Re-assert here with matching specificity so it
   drops onto its own full-width line and keeps the primary pill look. */
.product-thumb .content .button button.mr-buynow--card {
  flex: 1 0 100%;
  background: var(--mr-primary);
  border-color: var(--mr-primary);
  color: #fff;
  border-radius: var(--mr-radius-pill, 999px);
  padding: .5rem 1.1rem;
}
.product-thumb .content .button button.mr-buynow--card:hover {
  background: var(--mr-primary-600);
  border-color: var(--mr-primary-600);
  color: #fff;
}
.mr-buynow--page { margin-left: .5rem; }
.mr-buynow--qv { margin-top: .5rem; }
