/* ============================================
   PRODUCT CARD — COMMON STYLES
   ============================================ */
.product-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.product-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.product-card-link:hover {
  color: inherit;
}

.product-card-link-title {
  display: block;
  text-decoration: none;
  color: inherit;
}

.product-card-link-image {
  display: block;
  height: 100%;
}

.product-card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background-color: var(--color-surface); /* Light background for contrast */
  border-radius: var(--radius-lg);
}

.product-card-image img {
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.product-card:hover .product-card-image img {
  transform: scale(1.04);
}

[data-product-image-fit] .product-card .product-card-image .product-card-link-image img,
[data-product-image-fit] .product-card .product-card-image .product-img-hover {
  width: 100%;
  height: 100%;
}

/* Cover (default) */
[data-product-image-fit="cover"] .product-card .product-card-image .product-card-link-image img,
[data-product-image-fit="cover"] .product-card .product-card-image .product-img-hover {
  object-fit: cover;
  object-position: center;
}

/* Cover, focus top */
[data-product-image-fit="cover-top"] .product-card .product-card-image .product-card-link-image img,
[data-product-image-fit="cover-top"] .product-card .product-card-image .product-img-hover {
  object-fit: cover;
  object-position: top center;
}

/* Cover, focus bottom */
[data-product-image-fit="cover-bottom"] .product-card .product-card-image .product-card-link-image img,
[data-product-image-fit="cover-bottom"] .product-card .product-card-image .product-img-hover {
  object-fit: cover;
  object-position: bottom center;
}

/* Contain — fit whole image, no crop */
[data-product-image-fit="contain"] .product-card .product-card-image .product-card-link-image img,
[data-product-image-fit="contain"] .product-card .product-card-image .product-img-hover {
  object-fit: contain;
}

/* Fill — stretch to fill the card */
[data-product-image-fit="fill"] .product-card .product-card-image .product-card-link-image img,
[data-product-image-fit="fill"] .product-card .product-card-image .product-img-hover {
  object-fit: fill;
}

/* Original — drop the fixed aspect ratio so the card follows the image's
   natural proportions. The `.product-card` ancestor lifts specificity
   above the per-style aspect-ratio rules (modern/overlay). */
[data-product-image-fit="original"] .product-card .product-card-image {
  aspect-ratio: auto;
}

[data-product-image-fit="original"] .product-card .product-card-image .product-card-link-image img {
  height: auto;
  object-fit: contain;
}

[data-product-image-fit="original"] .product-card .product-card-image .product-img-hover {
  object-fit: contain;
}

/* Play badge for video primary media */
.product-card-video-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline-start: 3px;
  pointer-events: auto;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.product-card:hover .product-card-video-badge {
  background: var(--primary-color, #000);
  transform: translate(-50%, -50%) scale(1.08);
}

/* Video lightbox (triggered from product cards / quick view; lives here so it's globally available) */
.video-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.video-lightbox.is-open {
  display: flex;
}

.video-lightbox__inner {
  position: relative;
  width: min(960px, 100%);
}

.video-lightbox__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-lightbox__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-lightbox__close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

[dir="rtl"] .video-lightbox__close {
  right: auto;
  left: 0;
}

/* Second image on hover */
.product-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background-color: var(--color-accent);
  color: var(--color-bg);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  z-index: 5;
  pointer-events: none;
  width: max-content;
  border-radius: var(--radius-sm);
}

.product-badge.badge-top-left {
  left: 0.75rem;
  right: auto;
  transform: none;
}

.product-badge.badge-top-center {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.product-badge.badge-top-right {
  left: auto;
  right: 0.75rem;
  transform: none;
}

.product-card-image .product-img-hover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 2; /* Ensure it sits on top */
  background-color: var(--color-surface); /* Avoid white flash on hover */
}

.product-card:hover .product-img-hover {
  opacity: 1;
}

.product-card-title {
  color: var(--color-text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.product-card-price {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}

[data-theme="dark"] .product-card-price {
  color: var(--color-text); /* More prominent in dark mode */
}

.product-card-price .price-current {
  color: inherit;
}

[data-theme="dark"] .product-card-price .price-current {
  color: var(--color-text);
}

.product-card-price .compare-price {
  text-decoration: line-through;
  opacity: 0.5;
  margin-left: 6px;
  color: var(--color-text-muted);
}

.product-card-rating {
  position: absolute;
  bottom: 60px;
  inset-inline-end: 0.75rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-sm, 0);
  backdrop-filter: blur(2px);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.product-card-image .low-stock-indicator {
  position: absolute;
  bottom: 60px;
  inset-inline-start: 0.75rem;
  z-index: 4;
  margin-top: 0;
  padding: 3px 7px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-sm, 0);
  backdrop-filter: blur(2px);
  box-shadow: 0 2px 8px var(--color-shadow);
  font-size: 0.72rem;
}

.product-card-rating .pc-star {
  width: 13px;
  height: 13px;
  color: #f5b301;
}

.product-card-rating-value {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1;
}

.product-card-rating-count {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  line-height: 1;
}

.product-card-action,
.product-card-overlay-cart {
  z-index: 10;
  transition: all var(--transition-base);
  background-color: var(--color-white, #ffffff) !important;
  color: var(--color-text, #1a1a1a) !important;
  border: 1px solid var(--color-white, #ffffff) !important;
  box-shadow: var(--shadow-md);
  font-size: var(--btn-sm-fs) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.product-card-action {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
}

@media (max-width: 480px) {
  .product-card-action {
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
  }
}

.product-card-action:hover,
.product-card-overlay-cart:hover {
  background-color: var(--color-white, #ffffff) !important;
  color: var(--color-text, #1a1a1a) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  filter: brightness(0.98);
}

.product-card-action:active,
.product-card-overlay-cart:active {
  transform: translateY(0);
}

.product-card-action svg,
.product-card-overlay-cart svg,
.product-card-action .header-custom-icon-svg,
.product-card-overlay-cart .header-custom-icon-svg {
  width: 18px;
  height: 18px;
}

.product-card-out-of-stock {
  opacity: 0.6;
  cursor: not-allowed;
}


/* ============================================
   PRODUCT CARD — CLASSIC STYLE
   ============================================ */
.product-card-style-classic {
  border-radius: var(--radius-lg);
}

.product-card-style-classic .product-card-image {
  border-radius: var(--radius-lg);
}

.product-card-style-classic .product-card-info {
  padding: 1.25rem 0.5rem;
  text-align: center;
}

.product-card-style-classic .product-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--color-text);
}

/* Base Product Options (Bottom Placement) */
.product-card-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  min-height: 24px;
  justify-content: center;
  flex-direction: row;
}

/* Visibility classes for mobile override */
.is-mobile-options {
  display: none !important;
}

/* Force hide desktop options on mobile */
@media (max-width: 768px) {
  .product-card .is-desktop-options {
    display: none !important;
  }

  .product-card .is-mobile-options {
    display: flex !important;
  }
}

.product-option-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 8px;
  background-color: transparent;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  line-height: 1;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.product-option-pill:hover {
  border-color: var(--primary-color);
  background-color: var(--color-surface);
}

button.product-option-pill {
  cursor: pointer;
  font-family: inherit;
}

.product-option-pill.is-selected {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: #fff;
}

.product-option-pill.is-disabled {
  opacity: 0.4;
  text-decoration: line-through;
  cursor: not-allowed;
}

.options-in-image .product-option-pill.is-selected {
  background-color: var(--color-text) !important;
  color: var(--color-bg) !important;
  border-color: var(--color-text) !important;
}

.product-card-style-modern .product-option-pill.is-selected {
  border-color: var(--color-text);
  color: var(--color-text);
  background: var(--color-surface);
}

/* ============================================
   PRODUCT CARD — ELEGANT STYLE (Image Replication)
   ============================================ */
.product-card-style-modern {
  border-radius: 0; /* Container itself is borderless */
  background: transparent;
  border: none;
  transition: opacity 0.3s ease;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card-style-modern .product-card-image {
  border-radius: var(--radius-lg); /* Matching the image's rounded look */
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--color-surface);
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border-light);
}

.product-card-style-modern .product-card-image img {
  transition: transform 1s cubic-bezier(0.165, 0.84, 0.44, 1);
  mix-blend-mode: multiply; /* Helps with white backgrounds on f5f5f5 */
}

.product-card-style-modern:hover .product-card-image img {
  transform: scale(1.05);
}

/* Swatch Overlays */
.product-card-swatches-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 3;
}

[dir="rtl"] .product-card-swatches-overlay {
  left: auto;
  right: 12px;
}

.product-card-style-modern .swatch-bubble {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-bg);
  box-shadow: 0 2px 4px var(--color-shadow);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.product-card-style-modern .swatch-bubble:hover {
  transform: scale(1.2);
}

.product-card-style-modern .swatch-more {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: 10px;
  align-self: center;
}

/* Info Section */
.product-card-style-modern .product-card-info {
  padding: 0;
  text-align: left;
}

[dir="rtl"] .product-card-style-modern .product-card-info {
  text-align: right;
}

.product-card-style-modern .product-card-title {
  font-size: 1rem;
  font-weight: 700; /* Bold titles like in the image */
  line-height: 1.2;
  color: var(--color-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.product-card-style-modern .product-card-price {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

[data-theme="dark"] .product-card-style-modern .product-card-price {
  color: var(--color-text);
}

.product-card-style-modern .price-from {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.product-card-style-modern .compare-price {
  text-decoration: line-through;
  opacity: 0.5;
  font-size: 0.85rem;
}

/* Options below info - Refined for Elegant Style */
.product-card-style-modern .product-card-options {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
  gap: 6px;
  padding: 0;
}

[dir="rtl"] .product-card-style-modern .product-card-options {
  justify-content: flex-start;
}

.product-card-style-modern .product-option-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.product-card-style-modern .product-option-pill:hover {
  border-color: var(--color-text);
  color: var(--color-text);
  background: var(--color-surface);
}

/* Options in Image — Base Shared Styles */
.options-in-image {
  position: absolute !important;
  padding: 0 !important;
  background: transparent !important;
  z-index: 4;
  display: flex !important;
  gap: 4px !important;
  margin-top: 0 !important;
}

/* Center Right - Vertically centered */
.options-in-image.options-image-center-right,
.options-in-image.options-image-top-right,
.options-in-image.options-image-vertical-right {
  top: 50% !important;
  transform: translateY(-50%) !important;
  right: 12px;
  left: auto;
  bottom: auto;
  flex-direction: column !important;
  align-items: flex-end !important;
}

[dir="rtl"] .options-in-image.options-image-center-right,
[dir="rtl"] .options-in-image.options-image-top-right,
[dir="rtl"] .options-in-image.options-image-vertical-right {
  right: auto;
  left: 12px;
  align-items: flex-start !important;
}

/* Center Left - Vertically centered */
.options-in-image.options-image-center-left,
.options-in-image.options-image-top-left,
.options-in-image.options-image-vertical-left {
  top: 50% !important;
  transform: translateY(-50%) !important;
  left: 12px;
  right: auto;
  bottom: auto;
  flex-direction: column !important;
  align-items: flex-start !important;
}

[dir="rtl"] .options-in-image.options-image-center-left,
[dir="rtl"] .options-in-image.options-image-top-left,
[dir="rtl"] .options-in-image.options-image-vertical-left {
  left: auto;
  right: 12px;
  align-items: flex-end !important;
}

/* Pill styling inside image */
.options-in-image .product-option-pill {
  background-color: var(--color-bg) !important;
  border: 1px solid var(--color-border-light) !important;
  backdrop-filter: blur(4px);
  color: var(--color-text) !important;
  font-size: 0.65rem !important;
  padding: 6px 8px !important;
  min-width: 32px;
  text-align: center;
  box-shadow: 0 4px 12px var(--color-shadow);
  border-radius: 4px;
  margin: 0;
  cursor: pointer;
  font-weight: 700;
}

.options-in-image .product-option-pill:hover {
  background-color: var(--color-text) !important;
  color: var(--color-bg) !important;
}

.options-in-image .product-card-options {
  flex-direction: column !important;
}

/* ============================================
   PRODUCT CARD — OVERLAY STYLE
   ============================================ */
.product-card-style-overlay {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.product-card-style-overlay .product-card-image {
  border-radius: var(--radius-lg, 16px);
  aspect-ratio: 3 / 4;
  position: relative;
  overflow: hidden;
}

.product-card-style-overlay .product-card-image img {
  transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.product-card-style-overlay:hover .product-card-image img {
  transform: scale(1.05);
}

/* Overlay — Price Badge (top-right physically) */
.overlay-price-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem; /* Forced physical top-right precisely as requested */
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  background: var(--color-card-bg); /* Support light/dark mode */
  padding: 8px 12px;
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-sm);
  line-height: 1.2;
  border: 1px solid var(--color-border-light); /* Added border for better separation in dark mode */
}

[dir="rtl"] .overlay-price-badge {
  right: 0.75rem;
  align-items: flex-start;
}

.overlay-price-current {
  font-size: 0.9rem;
  font-weight: var(--fw-bold, 700);
  color: var(--color-text, #1a1a1a);
}

.overlay-price-compare {
  font-size: 0.75rem;
  font-weight: var(--fw-regular, 400);
  color: var(--color-text-muted, #999);
  text-decoration: line-through;
}

/* Overlay — Actions Container (Bottom Center) */
.product-card-overlay-actions {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 90%;
  justify-content: center;
}

/* Overlay — Add to Cart Button */
.product-card-overlay-cart {
  flex: 1;
  margin-bottom: 0;
  min-height: var(--btn-sm-height);
  padding: var(--btn-sm-padding);
  border-radius: var(--radius-md);
}


/* Overlay — Wishlist Button (Circular) */
.overlay-wishlist-wrapper {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  margin: 0 !important;
  width: 44px !important;
  height: 44px !important;
  display: flex !important;
  flex-shrink: 0;
}

.overlay-wishlist-wrapper .theme-wish-btn {
  position: relative !important;
  margin: 0 !important;
  /* width: 44px !important; */
  /* height: 44px !important; */
  background: var(--color-white, #fff) !important;
  border-radius: 50% !important;
  border: none !important;
  box-shadow: var(--shadow-md) !important;
  padding: 0 !important;
  display: inline-flex; /* Removed !important to allow JS toggling */
}

.overlay-wishlist-wrapper .theme-wish-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg) !important;
}

.overlay-wishlist-wrapper .theme-wish-btn svg {
  width: 20px;
  height: 18px;
}

/* Overlay — Info Section */
.product-card-style-overlay .product-card-info {
  padding: 0.75rem 0.25rem;
  text-align: center;
}

.product-card-style-overlay .product-card-title {
  font-size: 0.95rem;
  font-weight: var(--fw-semibold, 600);
  color: var(--color-text, #1a1a1a);
  margin: 0;
}

/* ============================================
   WISHLIST — Heart Icon on Product Card
   ============================================ */
.theme-wishlist-container {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 6;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  border-radius: var(--radius-full, 50%);
  background-color: var(--color-bg);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px var(--color-shadow);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.theme-wishlist-container:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--color-shadow);
}

[dir="rtl"] .theme-wishlist-container {
  right: auto;
  left: 0;
}

.theme-wish-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.theme-wish-btn svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

/* Hide any images injected by platform inside our custom buttons */
.theme-wish-btn img {
  display: none !important;
}

/* Default visibility handled by JS and display:none in Jinja for filled icon */
.theme-wish-btn.filled {
  display: none;
}

/* [zid-hidden-wishlist] replaced by theme logic */

.wishlist-has-items svg :not([fill="none"]) {
  fill: #d86f6f !important;
}

.wishlist-empty svg :not([fill="none"]) {
  fill: none;
}

/* Wishlist Count Badge (header) */
.wishlist-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #d86f6f;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  padding: 0 4px;
}

/* Custom Header Wishlist Icon Styles */
.header-action-btn.wishlist-has-items .header-custom-icon-svg {
  color: #d86f6f !important;
}

.header-action-btn.wishlist-has-items .header-custom-icon-svg svg path,
.header-action-btn.wishlist-has-items .header-custom-icon-svg svg rect,
.header-action-btn.wishlist-has-items .header-custom-icon-svg svg circle {
  fill: #d86f6f !important;
  stroke: #d86f6f !important;
}

.header-action-btn.wishlist-empty .header-custom-icon-svg svg path,
.header-action-btn.wishlist-empty .header-custom-icon-svg svg rect,
.header-action-btn.wishlist-empty .header-custom-icon-svg svg circle {
  fill: none !important;
  stroke: currentColor;
  stroke-width: 1.5;
}

[dir="rtl"] .wishlist-count {
  right: unset;
  left: -4px;
}

.theme-wishlist-container .wishlist-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--color-primary, #333);
  border-radius: 50%;
  animation: wishlist-spin 0.6s linear infinite;
}

@keyframes wishlist-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Product Detail Page — Wishlist Button */
.product-wishlist-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--color-border-light, #e5e5e5);
  border-radius: var(--radius-md, 8px);
  background: transparent;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
  flex-shrink: 0;
}

.product-wishlist-btn:hover {
  border-color: #d86f6f;
  background-color: rgba(216, 111, 111, 0.05);
}

.product-wishlist-btn .icon-heart-mask {
  width: 22px;
  height: 20px;
}
