/* breadcrumbs */
.breadcrumbs {
  margin-bottom: var(--space-4);
  padding: 0;
  max-width: 100%;
  

}

.breadcrumb-item-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* Space between icon and text */
  text-decoration: none;
  color: var(--text-secondary);
  min-width: 0;
  
}



.label-small {
  font-family: var(--font-primary);
  font-weight: var(--font-medium);
  line-height: var(--space-9);
  letter-spacing: -0.006em;
  color: var(--text-secondary);
  font-style: normal;
  text-decoration: none;
  white-space: normal;
}

.arrow {
  /* padding: 20px 20px;*/
  font-weight: var(--font-medium);
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
}

.current {
  letter-spacing: -0.006em;
  line-height: var(--space-9);
  color: var(--text-primary) !important;
  white-space: normal;

}

/* One line: the links keep their width, the product name (last) shrinks
   with "…" when the row runs out of room. */
.breadcrumb-nav {
  align-items: center;
  min-width: 0;
}

.breadcrumb-nav > a,
.breadcrumb-nav > img {
  flex-shrink: 0;
  white-space: nowrap;
}

.breadcrumb-nav > .current {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 576px) {
  .breadcrumb-nav,
  .breadcrumb-nav .label-small {
    font-size: 12px;
  }

  .breadcrumb-nav > img {
    width: 12px;
    height: 12px;
  }
}


/* Container & Main Layout */


.product-main-container {

  /* height: 400px !important;
  width: 1009px !important; */
  width: 100%;
  max-width: 100%;
  min-height: 400px;

}

.product-image-box {

  background-color: white;
  border: 1px solid var(--border-primary);
  height: 100%;
  /* Ensures space on mobile */
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 20px 20px;
  /* Desktop: Rounded on right (RTL) */
}

.product-image-box img {
  object-fit: contain;
  padding: 0;
}

/* Details Section */
.product-title {
  margin-bottom: var(--space-4) !important;
  line-height: 32px;
}


/* Weight Cards Row */
.weight-options-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;

  scrollbar-width: none;
  -ms-overflow-style: none;
}

.weight-options-row::-webkit-scrollbar {
  display: none;
}

/* Show a visible scrollbar on wider screens, but only when there are
   more than 2 weight options (see .weight-options-row--scrollable in
   product.html) - with 1-2 items there's nothing to scroll to anyway.
   Scrolling is mouse/trackpad-driven here rather than touch, so it's
   worth surfacing that there's more; below this breakpoint it stays
   hidden (touch swipe is enough). */
@media (min-width: 1000px) {
  .weight-options-row--scrollable {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-secondary);
    -ms-overflow-style: auto;
  }

  .weight-options-row--scrollable::-webkit-scrollbar {
    display: block;
    height: 6px;
  }

  .weight-options-row--scrollable::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 999px;
  }

  .weight-options-row--scrollable::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 999px;
  }
}

.weight-item {
  border: 1px solid var(--border-secondary);
  border-radius: 10px 10px 0px 0px;
  flex: 0 0 auto;
  min-width: 140px;
  transition: 0.3s;
  border-color: #A54B51;
  cursor: pointer;
}

.weight-header {
  padding-block: 8px;
  text-align: center;
  line-height: 16px;
  color: var(--border-primary);
  background-color: #A54B51;
  border-radius: 10px 10px 0px 0px;
}

.weight-item.active {
  border-color: var(--primary);
}


.weight-item.active .weight-header {
  background-color: var(--primary);
}

.weight-body {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  text-align: right;
}

.value-unit-pair .unit {
  color: var(--text-secondary);
  font-size: 11px;
}

.actions-container {
  display: flex;
  justify-content: center;
  align-content: center;
  gap: 1px;

}

.qty-btn {
  border: var(--primary) 1px solid;
  border-radius: 2px 16px;
  width: 40px;
  height: 40px;
  display: inline-block;
  background: none;
  font-size: 1.2rem;
  color: var(--primary);
  padding: 0 10px;
}

.qty-val{
  width: 20px !important;
}

.btn-add-cart {
  background-color: var(--button);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 2px 16px;
  width: 100%;
}

.btn-add-cart {
  transition: background-color 0.2s ease;
}

/* "تمت الإضافة إلى السلة" feedback state - see showAddedFeedback() */
.btn-add-cart.is-added {
  background-color: #1f9d55;
}

/* Total (price x quantity) */
.product-total-box {
  background-color: var(--bg-secondary);
  border-radius: 2px 16px;
  padding: 12px 16px;
}

.product-total-label {
  color: var(--text-secondary);
}

.product-total-value {
  color: var(--primary);
  font-size: 18px;
}


/* Description (beside the image, under the total) */
.product-description {
  text-align: start;
  border-top: 1px solid var(--border-primary);
  padding-top: var(--space-4);
}

.product-description-title {
  margin-bottom: 8px;
}

.description-content {
  color: var(--text-secondary);
  line-height: 1.8;
}

.description-content p:last-child {
  margin-bottom: 0;
}

/* Structured plain-text descriptions (products/templatetags/product_text.py) */
.description-content p {
  margin-bottom: var(--space-3);
}

.description-content ul {
  margin: 0 0 var(--space-3);
  padding-inline-start: 1.25rem;
}

.description-content li + li {
  margin-top: 2px;
}

.description-content .description-subtitle {
  font-size: 15px;
  font-weight: var(--font-semibold, 600);
  color: var(--text-dark);
  margin: var(--space-4) 0 var(--space-1);
}

.description-content > :first-child {
  margin-top: 0;
}

/* "المزيد": collapsed to 3 lines (line-height 1.8) with a fade on the last one */
.description-content.is-collapsed {
  max-height: 5.4em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
}

.description-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-2);
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size: 14px;
  font-weight: var(--font-medium, 500);
  cursor: pointer;
}

.description-toggle[hidden] {
  display: none;
}

.description-toggle i {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.description-toggle.is-expanded i {
  transform: rotate(180deg);
}

.description-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Short description - first paragraph of the description */
.description-content .product-short-description {
  color: var(--text-dark);
}

/* Nutrition table + FAQ (below the main card, only when filled in) */
.product-info-sections {
  max-width: 1009px;
  margin-top: var(--space-6);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--space-6);
  align-items: start;
}

.product-info-section {
  min-width: 0;
}

.product-info-section .product-extra-title {
  margin-bottom: var(--space-3);
}

.product-info-note {
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.nutrition-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.nutrition-table th,
.nutrition-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-primary);
  text-align: start;
}

.nutrition-table tr:last-child th,
.nutrition-table tr:last-child td {
  border-bottom: 0;
}

.nutrition-table th {
  font-weight: var(--font-medium, 500);
  color: var(--text-dark);
  background: var(--bg-weak);
  width: 55%;
}

.nutrition-table td {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.product-faq-list {
  display: grid;
  gap: var(--space-2);
}

.product-faq {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-white);
}

.product-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  color: var(--text-dark);
}

.product-faq summary::-webkit-details-marker {
  display: none;
}

.product-faq summary i {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.product-faq[open] summary i {
  transform: rotate(180deg);
}

.product-faq summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

.product-faq p {
  padding: 0 14px 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

@media (prefers-reduced-motion: reduce) {
  .description-toggle i,
  .product-faq summary i {
    transition: none;
  }
}

@media (max-width: 888px) {
  .right-col,
  .left-col,
  .product-image-box {
    width: 100% !important;
    max-width: 100%;
  }

  .btn-add-cart {
    font-size: 12px;
  }

  .unit {
    font-size: 10px;
  }
}

@media (max-width:790px) {
  .product-main-container {
    width: 100%;
    max-width: 100%;
    min-height: auto;
  }

  .buying-section {
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    column-gap: 20px;
    text-align: center;
  }

  .right-col {
    width: 100% !important;
    margin: auto;
    display: flex;
    justify-content: center;
  }

  .left-col {
    margin-top: var(--space-4);
    width: 100% !important;
  }
  .label-small  {
    font-size: 12px;
  }
  
  .product-title{
    font-size: 18px;
  }
}

/* Product image gallery: one scroll-snap slide per image, every slide the
   same square box so images of different sizes line up identically. The
   frame wraps only the image; arrows + thumbnails sit below it so nothing
   covers the picture. */
.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-gallery-viewport {
  overflow: hidden;
}

.product-gallery-track,
.product-extra-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.product-gallery-track {
  width: 100%;
}

.product-gallery-track::-webkit-scrollbar,
.product-extra-track::-webkit-scrollbar {
  display: none;
}

.product-gallery-slide {
  flex: 0 0 100%;
  aspect-ratio: 1 / 1;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-gallery-viewport {
  position: relative;
}

/* prev/next sit on the image's side edges, small and translucent */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.carousel-arrow--prev {
  right: 10px;
}

.carousel-arrow--next {
  left: 10px;
}

.carousel-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

.carousel-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* centered via auto margins on the end thumbs (not justify-content), so a
   row too long to fit still scrolls from its first thumbnail */
.product-gallery-thumb:first-child {
  margin-inline-start: auto;
}

.product-gallery-thumb:last-child {
  margin-inline-end: auto;
}

.product-gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.product-gallery-thumbs::-webkit-scrollbar {
  display: none;
}

.product-gallery-thumb {
  flex: 0 0 64px;
  height: 64px;
  padding: 2px;
  border: 2px solid var(--border-primary);
  border-radius: 10px;
  background: white;
  opacity: 0.7;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.product-gallery-thumb.active {
  border-color: var(--primary);
  opacity: 1;
}

.product-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Sections below the product: customer reviews + related products */
.product-extra-section {
  max-width: 1009px;
  margin-top: var(--space-6);
}

.product-extra-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.product-extra-title {
  margin: 0;
}

.product-extra-nav {
  display: flex;
  gap: 8px;
}

.product-extra-section.is-static .product-extra-nav {
  display: none;
}

.carousel-nav-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  background: white;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-extra-track {
  gap: 16px;
  padding-bottom: 8px;
}

.review-image-item {
  flex: 0 0 calc((100% - 3 * 16px) / 4);
  aspect-ratio: 3 / 4;
  scroll-snap-align: start;
  padding: 0;
  border: 1px solid var(--border-primary);
  border-radius: 4px 16px 4px 16px;
  overflow: hidden;
  background: var(--bg-secondary);
  cursor: zoom-in;
}

.review-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-image-modal-content {
  position: relative;
  background: transparent;
  border: none;
}

.review-image-modal-img {
  width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
}

.review-image-modal-close {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: white;
  border-radius: 50%;
  padding: 8px;
  opacity: 1;
  z-index: 1;
}

.related-product-item {
  flex: 0 0 calc((100% - 3 * 16px) / 4);
  scroll-snap-align: start;
  min-width: 0;
}

@media (max-width: 992px) {
  .review-image-item,
  .related-product-item {
    flex-basis: calc((100% - 2 * 16px) / 3);
  }
}

@media (max-width: 768px) {
  .review-image-item,
  .related-product-item {
    flex-basis: calc((100% - 16px) / 2);
  }

  .product-extra-section {
    margin-top: var(--space-4);
  }
}

@media (max-width: 576px) {
  .review-image-item {
    flex-basis: 75%;
  }

  .related-product-item {
    flex-basis: 60%;
  }

  .product-extra-track {
    gap: 12px;
  }

  .product-gallery-thumb {
    flex-basis: 52px;
    height: 52px;
  }

  .carousel-nav-btn {
    width: 34px;
    height: 34px;
  }
}

/* Sticky buy bar - shown (.is-visible) once the main buy box scrolls out of
   view; see the IntersectionObserver in product.html */
:root {
  --sticky-buy-height: 76px;
}

.sticky-buy-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1020;
  background: white;
  border-top: 1px solid var(--border-primary);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(110%);
  transition: transform 0.3s ease;
}

.sticky-buy-bar.is-visible {
  transform: translateY(0);
}

.sticky-buy-inner {
  max-width: 1200px;
  min-height: var(--sticky-buy-height);
  margin: 0 auto;
  padding: 10px var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.sticky-buy-product {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sticky-buy-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  background: white;
  flex-shrink: 0;
}

.sticky-buy-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sticky-buy-title {
  font-weight: var(--font-medium);
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-buy-price {
  color: var(--primary);
  font-weight: var(--font-medium);
  white-space: nowrap;
}

.sticky-buy-option {
  color: var(--text-secondary);
  font-weight: normal;
}

.sticky-buy-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sticky-buy-qty {
  gap: 6px;
}

.sticky-buy-qty .qty-btn {
  width: 36px;
  height: 36px;
  font-size: 1rem;
}

.sticky-buy-qty .qty-val {
  text-align: center;
}

.sticky-buy-add {
  width: auto;
  min-width: 150px;
  padding: 10px 20px;
  white-space: nowrap;
}

.sticky-buy-now {
  padding: 9px 20px;
  border: 1px solid var(--primary);
  border-radius: 2px 16px;
  background: white;
  color: var(--primary);
  font-size: 14px;
  font-weight: var(--font-medium);
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.sticky-buy-now:hover {
  background-color: var(--bg-primary);
}

.sticky-buy-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* keep the footer and the WhatsApp button clear of the bar */
body.has-sticky-buy {
  padding-bottom: var(--sticky-buy-height);
}

.whatsapp-float {
  transition: bottom 0.3s ease, transform 0.2s ease;
}

body.has-sticky-buy .whatsapp-float {
  bottom: calc(var(--sticky-buy-height) + 12px + env(safe-area-inset-bottom));
}

@media (prefers-reduced-motion: reduce) {
  .sticky-buy-bar,
  .whatsapp-float {
    transition: none;
  }
}

@media (max-width: 768px) {
  :root {
    --sticky-buy-height: 64px;
  }

  .sticky-buy-inner {
    padding: 8px 12px;
    gap: 8px;
  }

  .sticky-buy-thumb,
  .sticky-buy-title,
  .sticky-buy-option {
    display: none;
  }

  .sticky-buy-price {
    font-size: 14px;
  }

  .sticky-buy-actions {
    flex: 1;
    justify-content: flex-end;
    gap: 6px;
  }

  .sticky-buy-qty .qty-btn {
    width: 30px;
    height: 30px;
  }

  .sticky-buy-add {
    min-width: 0;
    padding: 8px 12px;
    font-size: 12px;
  }

  .sticky-buy-now {
    padding: 7px 12px;
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  /* very narrow phones: drop the price (the main box shows the total) so
     the stepper and both buttons still fit on one line */
  .sticky-buy-product {
    display: none;
  }
}
