/* Affiliate product detail page (PDP)
   Soft green panels aligned with od-dash / aff-card.
   Gallery class names must stay stable for product.php JS. */

.product-page {
  padding: 12px 0 100px;
  background: transparent;
}

.product-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 15px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Hide legacy SHEIN bar — ecommerce-header is the nav */
.product-header {
  display: none !important;
}

/* ── Gallery (mobile first) ─────────────────────────────────────────── */

.product-images-container {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-color, #d1fae5);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(16, 40, 24, 0.05);
}

.product-thumbnails {
  display: none;
}

.product-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
}

.product-slides {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.product-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: #fff;
}

.product-slide-img-zoom {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-slide img,
.product-slide-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  cursor: pointer;
  transition: transform 0.2s ease;
}

@media (max-width: 991px) {
  .product-page .product-images-container {
    max-width: 100%;
  }

  .product-slide img:hover {
    transform: scale(1.02);
  }
}

.product-slide img[data-src] {
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  background: linear-gradient(90deg, #f0faf4 25%, #e8f5ee 50%, #f0faf4 75%);
  background-size: 200% 100%;
  animation: pdp-shimmer 1.5s infinite;
}

@keyframes pdp-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.product-slide img:not([data-src]) {
  opacity: 1;
}

.slide-counter {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(22, 163, 74, 0.85);
  color: #fff;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.product-download-images-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  transition: background 0.2s ease, transform 0.2s ease;
}

.product-download-images-btn:hover,
.product-download-images-btn:focus {
  background: rgba(22, 163, 74, 0.95);
  color: #fff;
  transform: translateY(-1px);
}

.product-download-images-btn i {
  font-size: 0.85rem;
}

.product-slider--empty .store-no-image--hero {
  border-radius: 12px;
  width: 100%;
  height: 100%;
}

/* ── Details panel ──────────────────────────────────────────────────── */

.product-details,
.pdp-panel {
  background: #fff;
  border: 1px solid var(--border-color, #d1fae5);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(16, 40, 24, 0.05);
  padding: 18px 16px;
}

.pdp-title {
  margin: 0 0 12px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.45;
  color: var(--text-color, #1a2e22);
}

.pdp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pdp-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--light-gray, #f0faf4);
  color: var(--dark-gray, #4b5563);
  border: 1px solid var(--border-color, #d1fae5);
  text-decoration: none;
}

.pdp-meta-chip--link,
a.pdp-meta-chip {
  color: var(--primary-color, #16a34a);
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.pdp-meta-chip--link:hover,
a.pdp-meta-chip:hover {
  background: #d1fae5;
  color: var(--primary-dark, #15803d);
}

/* ── Pricing (aff-card style) ───────────────────────────────────────── */

.pdp-pricing {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  margin-bottom: 16px;
  background: var(--light-gray, #f0faf4);
  border: 1px dashed var(--border-color, #d1fae5);
  border-radius: 12px;
}

.pdp-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pdp-price-lbl {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark-gray, #4b5563);
}

.pdp-price-val {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 800;
  color: var(--text-color, #1a2e22);
  white-space: nowrap;
}

.pdp-price-row--mine .pdp-price-amount {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--primary-color, #16a34a) !important;
}

.pdp-price-old {
  font-size: 0.85rem;
  color: var(--dark-gray, #6b7280);
  text-decoration: line-through;
  opacity: 0.8;
  font-weight: 600;
}

.pdp-price-unit {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dark-gray, #6b7280);
}

.pdp-price-row--suggested .pdp-price-amount {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-color, #1a2e22);
}

.pdp-profit {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary-dark, #15803d);
  background: #fff;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 4px 10px;
}

/* Legacy price blocks unused in redesigned markup */
.product-price-mobile,
.product-price-desktop {
  display: none !important;
}

/* ── Specs / description panels ─────────────────────────────────────── */

.pdp-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color, #d1fae5);
}

.pdp-section-title,
.description-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--text-color, #1a2e22);
}

.product-specs-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-spec-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid rgba(22, 163, 74, 0.08);
}

.product-spec-row:last-child {
  border-bottom: none;
}

.product-spec-row dt {
  margin: 0;
  min-width: 100px;
  color: var(--dark-gray, #6b7280);
  font-size: 0.88rem;
  font-weight: 600;
}

.product-spec-row dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-color, #1a2e22);
  font-weight: 700;
}

.description-content {
  color: var(--dark-gray, #4b5563);
  line-height: 1.7;
  font-size: 0.92rem;
}

/* ── Variants & qty ─────────────────────────────────────────────────── */

.product-power-select-wrap,
.product-general-qty-wrap {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color, #d1fae5);
}

.product-lens-pair-hint {
  margin: 6px 0 10px;
  font-size: 0.88rem;
  color: var(--dark-gray, #6b7280);
  line-height: 1.55;
}

.product-lens-pair-fields,
.product-prescription-per-eye-qty {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pdp-field {
  flex: 1 1 140px;
  min-width: 0;
}

.pdp-field label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--text-color, #1a2e22);
}

.product-variant-select {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #d1fae5);
  border-radius: 10px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text-color, #1a2e22);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.product-variant-select:focus {
  outline: none;
  border-color: var(--primary-color, #16a34a);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.product-cosmetic-qty {
  margin-top: 12px;
}

.product-out-of-stock-msg {
  margin-top: 16px;
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  color: #92400e;
  font-weight: 700;
  font-size: 0.92rem;
}

/* ── Desktop actions ────────────────────────────────────────────────── */

.desktop-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  width: 100%;
}

.desktop-actions .desktop-wishlist-btn,
.desktop-actions .product-wishlist {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 52px !important;
  height: 52px !important;
  border: 1px solid var(--border-color, #d1fae5);
  border-radius: 12px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: #fff;
  color: var(--dark-gray, #4b5563);
  cursor: pointer;
  visibility: visible !important;
  opacity: 1 !important;
  transition: all 0.25s ease;
  flex-shrink: 0;
  z-index: 1 !important;
}

.desktop-actions .desktop-wishlist-btn:hover,
.desktop-actions .product-wishlist:hover,
.desktop-actions .desktop-wishlist-btn.wishlist-active,
.desktop-actions .product-wishlist.wishlist-active {
  background: #fff5f5;
  border-color: #fecaca;
  color: #ef4444;
}

.desktop-actions .desktop-wishlist-btn.wishlist-active i.fas,
.desktop-actions .product-wishlist.wishlist-active i.fas {
  color: #ef4444 !important;
}

.desktop-actions .add-to-cart-btn,
button.add-to-cart-btn.related.product-page-add-to-cart {
  flex: 1;
  height: 52px;
  background: var(--primary-color, #16a34a) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  margin: 0 !important;
  padding: 0 20px !important;
}

.desktop-actions .add-to-cart-btn:hover:not(:disabled) {
  background: var(--primary-dark, #15803d) !important;
}

.desktop-actions .add-to-cart-btn:disabled {
  background: #e5e7eb !important;
  color: #9ca3af !important;
  cursor: not-allowed;
}

/* ── Technical specs block ──────────────────────────────────────────── */

.product-profile-specs-wrap {
  max-width: var(--container-width, 90%);
  margin: 0 auto 24px;
  padding: 0 15px;
  box-sizing: border-box;
}

.product-profile-specs-inner {
  border: 1px solid var(--border-color, #d1fae5);
  border-radius: 14px;
  padding: 16px 18px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 40, 24, 0.05);
}

.product-profile-specs-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--text-color, #1a2e22);
}

.product-profile-specs-dl {
  margin: 0;
  padding: 0;
}

.product-profile-specs-row {
  display: grid;
  grid-template-columns: minmax(110px, 170px) 1fr;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(22, 163, 74, 0.1);
  align-items: baseline;
}

.product-profile-specs-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.product-profile-specs-dt {
  margin: 0;
  font-size: 0.9rem;
  color: var(--dark-gray, #6b7280);
  font-weight: 600;
}

.product-profile-specs-dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-color, #1a2e22);
  font-weight: 700;
}

@media (max-width: 576px) {
  .product-profile-specs-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ── Related products ───────────────────────────────────────────────── */

.related-products {
  max-width: var(--container-width, 90%);
  margin: 28px auto;
  padding: 0 15px 80px;
  box-sizing: border-box;
}

.related-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text-color, #1a2e22);
  display: flex;
  align-items: center;
  gap: 8px;
}

.related-title i {
  color: var(--primary-color, #16a34a);
  font-size: 1rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ── Mobile sticky ATC ──────────────────────────────────────────────── */

.add-to-cart-section {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 12px 15px;
  box-shadow: 0 -4px 20px rgba(16, 40, 24, 0.1);
  border-top: 1px solid var(--border-color, #d1fae5);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  z-index: 100;
}

.add-to-cart-section .wishlist-btn,
.add-to-cart-section .product-wishlist {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 48px !important;
  height: 48px !important;
  border: 1px solid var(--border-color, #d1fae5);
  border-radius: 12px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: #fff;
  color: var(--dark-gray, #4b5563);
  cursor: pointer;
  visibility: visible !important;
  opacity: 1 !important;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.add-to-cart-section .wishlist-btn:hover,
.add-to-cart-section .product-wishlist:hover,
.add-to-cart-section .wishlist-btn.wishlist-active,
.add-to-cart-section .product-wishlist.wishlist-active {
  background: #fff5f5;
  border-color: #fecaca;
  color: #ef4444;
}

.add-to-cart-section .wishlist-btn.wishlist-active i.fas,
.add-to-cart-section .product-wishlist.wishlist-active i.fas {
  color: #ef4444 !important;
}

.add-to-cart-section .add-to-cart-btn {
  flex: 1;
  height: 48px;
  background: var(--primary-color, #16a34a) !important;
  color: #fff !important;
  border-radius: 12px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.98rem;
  border: none !important;
  cursor: pointer;
}

.add-to-cart-section .add-to-cart-btn:disabled {
  background: #e5e7eb !important;
  color: #9ca3af !important;
  cursor: not-allowed;
}

/* Floating cart sits above sticky bar on mobile */
@media (max-width: 991px) {
  .product-page ~ .floating-cart,
  body > .floating-cart {
    bottom: 80px;
  }
}

/* ── Image modal ────────────────────────────────────────────────────── */

.image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
  cursor: pointer;
}

.image-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.image-modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 100px;
  box-sizing: border-box;
  pointer-events: none;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.image-modal-close,
.image-modal-download {
  position: fixed;
  top: 15px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: all 0.25s ease;
  color: #333;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.image-modal-close {
  right: 15px;
}

.image-modal-download {
  left: 15px;
}

.image-modal-close:active,
.image-modal-download:active {
  transform: scale(0.95);
}

.image-modal-download span {
  display: none;
}

/* ── Desktop layout ─────────────────────────────────────────────────── */

@media (min-width: 992px) {
  .product-page {
    padding: 28px 0 50px;
  }

  .product-container {
    max-width: var(--container-width, 90%);
    margin: 0 auto 28px;
    padding: 0 15px;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 28px;
    align-items: start;
  }

  .product-images-container {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 16px;
    align-items: start;
    padding: 14px;
    overflow: visible;
  }

  .product-images-container--no-images {
    grid-template-columns: 1fr;
  }

  .product-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100px;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-left: 4px;
    scrollbar-width: thin;
    scrollbar-color: #86efac #f0faf4;
  }

  .product-thumbnails::-webkit-scrollbar {
    width: 5px;
  }

  .product-thumbnails::-webkit-scrollbar-track {
    background: #f0faf4;
    border-radius: 10px;
  }

  .product-thumbnails::-webkit-scrollbar-thumb {
    background: #86efac;
    border-radius: 10px;
  }

  .product-thumbnail {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fff;
    box-shadow: 0 1px 3px rgba(16, 40, 24, 0.08);
  }

  .product-thumbnail:hover {
    transform: translateY(-2px);
    border-color: #bbf7d0;
  }

  .product-thumbnail.active {
    border-color: var(--primary-color, #16a34a);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
  }

  .product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    transition: transform 0.3s ease;
  }

  .product-thumbnail:hover img {
    transform: scale(1.05);
  }

  .product-slider {
    aspect-ratio: auto;
    height: 480px;
    min-height: 480px;
    max-height: 480px;
    border-radius: 12px;
    border: 1px solid var(--border-color, #d1fae5);
  }

  .product-slide {
    padding: 24px;
  }

  .product-slide-img-zoom {
    overflow: hidden;
  }

  .product-slide img {
    cursor: zoom-in;
    transition: transform 0.15s ease-out, transform-origin 0.12s ease-out;
  }

  .product-slide .product-slide-img.is-zooming {
    transform: scale(2.35);
    cursor: crosshair;
  }

  .product-details,
  .pdp-panel {
    padding: 22px 20px;
    position: sticky;
    top: 90px;
  }

  .pdp-title {
    font-size: 1.55rem;
  }

  .related-products {
    padding-bottom: 0;
  }

  .related-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .add-to-cart-section {
    display: none;
  }

  .floating-cart {
    display: none;
  }

  .image-modal-content {
    height: auto;
    padding: 20px;
  }

  .image-modal-close,
  .image-modal-download {
    position: absolute;
    top: 20px;
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .image-modal-close {
    right: 20px;
  }

  .image-modal-download {
    left: 20px;
  }

  .image-modal-close:hover,
  .image-modal-download:hover {
    background: #fff;
    transform: scale(1.08);
  }
}

@media (min-width: 1200px) {
  .related-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
