/* Single product page (reference: build/prototype/product.html). The Theme Builder template carries the structure (build/tools/build-product.js);
   the looks live here. Native WooCommerce widgets; option groups / add-ons boxes: options.css + the plugins; shared pieces
   (stars, notices, stepper, delivery box): components.css. Related products reuse the shop card look (shop.css, class safy-products).
   `!important` appears only where Elementor / WooCommerce / the Manager Suite print their own with !important or load after this file. */

/* ----- line icons (prototype icons.svg) as masks: colour = the element's background (truck / arrow: icons.css) ----- */
:root {
  --ico-shield: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E");
  --ico-award: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='6'/%3E%3Cpath d='M15.48 12.89L17 22l-5-3-5 3 1.52-9.11'/%3E%3C/svg%3E");
  --ico-box: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'/%3E%3Cpath d='M3.27 6.96L12 12.01l8.73-5.05M12 22.08V12'/%3E%3C/svg%3E");
}

/* ===== page frame: soft pink glow under the header ===== */
.elementor-element.safy-product { background: linear-gradient(to bottom, var(--c-tint-pink) 0, rgba(253, 235, 242, 0) 260px); }
.elementor-element.safy-product-body { max-width: calc(var(--container) + var(--gutter) * 2); width: 100%; margin-inline: auto; padding: 0 var(--gutter) 56px; box-sizing: border-box; }
.elementor-element.safy-product-crumbs { max-width: calc(var(--container) + var(--gutter) * 2); width: 100%; margin-inline: auto; padding: 24px var(--gutter) 20px; box-sizing: border-box; }
.elementor-element.safy-product-crumbs .elementor-widget, .elementor-element.safy-product-crumbs .elementor-widget-container { margin: 0; padding: 0; }
.safy-crumbs, .safy-crumbs .woocommerce-breadcrumb { margin: 0; font-size: 14px; line-height: 24px; }

/* ===== summary card: gallery | buy box ===== */
.elementor-element.safy-summary { display: grid !important; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 36px; align-items: start; padding: 24px; background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--radius-l); box-shadow: var(--shadow-card); }
.elementor-element.safy-product-gallery, .elementor-element.safy-product-info { min-width: 0; width: auto !important; }
.elementor-element.safy-product-info { position: relative; }

/* gallery: main picture 3:2 with radius 14px; thumbnails only when there are several pictures */
.safy-product-images { position: relative; }
.safy-product-images .woocommerce-product-gallery { margin: 0 !important; width: 100% !important; }
.safy-product-images .woocommerce-product-gallery__wrapper { margin: 0 !important; }
.safy-product-images .woocommerce-product-gallery__image { overflow: hidden; border-radius: var(--radius-m); background: var(--c-bg-soft); }
.safy-product-images .woocommerce-product-gallery__image a { display: block; }
.safy-product-images .woocommerce-product-gallery__image img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius-m); }
.safy-product-images .flex-control-thumbs { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0 !important; padding: 0; }
.safy-product-images .flex-control-thumbs li { width: auto !important; margin: 0 !important; list-style: none; }
.safy-product-images .flex-control-thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 2px solid transparent; border-radius: 10px; opacity: 1; }
.safy-product-images .flex-control-thumbs img.flex-active, .safy-product-images .flex-control-thumbs img:hover { border-color: var(--c-primary); }
.safy-product-images .woocommerce-product-gallery__trigger { top: 14px; inset-inline-end: 14px; inset-inline-start: auto; width: 42px; height: 42px; border-radius: 50%; background: var(--c-white); box-shadow: var(--shadow-card); }
/* the magnifier stays under the side-cart drawer and the menu popup */
.woocommerce-product-gallery__trigger { z-index: 1 !important; }
@media (min-width: 1025px) { .elementor-element.safy-product-gallery { position: sticky; top: 24px; align-self: start; } }

/* ===== title block: name, rating, "sold" and "viewing now" lines (the lines come from the Manager Suite, placed after the title) ===== */
.elementor-widget.safy-product-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; }
.safy-product-title h1, .elementor-widget.safy-product-title .elementor-heading-title { font-size: 28px; font-weight: 700; line-height: 1.35; color: var(--c-ink); }
.elementor-widget.safy-product-title > .ocms-wcb-rating { flex: 0 0 100%; }
.safy-product-title > .ocms-wcb { display: inline-flex !important; flex: 0 1 auto; width: auto !important; margin: 0 !important; }
/* both lines get a white tick in a green circle; sold sits at the far right, viewing at the far left */
.safy-product-title .ocms-wcb--sold .ocms-wcb__dot, .safy-product-title .ocms-wcb--viewers .ocms-wcb__dot { width: 18px !important; height: 18px !important; border-radius: 50%; background: #16a34a url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%224%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%2012.5l4.5%204.5L19%207%22%2F%3E%3C%2Fsvg%3E") center / 11px no-repeat !important; }
.safy-product-rating { margin-top: 6px; font-size: 14px; color: var(--c-text-muted); }
.safy-product-text, .safy-product-text p { margin-top: 8px; color: var(--c-text-muted); line-height: 1.8; font-size: 14px; }

/* price: brand gradient text 30px, the small "من" muted (prototype .info__price). Number first, then the word (tokens.css) */
.safy-product-price { width: fit-content; margin-top: 4px !important; font-size: 30px !important; font-weight: 700; line-height: 1.3; }
.safy-product-price .price { display: flex; flex-direction: row; align-items: baseline; gap: 6px; direction: rtl; width: fit-content; margin: 0; padding-bottom: 2px; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; font-size: 30px !important; font-weight: 700; line-height: 1.3 !important; }
.safy-product-price .price .woocommerce-Price-amount { direction: ltr; unicode-bidi: isolate; }
.safy-product-price .price, .safy-product-price .price .woocommerce-Price-amount, .safy-product-price .price bdi, .safy-product-price .price .woocommerce-Price-currencySymbol { color: transparent !important; font-size: inherit; }
.safy-product-price .price del .woocommerce-Price-amount { color: var(--c-text-muted) !important; font-size: 18px; font-weight: 400; }
.safy-product-price .price ins { text-decoration: none; background: none; }
.safy-product-price .price .safy-price-from, .safy-product-price .price small, .safy-product-price .price .from { color: var(--c-text-muted) !important; font-size: 14px !important; font-weight: 400; }

/* ===== option boxes: ONE 14px step between every visible box; a hidden group takes no space ===== */
.safy-product-buy .spo { flex: 0 0 100%; width: 100%; order: -1; margin: 0 0 22px !important; }
.safy-product-buy .spo-var.spo { margin: 0 0 14px !important; }
.safy-product-buy .spo-var fieldset { margin: 0 !important; }
.safy-product-buy .spo-group, .safy-product-buy .spo-group > * { margin-block: 0; }
.safy-product-buy .spo-group:not([hidden]) { margin: 0 0 14px !important; }
.safy-product-buy .spo-group[hidden], .safy-product-buy fieldset[hidden], .safy-product-buy .spo-group[hidden] * { display: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
.safy-product-buy .spo-addons { margin: 0 !important; }
.safy-product-buy .spo .spo-total { margin-top: 10px; }
/* the note field: room above it and between its label and the box */
.safy-product-buy .spo-note { display: block; margin-top: 20px !important; }
.safy-product-buy .spo-note > span { display: block; margin-bottom: 10px !important; }

/* ===== buy box: options, then one row with the stepper and the button ===== */
.safy-product-buy form.cart { margin: 18px 0 0; }
.safy-product-buy .variations { margin-bottom: 0; }
.safy-product-buy .single_variation_wrap { display: flex; flex-wrap: wrap; width: 100%; }
.safy-product-buy .single_variation_wrap .woocommerce-variation.single_variation { min-height: 0 !important; margin: 0; }
.safy-product-buy .single_variation_wrap .woocommerce-variation.single_variation:empty { display: none !important; }
/* the chosen variation's price shows in the price line and inside the button, never between the options */
.safy-product-buy .woocommerce-variation-price, .safy-product-buy .woocommerce-variation-description, .safy-product-buy .woocommerce-variation-availability { display: none !important; }
.safy-product-buy .woocommerce-variation-add-to-cart.variations_button { display: flex; flex: 0 0 100%; flex-wrap: wrap !important; flex-direction: row-reverse; align-items: stretch; gap: 12px; width: 100%; margin-top: 0 !important; }
.safy-product-buy .woocommerce-variation-add-to-cart.variations_button > .quantity, .safy-product-buy .woocommerce-variation-add-to-cart.variations_button > .single_add_to_cart_button { order: 0; }
.safy-product-buy form.cart:not(.variations_form) { display: flex; flex-direction: row-reverse; align-items: stretch; flex-wrap: wrap !important; gap: 12px; margin-top: 22px; }
/* simple products with add-ons: the add-ons panel takes the whole first row, quantity + button share the next row */
.safy-product-buy form.cart:not(.variations_form) > .spo { flex: 0 0 100%; width: 100%; }
.safy-product-buy .quantity.safy-qty { min-height: 52px; }
.safy-product-buy .safy-qty button { width: 42px; font-size: 22px; }
.safy-product-buy .safy-qty input { width: 56px; font-size: 17px; }
/* add to cart: cart icon BEFORE the text, the total at the far end behind a thin divider (prototype .buy__btn / .buy__total) */
.safy-product-buy .single_add_to_cart_button { display: flex !important; flex: 1; flex-direction: row !important; align-items: center; justify-content: flex-start !important; gap: 10px; min-height: 52px; padding: 0 20px; font-size: 17px; }
.safy-product-buy .single_add_to_cart_button::before { content: ""; display: block !important; flex: none; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--ico-cart) center / contain no-repeat; mask: var(--ico-cart) center / contain no-repeat; }
.safy-product-buy .single_add_to_cart_button .safy-buy-total { display: inline-block; margin-inline-start: auto !important; padding-inline-start: 14px; border-inline-start: 1px solid rgba(255, 255, 255, .4); font-weight: 700; }
.safy-product-buy .single_add_to_cart_button .safy-buy-total[hidden] { display: none; }

/* delivery sentence (box = components.css) */
.safy-product-delivery { margin-top: 14px; }
.safy-product-delivery p { margin: 0; }
.safy-policy p { margin: 8px 0 0; color: var(--c-text-muted); }
.safy-policy .safy-delivery { margin: 0; }

/* ===== guarantee strip: four items, icon beside its sentence ===== */
.elementor-element.safy-guarantee { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 !important; margin-top: 24px; padding: 16px 0; background: linear-gradient(to right, var(--c-tint-purple), var(--c-tint-pink)); border-radius: var(--radius-m); }
.elementor-element.safy-g-item { display: flex !important; flex-wrap: nowrap !important; align-items: center; justify-content: center; gap: 12px; padding: 4px 12px; border-inline-start: 1px solid rgba(126, 34, 161, .16); }
.elementor-element.safy-g-item:first-child { border-inline-start: 0; }
.elementor-element.safy-g-item > .elementor-widget-container { display: block; }
.elementor-element.safy-g-item .elementor-widget { margin: 0; }
.elementor-element.safy-g-item > .safy-g-icowrap { flex: 0 0 auto; width: auto; }
.elementor-element.safy-g-item > .safy-g-text { flex: 1 1 0; min-width: 0; width: auto; }
.safy-g-ico { display: block; width: 30px; height: 30px; background: var(--c-primary); -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
.safy-g-truck .safy-g-ico { -webkit-mask-image: var(--ico-truck); mask-image: var(--ico-truck); }
.safy-g-shield .safy-g-ico { -webkit-mask-image: var(--ico-shield); mask-image: var(--ico-shield); }
.safy-g-award .safy-g-ico { -webkit-mask-image: var(--ico-award); mask-image: var(--ico-award); }
.safy-g-box .safy-g-ico { -webkit-mask-image: var(--ico-box); mask-image: var(--ico-box); }
.safy-g-text p { margin: 0; }
.safy-g-text b { display: block; font-size: 15px; color: var(--c-ink); }
.safy-g-text span { font-size: 13px; color: var(--c-text-muted); }

/* ===== tabs: plain text tabs, pink underline on the active one, no boxes (Woo's box styling is beaten with a stronger selector) ===== */
.elementor-element.safy-tabs { margin-top: 32px; }
.elementor-element.safy-tabs .woocommerce-tabs ul.tabs { display: flex; gap: 8px; margin: 0; padding: 0; border-bottom: 1px solid var(--c-line); overflow-x: auto; list-style: none; background: none; }
.elementor-element.safy-tabs .woocommerce-tabs ul.tabs::before, .elementor-element.safy-tabs .woocommerce-tabs ul.tabs::after { display: none !important; }
.elementor-element.safy-tabs .woocommerce-tabs ul.tabs li { flex: none; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; }
.elementor-element.safy-tabs .woocommerce-tabs ul.tabs li::before, .elementor-element.safy-tabs .woocommerce-tabs ul.tabs li::after { display: none !important; }
.elementor-element.safy-tabs .woocommerce-tabs ul.tabs li a { display: block; padding: 12px 22px; border: 0 !important; border-bottom: 3px solid transparent !important; background: none !important; font-size: 16px; font-weight: 500; color: var(--c-text-muted) !important; }
.elementor-element.safy-tabs .woocommerce-tabs ul.tabs li a:hover { color: var(--c-primary) !important; }
.elementor-element.safy-tabs .woocommerce-tabs ul.tabs li.active a { color: var(--c-primary) !important; font-weight: 700; border-bottom-color: var(--c-primary) !important; }
.elementor-element.safy-tabs .woocommerce-tabs .woocommerce-Tabs-panel { margin: 18px 0 0; padding: 0; background: none; border: 0; line-height: 1.9; color: var(--c-ink); font-style: normal; }
.elementor-element.safy-tabs .woocommerce-Tabs-panel > h2 { font-size: 20px; font-weight: 700; margin: 0 0 12px; color: var(--c-ink); }
.elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes { width: 100%; border: 1px solid var(--c-line); border-radius: 8px; border-collapse: separate; border-spacing: 0; background: none; font-style: normal; overflow: hidden; }
.elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes th, .elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes td { padding: 10px 14px; border: 0; border-bottom: 1px solid var(--c-line); background: none !important; font-style: normal; color: var(--c-ink); text-align: start; }
.elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes tr:last-child th, .elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes tr:last-child td { border-bottom: 0; }
.elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes th { width: 30%; font-weight: 700; }
.elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes p { margin: 0; font-style: normal; }

/* ===== related products: the shop card look, 4 columns; stars only (no number); title with the glowing divider (prototype .sec-title) ===== */
.elementor-element.safy-related { margin-top: 56px; }
.safy-related__grid { position: relative; }
.safy-related__grid h2:not(.woocommerce-loop-product__title) { position: relative; font-size: 28px; font-weight: 700; line-height: 1.3; text-align: center; color: var(--c-ink); margin: 0 0 28px; padding-bottom: 22px; }
.safy-related__grid h2:not(.woocommerce-loop-product__title)::before { content: ""; position: absolute; left: 50%; bottom: 6px; width: 220px; height: 2px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, var(--c-purple) 28%, var(--c-primary) 72%, transparent); opacity: .7; }
.safy-related__grid h2:not(.woocommerce-loop-product__title)::after { content: ""; position: absolute; left: 50%; bottom: 1px; width: 10px; height: 10px; border-radius: 50%; background: var(--grad-brand); transform: translateX(-50%); box-shadow: 0 0 0 4px rgba(227, 35, 104, .16), 0 0 0 9px rgba(126, 34, 161, .08), 0 0 14px 2px rgba(227, 35, 104, .5); }
.elementor .elementor-element.safy-related ul.products { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.elementor .elementor-element.safy-related ul.products li.product { width: 100% !important; min-width: 0; }
.safy-related li.product .woocommerce-LoopProduct-link { align-items: stretch; }
.safy-related li.product .star-rating { align-self: center; margin-inline: auto; }

/* ===== desktop (768+): the price shares the title's row, on the opposite side; a long name wraps before it ===== */
@media (min-width: 768px) {
  .safy-product-price { position: absolute !important; top: 4px; inset-inline-end: 0; margin: 0 !important; }
  .elementor-widget.safy-product-title .elementor-heading-title { box-sizing: border-box; padding-inline-end: 150px !important; flex: 0 0 100%; }
}

/* ===== tablet ===== */
@media (max-width: 1024px) {
  .elementor-element.safy-summary { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 24px; }
  .elementor-element.safy-guarantee { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .elementor-element.safy-g-item:nth-child(odd) { border-inline-start: 0; }
  .elementor .elementor-element.safy-related ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== phone ===== */
@media (max-width: 767px) {
  .elementor-element.safy-product-body { padding: 0 var(--gutter) 40px; }
  .elementor-element.safy-product-crumbs { padding: 16px var(--gutter) 16px; }
  /* the product name sits alone on the last line of the breadcrumb */
  .safy-product-crumbs .woocommerce-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; }
  .safy-product-crumbs .woocommerce-breadcrumb .safy-crumb-sep:last-of-type { flex: 0 0 100%; height: 0; overflow: hidden; visibility: hidden; }
  /* order in the info column: name, price, rating, then the two lines (display:contents lets the price sit between the title's parts) */
  .elementor-element.safy-product-info { display: flex; flex-direction: row !important; flex-wrap: wrap; align-items: center; column-gap: 20px; row-gap: 6px; }
  .elementor-element.safy-product-info > * { flex: 0 0 100%; width: 100%; order: 10; }
  .elementor-widget.safy-product-title { display: contents; }
  .safy-product-title h1, .elementor-widget.safy-product-title .elementor-heading-title { order: 1; flex: 0 0 100%; font-size: 21px !important; line-height: 1.4; }
  .safy-product-price { order: 2 !important; margin: 0 !important; }
  .safy-product-price, .safy-product-price .price { font-size: 21px !important; }
  .safy-product-title > .ocms-wcb-rating { order: 3; flex: 0 0 100%; }
  .safy-product-title > .ocms-wcb { order: 4; flex: 0 1 auto !important; width: auto !important; }
  /* quantity: slim and as wide as the page */
  .safy-product-buy .quantity.safy-qty { flex: 1 1 100% !important; width: 100%; min-height: 44px; height: 44px; }
  .safy-product-buy .safy-qty button { flex: 0 0 56px; width: 56px; height: 44px; }
  .safy-product-buy .safy-qty input { flex: 1 1 auto; width: auto; min-height: 0; height: 44px; }
  /* guarantee strip: one column, the icon beside its text */
  .elementor-element.safy-guarantee { grid-template-columns: minmax(0, 1fr); }
  .elementor-element.safy-g-item { flex-direction: row !important; align-items: center !important; justify-content: flex-start !important; padding-inline: 16px; border-inline-start: 0; }
  /* tabs */
  .elementor-element.safy-tabs .woocommerce-tabs ul.tabs { flex-wrap: wrap; overflow: visible; row-gap: 0; }
  .elementor-element.safy-tabs .woocommerce-tabs ul.tabs li a { padding: 10px 12px; font-size: 15px; line-height: 1.5; }
  .woocommerce div.product.elementor .woocommerce-tabs .panel, .elementor-element.safy-tabs .woocommerce-Tabs-panel { padding-bottom: 0 !important; }
  .elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes th { width: 100%; padding: 12px 14px 0 !important; border-bottom: 0 !important; }
  .elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes td { padding: 4px 14px 12px !important; }
  .elementor-element.safy-tabs .woocommerce-Tabs-panel table.shop_attributes tr:last-child td { border-bottom: 0 !important; }
  /* related products: two columns, 8px gaps, cards that breathe */
  .elementor-element.safy-related { margin-top: 24px; }
  .safy-related__grid h2:not(.woocommerce-loop-product__title) { font-size: 24px; margin-bottom: 20px; }
  .elementor .elementor-element.safy-related ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px !important; row-gap: 8px !important; }
  .elementor .elementor-element.safy-related ul.products li.product { margin: 0 !important; padding: 10px 10px 12px !important; }
  .elementor .elementor-element.safy-related ul.products li.product .woocommerce-loop-product__title { min-height: 0; margin-top: 12px !important; line-height: 1.4; }
  .safy-related li.product .star-rating { margin: 8px auto 0 !important; }
  .elementor .elementor-element.safy-related ul.products li.product .price { margin: 8px 0 12px !important; }
  .safy-related .ocms-wcb-rating { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 8px; text-align: center; }
}
