/* Product page fixes (2026-11-18), /product/... (shop_productDetail.xhtml). */

/* Related products heading: clear space from the product block above it. */
#myFormFa .pd-related-heading { margin: 40px 0 0; font-weight: 800; }
#myFormFa .pd-related-rule { margin: 10px 0 18px; }

@media (min-width: 992px) {
  /* History box frame: a 260px min-height (product-details-responsive.css) made it taller than its 246px cell,
     which clips overflow, so the top and bottom borders were cut. Fit the box to its cell. */
  html body #myFormFa.product-details-responsive:not(#_) .pd-history-source > .history__container {
    min-height: 0 !important;
    height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important; /* the scrolling text no longer covers the rounded bottom border */
  }
  html body #myFormFa.product-details-responsive:not(#_) .pd-history-source > .history__container > .info-section {
    padding-bottom: 12px !important;
    border-radius: 0 !important;
    box-sizing: border-box;
  }
  /* History box (e.g. oils): the paragraphs were shrunk inside the fixed-height box and cut off;
     keep them at full height and let the box itself scroll. */
  #myFormFa .history__container .info-section > p {
    flex-shrink: 0;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

@media (max-width: 991.98px) {
  /* Coffee & chocolate (shop_product_id_20.xhtml): fixed 225px / 175px boxes cut the "know more" text and left
     half of the processing-video box empty; size them to their content on phones and tablets. */
  #myFormFa :is(.product-layout-history, .product-layout-know-more, .product-layout-nutrition,
                .product-layout-properties, .product-layout-instruction) { height: auto !important; }
  #myFormFa :is(.product-layout-know-more, .product-layout-properties) :is(.product-sub-section, .info-section) { height: auto !important; }
  #myFormFa .product-layout-properties img.c-pointer { display: block; width: 100%; height: auto !important; }
}

@media (max-width: 991.98px) {
  /* Coffee & chocolate: the small second picture sat on top of the consumer price text.
     Pin it to the left corner of the price box and keep the price text clear of it. */
  #myFormFa .cart__container .product-cart { position: relative !important; }
  #myFormFa .cart__container .product-cart > .d-flex > .d-flex { padding-left: 66px !important; box-sizing: border-box; }
  html body #myFormFa .cart__container .purchase-thumbnail.d-flex > div.position-relative { position: static !important; }
  html body #myFormFa .cart__container .purchase-thumbnail.d-flex img.picture-small {
    position: absolute !important;
    left: 8px !important;
    top: 8px !important;
    width: 56px !important;
    height: 56px !important;
    z-index: 1;
  }
}

/* ---------- tablets 768-991px (all products) ---------- */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* Image | price card: same height (the empty mobile history strip under the price card is hidden). */
  html body #myFormFa#myFormFa .product-grid-col.d-md-flex .history__container-md.history__container-md { display: none !important; }
  html body #myFormFa .product-grid-col.d-md-flex > div:has(.cart__container) { display: flex !important; flex-direction: column; }
  html body #myFormFa .product-grid-col.d-md-flex > div:has(.cart__container) > div { flex: 1 1 auto; display: flex !important; flex-direction: column; height: auto !important; }
  html body #myFormFa .product-grid-col.d-md-flex .cart__container { flex: 1 1 auto; height: auto !important; margin-bottom: 0 !important; justify-content: space-between !important; }

  /* History | properties: same height. */
  #myFormFa :is(.pd-history-source, .pd-properties-source) { display: flex !important; flex-direction: column; }
  #myFormFa :is(.pd-history-source, .pd-properties-source) > * { flex: 1 1 auto; height: auto !important; min-height: 0; }

  /* Contents / anatomy / usage cards: one height, no inner scrollbar. */
  #myFormFa .product-col3-sec1-col2 :is(> .d-flex.flex-wrap, > dialog > .d-flex.flex-wrap) { align-items: stretch; }
  #myFormFa .product-col3-sec1-col2 .setHeight { height: 100% !important; min-height: 190px; overflow: visible !important; }

  /* Coffee & chocolate: the boxes sat in one unwrapped row and ran off the screen; two-column grid instead. */
  html body #myFormFa .product-col3-sec1.notHeight { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  html body #myFormFa .product-col3-sec1.notHeight > * { width: auto !important; max-width: none !important; flex: none !important; margin: 0 !important; height: auto !important; }
  html body #myFormFa .product-col3-sec1.notHeight > :is(.history__container, .product-layout-know-more, .product-layout-properties) { grid-column: 1 / -1; }
  html body #myFormFa .product-col3-sec1.notHeight > .product-layout-properties { order: 5; }
}

/* ---------- coffee & chocolate, desktop: every box fits its grid cell (225px / 175px rows) ----------
   The history box was 260px tall and ran over the video box; inner margins pushed the others 4px out. */
@media (min-width: 992px) {
  html body #myFormFa.product-details-responsive:not(#_) .product-col3-sec1.notHeight > * {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    box-sizing: border-box;
    overflow: hidden !important;
  }
  html body #myFormFa.product-details-responsive:not(#_) .product-col3-sec1.notHeight > *,
  html body #myFormFa.product-details-responsive:not(#_) .product-col3-sec1.notHeight > * > * { margin: 0 !important; }
  html body #myFormFa.product-details-responsive:not(#_) .product-col3-sec1.notHeight > * > .product-sub-section,
  html body #myFormFa.product-details-responsive:not(#_) .product-col3-sec1.notHeight > .history__container > .info-section { height: 100% !important; min-height: 0 !important; }
  html body #myFormFa.product-details-responsive:not(#_) .product-col3-sec1.notHeight > .history__container > .info-section {
    overflow-y: auto !important;
    padding-bottom: 12px !important;
    border-radius: 0 !important;
    box-sizing: border-box;
  }
}

/* ---------- desktop: one fixed history-box height on every product (246px) ---------- */
@media (min-width: 992px) {
  html body #myFormFa.product-details-responsive:not(#_) .pd-history-source > .history__container {
    height: 242px !important;
    flex: none !important;
  }
  html body #myFormFa.product-details-responsive:not(#_) .pd-history-source { height: 242px !important; }
  /* coffee & chocolate: first row (history, know more, nutrition) as tall as the history box elsewhere */
  html body #myFormFa.product-details-responsive:not(#_) .product-col3-sec1.notHeight { grid-template-rows: 246px 175px !important; }
  /* the grid kept its old fixed height (408px), so the 175px row (video, usage) ran over the coffee banner below */
  html body #myFormFa.product-details-responsive:not(#_) .product-col3-sec1.notHeight {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-bottom: 12px !important;
  }
}

/* desktop: move the small thumbnail to the left of the price card so it no longer covers the price */
@media (min-width:992px){
html body #myFormFa .cart__container .product-cart{position:relative !important}
html body #myFormFa .cart__container .purchase-thumbnail.d-flex, html body #myFormFa .cart__container .purchase-thumbnail.d-flex > div.position-relative{position:static !important}
html body #myFormFa .cart__container .purchase-thumbnail.d-flex img.picture-small{position:absolute !important;left:8px !important;right:auto !important;top:8px !important;width:56px !important;height:56px !important;z-index:1}
}

/* mobile/tablet coffee: taller nutrition table (no inner scroll) and processing box */
@media (max-width:991.98px){
html body #myFormFa .product-col3-sec1.notHeight .product-layout-nutrition, html body #myFormFa .product-col3-sec1.notHeight .product-layout-nutrition .setHeight, html body #myFormFa .product-col3-sec1.notHeight .product-layout-nutrition .info-section{height:auto !important;max-height:none !important;min-height:0 !important;overflow:visible !important}
html body #myFormFa .product-col3-sec1.notHeight .product-layout-properties, html body #myFormFa .product-col3-sec1.notHeight .product-layout-properties > .info-section{height:220px !important;max-height:none !important}
html body #myFormFa .product-col3-sec1.notHeight .product-layout-properties img.c-pointer{height:100% !important;width:100% !important;object-fit:cover !important}
}

/* mobile/tablet price rows: label + tax text flow together on the right, number on the left, fluid font sizes */
@media (max-width:1199.98px){
html body #myFormFa .cart__container li:has(.pd-price-label){display:flex !important;flex-wrap:nowrap !important;align-items:center !important;justify-content:space-between !important;gap:8px;width:100%}
html body #myFormFa .cart__container .pd-price-label{flex:1 1 auto !important;min-width:0;margin:0 !important;white-space:normal !important;line-height:1.5;font-size:clamp(10px,2.9vw,13px) !important}
html body #myFormFa .cart__container .pd-price-label > .color-theme{font-size:1.4em !important;vertical-align:middle;margin-left:2px}
html body #myFormFa .cart__container li:has(.pd-price-label) .value{flex:0 0 auto !important;white-space:nowrap !important;margin-right:auto !important;font-size:clamp(12px,3.6vw,16px) !important}
}

/* mobile: small thumbnail sits on the bottom-left corner of the main product image (positioned from the cart box, 20px above its top) */
@media (max-width:767.98px){
html body #myFormFa .cart__container.cart__container{position:relative !important;overflow:visible !important}
html body #myFormFa .cart__container .product-cart.product-cart{position:static !important;overflow:visible !important}
html body #myFormFa .cart__container .product-cart > .d-flex > .d-flex{padding-left:0 !important}
html body #myFormFa .cart__container .purchase-thumbnail.d-flex img.picture-small{position:absolute !important;left:10px !important;right:auto !important;top:auto !important;bottom:calc(100% + 20px) !important;width:56px !important;height:56px !important;z-index:5;border-radius:8px;border:2px solid #fff;box-shadow:0 2px 8px rgba(0,0,0,.25);background:#fff;object-fit:cover}
}

/* mobile/tablet: smaller tax note inside the price label */
@media (max-width:1199.98px){
html body #myFormFa .cart__container .pd-price-label .pd-tax-note{font-size:.78em !important;font-weight:500 !important;opacity:.8}
}

/* mobile: price block uses the full width of the cart (the 48px column for the old thumbnail is gone) */
@media (max-width:767.98px){
html body #myFormFa .cart__container .product-cart > .d-flex.justify-content-between{grid-template-columns:minmax(0,1fr) !important;padding-left:0 !important}
html body #myFormFa .cart__container .product-cart > .d-flex.justify-content-between > *{grid-column:1 / -1 !important;width:100% !important;max-width:none !important}
html body #myFormFa .cart__container .product-cart ul.list-unstyled{width:100% !important}
}

/* desktop: product image box height */
@media (min-width:992px){
html body #myFormFa .product-col1-row1{height:425px !important}
}

/* desktop: fixed height for the properties (خواص) box */
@media (min-width:992px){
html body #myFormFa.product-details-responsive:not(#_) .pd-properties-source{height:254px !important}
html body #myFormFa.product-details-responsive:not(#_) .pd-properties-source > *{height:254px !important;min-height:0 !important;max-height:none !important;flex:none !important;margin:0 !important}
}

/* desktop price rows: label on the right, number opposite on the left, 16px gap, vertically centred */
@media (min-width:1200px){
html body #myFormFa.product-details-responsive:not(#_):not(#_) .cart__container li:has(> .value){display:flex !important;flex-wrap:nowrap !important;align-items:center !important;justify-content:space-between !important;gap:16px !important;width:100% !important}
html body #myFormFa.product-details-responsive:not(#_):not(#_) .cart__container li:has(> .value) > p{flex:1 1 0 !important;min-width:0;width:auto !important;max-width:none !important;margin:0 !important}
html body #myFormFa.product-details-responsive:not(#_):not(#_) .cart__container li:has(> .value) > .value{flex:0 0 auto !important;white-space:nowrap !important;margin-right:auto !important;align-self:center !important}
}

/* desktop: price list uses the full width of the cart; the small thumbnail moves onto the bottom-left of the product image (same as mobile) */
@media (min-width:992px){
html body #myFormFa .cart__container .product-cart > .d-flex.justify-content-between{grid-template-columns:minmax(0,1fr) !important;padding-left:0 !important}
html body #myFormFa .cart__container .product-cart > .d-flex.justify-content-between > *{grid-column:1 / -1 !important;width:100% !important;max-width:none !important}
html body #myFormFa .cart__container .product-cart > .d-flex.justify-content-between > .d-flex > div:has(> ul.list-unstyled), html body #myFormFa .cart__container .product-cart ul.list-unstyled{width:100% !important;flex:1 1 auto !important}
html body #myFormFa .cart__container.cart__container{position:relative !important;overflow:visible !important}
html body #myFormFa .cart__container .product-cart.product-cart{position:static !important;overflow:visible !important}
html body #myFormFa .cart__container .purchase-thumbnail.d-flex img.picture-small{position:absolute !important;left:10px !important;right:auto !important;top:auto !important;bottom:calc(100% + 20px) !important;width:56px !important;height:56px !important;z-index:5;border-radius:8px;border:2px solid #fff;box-shadow:0 2px 8px rgba(0,0,0,.25);background:#fff;object-fit:cover}
}

/* all categories, all sizes: small thumbnail now lives inside the product image box (bottom-left); price block uses the full cart width */
html body #myFormFa .product-pic__container{position:relative !important}
html body #myFormFa .product-pic__container > .pd-pic-thumb{position:absolute;left:10px;bottom:10px;width:56px;height:56px;z-index:5;border-radius:8px;border:2px solid #fff;box-shadow:0 2px 8px rgba(0,0,0,.25);background:#fff;object-fit:cover}
html body #myFormFa .cart__container :is(.product-cart,.oil-cart) > .d-flex.justify-content-between{grid-template-columns:minmax(0,1fr) !important;padding-left:0 !important}
html body #myFormFa .cart__container :is(.product-cart,.oil-cart) > .d-flex.justify-content-between > *{grid-column:1 / -1 !important;width:100% !important;max-width:none !important}
html body #myFormFa .cart__container :is(.product-cart,.oil-cart) > .d-flex > .d-flex{padding-left:0 !important}
html body #myFormFa .cart__container :is(.product-cart,.oil-cart) > .d-flex > .d-flex > div:has(> ul.list-unstyled), html body #myFormFa .cart__container :is(.product-cart,.oil-cart) ul.list-unstyled{width:100% !important;flex:1 1 auto !important}

/* small thumbnail: on the product image below 992px, inside the price box (top-left, price shifted 66px) on desktop */
.pd-cart-thumb{display:none}
@media (min-width:992px){
html body #myFormFa .product-pic__container > .pd-pic-thumb{display:none !important}
html body #myFormFa .cart__container :is(.product-cart,.oil-cart){position:relative !important}
html body #myFormFa .cart__container :is(.product-cart,.oil-cart) > .pd-cart-thumb{display:block;position:absolute;left:10px;top:10px;width:56px;height:56px;z-index:2;border-radius:8px;border:2px solid #fff;box-shadow:0 2px 8px rgba(0,0,0,.2);background:#fff;object-fit:cover}
html body #myFormFa .cart__container :is(.product-cart,.oil-cart) > .d-flex.justify-content-between{padding-left:66px !important;box-sizing:border-box !important}
}

/* desktop: tax note in the price label smaller and red */
@media (min-width:1200px){
html body #myFormFa .cart__container .pd-tax-note-desk{font-size:.85em !important;color:#d32f2f !important}
}
