/**
 * New Product Detail Page - Modern Design
 */

/* Hide back button on new product detail page */
.back_to_search {
  display: none !important;
}

/* Override parent container constraints for product detail page */
#subpage_container:has(.product-detail-new) {
  max-width: 100% !important;
  min-width: 100% !important;
  width: 100% !important;
  float: none !important;
}

/* Hide left nav on product detail page */
#left_nav:has(~ #subpage_container .product-detail-new),
.product-detail-new ~ #left_nav {
  display: none !important;
}

/* Reset any inherited styles */
.product-detail-new,
.product-detail-new * {
  box-sizing: border-box;
}

/* Main Container */
.product-detail-new {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 15px;
  width: 100%;
  clear: both;
}

.product-detail-main {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
}

/* Breadcrumb */
.product-breadcrumb {
  font-size: 12px;
  color: #666;
  margin-bottom: 20px;
}

.product-breadcrumb a {
  color: #666;
  text-decoration: none;
}

.product-breadcrumb a:hover {
  color: #14294b;
  text-decoration: underline;
}

.product-breadcrumb span {
  margin: 0 8px;
  color: #999;
}


/* Right side - zoom panel + product info */
.product-right-side {
  flex: 1 1 auto;
  min-width: 300px;
  max-width: 550px;
  display: flex;
  flex-direction: column;
  gap: 0;
}


/* Zoom lens that follows mouse */
#product-zoom {
  position: relative;
}

.zoom-lens {
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid #14294b;
  cursor: crosshair;
  display: none;
  pointer-events: none;
  z-index: 10;
}

/* Zoom result panel - shows magnified area on hover (hidden by default) */
.product-zoom-result {
  width: 100%;
  height: 450px;
  background-repeat: no-repeat;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  display: none;
  margin-bottom: 15px;
}

/* Left Side - Image Gallery (thumbnails on left, main image on right) */
.product-gallery {
  flex: 0 0 510px !important;
  width: 510px !important;
  max-width: 510px !important;
  display: flex !important;
  flex-direction: row !important;
  gap: 15px !important;
  align-items: flex-start !important;
}

.product-main-image {
  position: relative;
  flex: 1 1 auto;
  background: #f9f9f9;
  border-radius: 8px;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  min-height: 550px;
  height: 550px;
}

#product-zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* MagicZoom hover zoom */
.product-main-image .MagicZoom {
  display: block;
  width: 100%;
  position: relative;
}

.product-main-image .MagicZoom img {
  max-width: 100%;
  max-height: 600px;
  height: auto !important;
  width: auto;
  display: block;
  margin: 0 auto;
}

/* Position the zoom preview */
.MagicZoomBigImageCont {
  z-index: 9999 !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

.product-main-image .zoom-instruction {
  display: none; /* Hidden - thumbnail layout doesn't need this instruction */
}

/* Make the small lens/pup that follows the mouse smaller */
.product-main-image .MagicZoomPup {
  width: 80px !important;
  height: 80px !important;
}

.product-main-image img {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  display: block;
  transition: transform 0.3s ease;
  cursor: zoom-in;
  object-fit: contain;
}

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

.product-badge {
  position: absolute;
  top: 15px;
  left: 15px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 3px;
  z-index: 5;
}

/* Hide badge on thumbnails */
.product-thumbnails .product-badge,
.product-thumbnail .product-badge {
  display: none !important;
}

/* Hide badge on mobile to prevent layout issues */
@media (max-width: 600px) {
  .product-badge {
    display: none !important;
  }
}

.product-badge.topseller {
  background: #14294b;
  color: #fff;
}

.product-badge.sale {
  background: #c0392b;
  color: #fff;
}

.product-badge.new {
  background: #27ae60;
  color: #fff;
}

.product-badge.sustainable {
  background: #2ecc71;
  color: #fff;
}

.product-badge.seamless {
  background: #9b59b6;
  color: #fff;
}

.product-badge.new_color {
  background: #e67e22;
  color: #fff;
}

.product-badge.new_size {
  background: #3498db;
  color: #fff;
}

/* Thumbnail Gallery - Vertical on left side */
.product-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 96px;
  width: 96px;
  height: 550px;
  max-height: 550px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  box-sizing: border-box;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

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

.product-thumbnails::-webkit-scrollbar-track {
  background: transparent;
}

.product-thumbnails::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.product-thumbnail {
  width: 80px;
  height: 100px;
  min-height: 100px;
  border: 2px solid #e5e5e5;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
  background: #f9f9f9;
  flex-shrink: 0;
}

.product-thumbnail:hover,
.product-thumbnail.active {
  border-color: #14294b;
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scroll hint for many thumbnails */
.thumbnail-scroll-hint {
  text-align: center;
  color: #999;
  font-size: 18px;
  padding: 5px 0;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* Right Side - Product Info */
.product-info {
  flex: 1 1 auto !important;
  min-width: 300px;
  max-width: 600px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Product info in new layout - inside product-right-side */
.product-right-side .product-info {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.product-brand {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #14294b;
  margin-bottom: 5px;
}

.product-title {
  font-size: 24px;
  font-weight: 600;
  color: #222;
  margin: 0 0 3px 0;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.product-sku {
  font-size: 11px;
  color: #999;
  margin-bottom: 12px;
}

/* Price */
.product-price-section {
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.product-price-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.product-price {
  font-size: 28px;
  font-weight: 700;
  color: #14294b;
}

.product-price.sale {
  font-size: 28px;
  font-weight: 700;
  color: #c0392b;
}

.product-price-original {
  font-size: 28px;
  color: #888;
  text-decoration: line-through;
  font-weight: 400;
}

.product-price-savings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #c0392b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
}

.product-tax-info {
  font-size: 12px;
  color: #888;
  margin-top: 6px;
}

/* Clearance discount note */
.product-clearance-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
  border-left: 3px solid #f9a825;
  border-radius: 0 4px 4px 0;
  font-size: 12px;
  color: #5d4037;
  line-height: 1.4;
}

.product-clearance-note svg {
  flex-shrink: 0;
  color: #f9a825;
  margin-top: 1px;
}

.product-clearance-note span {
  flex: 1;
}

/* Upfront mention of reduced colors + sizes and the reduced price */
.product-clearance-overview {
  margin-top: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #f1d59a;
  border-radius: 4px;
  font-size: 12px;
  color: #5d4037;
  max-height: 200px;
  overflow-y: auto;
}

.product-clearance-overview .clearance-overview-subtitle {
  font-weight: 700;
  margin-bottom: 4px;
  color: #c0392b;
}

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

.product-clearance-overview .clearance-overview-list li {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dotted #eee;
  line-height: 1.4;
}

.product-clearance-overview .clearance-overview-list li:last-child {
  border-bottom: none;
}

.product-clearance-overview .clearance-overview-color {
  flex: 0 0 40%;
  font-weight: 600;
  text-transform: capitalize;
}

.product-clearance-overview .clearance-overview-sizes {
  flex: 1;
  color: #c0392b;
  font-weight: 600;
}


/* Color Selection */
.product-colors {
  margin-bottom: 25px;
}

.product-colors-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.product-colors-label span {
  font-weight: normal;
  color: #666;
}

.product-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.product-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #ddd;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  /* Colours without a flat value carry a photo of the fabric (interface/colors/farbe_*.jpg),
     a wide strip. Without these it is drawn at its own size from the top-left corner, so the
     swatch shows an arbitrary edge of the picture instead of the colour. */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.product-color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.product-color-swatch.active {
  border-color: #14294b;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #14294b;
}

.product-color-swatch.unavailable {
  opacity: 0.4;
  cursor: not-allowed;
}

.product-color-swatch.unavailable::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -2px;
  right: -2px;
  height: 2px;
  background: #c0392b;
  transform: rotate(-45deg);
}

/* Available colors text list */
.product-colors-available {
  margin-top: 12px;
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

/* Size Selection */
.product-sizes {
  margin-bottom: 25px;
}

.product-sizes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.product-sizes-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.product-size-guide {
  font-size: 13px;
  color: #14294b;
  text-decoration: underline;
  cursor: pointer;
}

.product-size-guide:hover {
  color: #ccae6a;
}

.product-size-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-size-btn {
  min-width: 40px;
  padding: 6px 10px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  border-radius: 3px;
}

.product-size-btn:hover {
  border-color: #14294b;
  background: #f5f5f5;
}

.product-size-btn.active {
  border-color: #14294b;
  background: #14294b;
  color: #fff;
}

.product-size-btn.unavailable {
  color: #ccc;
  text-decoration: line-through;
  cursor: not-allowed;
}

.product-size-btn.unavailable:hover {
  border-color: #ddd;
  background: #fff;
}

/* Sizes that get the 10% clearance discount */
.product-size-btn.discounted {
  position: relative;
  border-color: #c0392b;
  color: #c0392b;
  font-weight: 600;
}

.product-size-btn.discounted::after {
  content: '-10%';
  position: absolute;
  top: -8px;
  right: -8px;
  background: #c0392b;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 3px;
}

.product-size-btn.discounted.active {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

/* Don't show discount marker on unavailable sizes */
.product-size-btn.unavailable.discounted {
  border-color: #ddd;
  color: #ccc;
  font-weight: normal;
}

.product-size-btn.unavailable.discounted::after {
  display: none;
}

/* Add to Cart Section */
.product-actions {
  margin-bottom: 25px;
}

.product-quantity {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.product-quantity label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.quantity-selector {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.qty-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: #f5f5f5;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.qty-btn:hover {
  background: #e5e5e5;
}

.quantity-selector input {
  width: 50px;
  height: 40px;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  background: #fff;
}

.product-add-to-cart {
  width: 100%;
  padding: 16px 30px;
  background: #ccae6a;
  color: #fff;
  border: none;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.3s;
  border-radius: 4px;
  margin-bottom: 10px;
}

.product-add-to-cart:hover {
  background: #b89a5a;
}

.product-add-to-cart:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.product-wishlist-btn {
  width: 100%;
  padding: 12px 30px;
  background: #fff;
  color: #ccae6a;
  border: 2px solid #ccae6a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.product-wishlist-btn:hover {
  background: #f5f5f5;
}

.product-wishlist-btn.active {
  background: #fff;
  color: #ccae6a;
}

.product-wishlist-btn svg {
  width: 18px;
  height: 18px;
  stroke: #666;
  fill: none;
}

.product-wishlist-btn.active svg {
  stroke: #e74c3c;
  fill: #e74c3c;
}

/* Delivery Info */
.product-delivery {
  padding: 15px;
  background: #f9f9f9;
  border-radius: 6px;
  margin-bottom: 25px;
}

.product-delivery-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #555;
}

.product-delivery-item:last-child {
  margin-bottom: 0;
}

.product-delivery-item svg {
  width: 18px;
  height: 18px;
  color: #27ae60;
}

.product-delivery-item.highlight {
  color: #27ae60;
  font-weight: 600;
}

/* Product Description - Full width section below main layout */
.product-description-section {
  width: 100%;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.product-description-section .product-description {
  border-top: none;
  padding-top: 0;
}

/* Product Description */
.product-description {
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.product-description-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 10px 0;
}

.product-description-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.product-description-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s;
}

.product-description-toggle.open svg {
  transform: rotate(180deg);
}

.product-description-content {
  padding: 15px 0;
  font-size: 14px;
  line-height: 1.7;
  color: #555;
  display: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.product-description-content.show {
  display: block;
}

.product-description-content p {
  margin: 0 0 15px 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.product-description-content ul {
  margin: 10px 0;
  padding-left: 20px;
}

.product-description-content li {
  margin-bottom: 8px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.product-description-content li::marker {
  color: #14294b;
}

.product-description-content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: inherit;
  overflow-x: auto;
  display: block;
}

.product-description-content table td,
.product-description-content table th {
  padding: 8px 10px;
  border: 1px solid #ddd;
  word-wrap: break-word;
}

.product-description-content img {
  max-width: 100%;
  height: auto;
}

/* Recently Viewed Section */
.recently-viewed {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #eee;
}

.recently-viewed-title {
  font-size: 20px;
  font-weight: 600;
  color: #222;
  margin: 0 0 20px 0;
}

.recently-viewed-grid {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.recently-viewed-item {
  flex: 0 0 200px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

.recently-viewed-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.rv-image {
  width: 100%;
  height: 180px;
  background: #f9f9f9;
  overflow: hidden;
}

.rv-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rv-info {
  padding: 12px;
}

.rv-brand {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 4px;
}

.rv-name {
  font-size: 13px;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv-price {
  font-size: 14px;
  font-weight: 600;
  color: #14294b;
}

.rv-old-price {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
  font-weight: normal;
}

@media (max-width: 600px) {
  .recently-viewed-grid {
    gap: 12px;
  }

  .recently-viewed-item {
    flex: 0 0 150px;
  }

  .rv-image {
    height: 140px;
  }

  .rv-info {
    padding: 10px;
  }

  .rv-name {
    font-size: 12px;
  }

  .rv-price {
    font-size: 13px;
  }
}

/* Matching Products Section */
.product-matching {
  width: 100%;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #eee;
}

.product-matching-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 25px;
  color: #222;
}

/* Responsive */
@media (max-width: 1000px) {
  .product-right-side {
    min-width: 280px;
  }
  
  .product-zoom-result {
    display: none !important;
  }
  
  .zoom-lens {
    display: none !important;
  }
}

@media (max-width: 850px) {
  .product-detail-main {
    flex-direction: column !important;
    flex-wrap: wrap !important;
  }

  .product-gallery {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    flex-direction: row !important;
  }
  
  .product-main-image {
    min-height: 450px !important;
    height: 450px !important;
  }
  
  .product-thumbnails {
    flex: 0 0 80px !important;
    width: 80px !important;
    height: 450px !important;
    max-height: 450px !important;
    padding-right: 8px !important;
  }
  
  .product-thumbnail {
    width: 65px !important;
    height: 85px !important;
    min-height: 85px !important;
  }
  
  .product-right-side {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }

  .product-info {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 500px) {
  .product-gallery {
    flex-direction: column-reverse !important;
  }
  
  .product-main-image {
    min-height: 350px !important;
    height: 350px !important;
  }
  
  .product-thumbnails {
    flex-direction: row !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 8px !important;
    padding-bottom: 5px !important;
  }
  
  .product-thumbnail {
    width: 60px !important;
    height: 75px !important;
    min-height: 75px !important;
    flex-shrink: 0 !important;
  }
  
  .thumbnail-scroll-hint {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .product-detail-new {
    padding: 10px;
    overflow-x: hidden;
  }

  .product-detail-main {
    gap: 20px;
  }
  
  .product-zoom-result {
    display: none !important;
  }
  
  .zoom-lens {
    display: none !important;
  }

  .product-brand {
    font-size: 12px;
    letter-spacing: 1px;
  }

  .product-title {
    font-size: 18px;
    line-height: 1.3;
  }
  
  .product-info {
    padding: 0 5px;
  }
  
  .product-price {
    font-size: 22px;
  }

  .product-price-section {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }
  
  .product-clearance-note {
    font-size: 11px;
    padding: 8px 10px;
  }
  
  .zoom-instruction {
    display: none;
  }
  
  .product-thumbnail {
    width: 55px;
    height: 55px;
  }
  
  .product-color-swatch {
    width: 30px;
    height: 30px;
  }
  
  .product-size-btn {
    min-width: 40px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .product-add-to-cart {
    padding: 14px 20px;
    font-size: 14px;
  }

  .product-wishlist-btn {
    padding: 10px 20px;
    font-size: 13px;
  }

  .product-delivery {
    padding: 12px;
  }

  .product-delivery-item {
    font-size: 12px;
  }

  .product-description-title {
    font-size: 14px;
  }

  .product-description-content {
    font-size: 13px;
    line-height: 1.6;
    padding: 12px 0;
  }
  
  .product-description-content p {
    margin: 0 0 12px 0;
  }
  
  .product-description-content ul {
    padding-left: 15px;
  }
  
  .product-description-content li {
    margin-bottom: 6px;
  }
  
  .product-description-content table {
    font-size: 12px;
  }
  
  .product-description-content table td,
  .product-description-content table th {
    padding: 6px 8px;
  }
  
  .product-description-section {
    margin-top: 20px;
    padding-top: 15px;
  }
}

/* Matching Products / Customers also bought - uses gallery_item() like homepage Topseller */
#matching_products {
  margin: 40px 0;
  padding: 30px 0;
  border-top: 1px solid #eee;
  clear: both;
}

#matching_products h3 {
  font-size: 22px;
  font-weight: 400;
  color: #333;
  margin-bottom: 20px;
}

.matching-products-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* 5 per row - !important required to beat gallery-view.css media rules */
.matching-products-grid .gallery-item {
  flex: 0 0 calc(20% - 10px) !important;
  width: calc(20% - 10px) !important;
  max-width: calc(20% - 10px) !important;
  min-width: 0 !important;
  margin: 0 !important;
}

/* Smaller image area for the compact 5-per-row layout */
.matching-products-grid .gallery-item .gallery-item-image {
  height: 230px !important;
}

.matching-products-grid .gallery-item .gallery-item-info {
  padding: 10px;
}

@media (max-width: 680px) {
  .matching-products-grid .gallery-item {
    flex: 0 0 calc(33.333% - 8px) !important;
    width: calc(33.333% - 8px) !important;
    max-width: calc(33.333% - 8px) !important;
  }

  .matching-products-grid .gallery-item .gallery-item-image {
    height: 200px !important;
  }
}

@media (max-width: 460px) {
  .matching-products-grid .gallery-item {
    flex: 0 0 calc(50% - 6px) !important;
    width: calc(50% - 6px) !important;
    max-width: calc(50% - 6px) !important;
  }
}

/* Related Products */
.related-products {
  margin: 40px 0;
  padding: 30px 0;
  border-top: 1px solid #eee;
}

.related-products-title {
  font-size: 20px;
  font-weight: 600;
  color: #14294b;
  margin-bottom: 25px;
}

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

.related-product-item {
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #eee;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.related-product-item:hover {
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.rp-image {
  aspect-ratio: 1/1.2;
  overflow: hidden;
  background: #f8f8f8;
}

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

.rp-info {
  padding: 12px;
}

.rp-brand {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.rp-name {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rp-price {
  font-size: 14px;
  font-weight: 600;
  color: #14294b;
}

.rp-old-price {
  text-decoration: line-through;
  color: #999;
  font-weight: normal;
  font-size: 12px;
}

@media (max-width: 900px) {
  .related-products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .related-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .related-products-title {
    font-size: 18px;
    margin-bottom: 15px;
  }
  
  .rp-info {
    padding: 10px;
  }
  
  .rp-brand {
    font-size: 10px;
  }
  
  .rp-name {
    font-size: 12px;
  }
  
  .rp-price {
    font-size: 13px;
  }
}

/* Sticky Add to Cart on Mobile */
@media (max-width: 500px) {
  .product-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 10px 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    display: flex;
    gap: 10px;
    margin-bottom: 0;
  }

  .product-add-to-cart {
    flex: 1;
    margin-bottom: 0;
  }

  .product-wishlist-btn {
    flex: 0 0 60px;
    padding: 14px;
    background: #fff !important;
    border: 2px solid #ccae6a !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-wishlist-btn svg {
    width: 22px;
    height: 22px;
    stroke: #666 !important;
    fill: none !important;
  }

  .product-wishlist-btn.active svg {
    stroke: #e74c3c !important;
    fill: #e74c3c !important;
  }

  .product-wishlist-btn span {
    display: none;
  }

  .product-info {
    padding-bottom: 80px;
  }
}

/* Cart Side Drawer - Calida Style */
.cart-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  z-index: 10001;
}

.cart-drawer.open {
  right: 0;
}

/* Header */
.cart-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid #eee;
}

.cart-drawer-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.cart-drawer-header-left:hover {
  color: #333;
}

.cart-drawer-title {
  font-size: 14px;
  font-weight: 400;
  color: #333;
}

.cart-drawer-icon {
  color: #333;
}

.cart-drawer-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ccae6a;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
}

.cart-drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-drawer-close:hover {
  color: #333;
}

/* Success Message */
.cart-drawer-success {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #f8fff8;
  border: 1px solid #d4edda;
  margin: 15px 20px 0;
  border-radius: 4px;
  font-size: 13px;
  color: #155724;
}

.cart-drawer-success svg {
  flex-shrink: 0;
}

.cart-drawer-success span {
  flex: 1;
}

.cart-drawer-success-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  padding: 0;
  line-height: 1;
}

.cart-drawer-success-close:hover {
  color: #333;
}

/* Content */
.cart-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.cart-drawer-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}

/* Product Item */
.cart-drawer-item {
  display: flex;
  gap: 12px;
  position: relative;
}

.cart-drawer-item-img {
  width: 80px;
  height: 100px;
  flex-shrink: 0;
  background: #f5f5f5;
  overflow: hidden;
}

.cart-drawer-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-drawer-item-details-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cart-drawer-item-info {
  flex: 1;
}

.cart-drawer-item-brand {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.cart-drawer-item-name {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  line-height: 1.3;
}

.cart-drawer-item-price {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

/* Split order: the same article sits in the cart twice - the reduced pieces that
   were still in stock, and the rest at the regular price. One row per cart line. */
.cart-drawer-price-split {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}

.cart-drawer-price-split .split-row {
  font-size: 13px;
  color: #333;
  white-space: nowrap;
}

.cart-drawer-price-split .split-qty,
.cart-drawer-price-split .split-price {
  font-weight: 600;
}

.cart-drawer-price-split .split-tag {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.cart-drawer-item-sku {
  font-size: 10px;
  color: #333;
  background: #fff59d;
  display: inline-block;
  padding: 2px 6px;
  margin-bottom: 8px;
}

.cart-drawer-item-meta {
  font-size: 12px;
  color: #666;
}

.cart-drawer-item-meta-row {
  margin-bottom: 2px;
}

.cart-drawer-item-meta-row .meta-label {
  color: #888;
}

.cart-drawer-item-meta-row .meta-value {
  color: #333;
}

/* Controls row - quantity and wishlist */
.cart-drawer-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.cart-drawer-qty {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.cart-drawer-qty button {
  width: 34px;
  height: 34px;
  background: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-drawer-qty button:hover {
  background: #f5f5f5;
}

.cart-drawer-qty span {
  width: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  height: 34px;
  line-height: 34px;
}

.cart-drawer-wishlist {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.cart-drawer-wishlist:hover {
  border-color: #999;
  color: #333;
}

/* Delete button - positioned on right */
.cart-drawer-delete {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.cart-drawer-delete:hover {
  border-color: #999;
  color: #333;
}

/* Promo Code */
.cart-drawer-promo {
  padding: 20px;
  border-top: 1px solid #eee;
}

.cart-drawer-promo-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.cart-drawer-promo-input {
  display: flex;
}

.cart-drawer-promo-input input {
  flex: 1;
  height: 46px;
  border: 1px solid #ddd;
  border-right: none;
  border-radius: 0;
  padding: 0 15px;
  font-size: 14px;
}

.cart-drawer-promo-input input::placeholder {
  color: #999;
}

.cart-drawer-promo-input input:focus {
  outline: none;
  border-color: #999;
}

.cart-drawer-promo-input button {
  width: 50px;
  height: 46px;
  background: #333;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-drawer-promo-input button:hover {
  background: #444;
}

/* Footer */
.cart-drawer-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-drawer-checkout {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: #000;
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  box-sizing: border-box;
}

.cart-drawer-checkout:hover {
  background: #333;
  color: #fff;
}

.cart-drawer-continue {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: #fff;
  color: #333;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
}

.cart-drawer-continue:hover {
  border-color: #999;
  background: #f9f9f9;
}

/* Mobile responsive for cart drawer */
@media (max-width: 450px) {
  .cart-drawer {
    width: 100vw;
    right: -100vw;
  }
  
  .cart-drawer-item {
    gap: 10px;
    padding-right: 45px;
  }
  
  .cart-drawer-item-img {
    width: 70px;
    height: 90px;
  }
  
  .cart-drawer-item-name {
    font-size: 12px;
  }
  
  .cart-drawer-item-price {
    font-size: 13px;
  }
}

/* Primary Checkout Button - More prominent */
.cart-drawer-checkout.primary {
  background: #ccae6a;
  font-size: 16px;
  padding: 18px 20px;
}

.cart-drawer-checkout.primary:hover {
  background: #b89a5a;
}

/* Collapsible Promo Code */
.cart-drawer-promo.collapsed .cart-drawer-promo-input {
  display: none;
}

.cart-drawer-promo-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 8px 0;
  font-size: 13px;
  color: #666;
  text-decoration: underline;
}

.cart-drawer-promo-toggle:hover {
  color: #333;
}

.cart-drawer-promo-toggle svg {
  transition: transform 0.3s;
}

.cart-drawer-promo.collapsed .cart-drawer-promo-toggle svg {
  transform: rotate(0deg);
}

.cart-drawer-promo:not(.collapsed) .cart-drawer-promo-toggle svg {
  transform: rotate(180deg);
}

.cart-drawer-promo:not(.collapsed) .cart-drawer-promo-input {
  margin-top: 12px;
}

/* Image Zoom Modal */
.zoom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  touch-action: none;
}

.zoom-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.zoom-modal-content.open {
  transform: scale(1);
  opacity: 1;
}

.zoom-close-btn {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.zoom-close-btn:hover {
  opacity: 1;
}

.zoom-image-container {
  max-width: 80vw;
  max-height: 70vh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  border-radius: 4px;
}

.zoom-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  transition: transform 0.3s ease;
  cursor: grab;
}

.zoom-image:active {
  cursor: grabbing;
}

.zoom-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.zoom-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.zoom-thumbnails {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  max-width: 80vw;
  overflow-x: auto;
}

.zoom-thumb {
  width: 60px;
  height: 60px;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s, border-color 0.2s;
}

.zoom-thumb:hover {
  opacity: 0.9;
}

.zoom-thumb.active {
  border-color: #ccae6a;
  opacity: 1;
}

.zoom-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Zoom Hint on Product Image */
.zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.product-main-image:hover .zoom-hint {
  opacity: 1;
}

/* Zoom hint text in Modal */
.zoom-hint-text {
  text-align: center;
  color: #888;
  font-size: 12px;
  margin-top: 8px;
}

/* Enhanced zoom container for drag */
.zoom-image-container {
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  touch-action: none;
}

.zoom-image-container .zoom-image {
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  touch-action: none;
}

@media (max-width: 600px) {
  .zoom-modal-content {
    max-width: 95vw;
  }
  
  .zoom-image-container {
    max-width: 95vw;
    max-height: 60vh;
  }
  
  .zoom-image {
    max-height: 60vh;
  }
  
  .zoom-thumbnails {
    max-width: 95vw;
  }
  
  .zoom-thumb {
    width: 50px;
    height: 50px;
  }
  
  .zoom-close-btn {
    top: -35px;
    font-size: 30px;
  }
}

/* Zoom Preview Modal - Like old version */
.zoom-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-preview-box {
  background: #fff;
  padding: 15px;
  border-radius: 4px;
  max-width: 95vw;
  max-height: 90vh;
  position: relative;
  box-shadow: 0 5px 30px rgba(0,0,0,0.5);
}

.zoom-preview-box > .zoom-hint-text {
  margin-bottom: 10px;
}

.zoom-preview-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 30px;
  height: 30px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  z-index: 10;
}

.zoom-preview-close:hover {
  background: #555;
}

.zoom-preview-content {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
}

.zoom-preview-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
  flex-shrink: 0;
}

.zoom-thumb {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border: 2px solid #ccc;
  cursor: pointer;
  transition: border-color 0.2s;
  background: #fff;
  pointer-events: auto !important;
  position: relative;
  z-index: 100;
}

.zoom-thumb:hover,
.zoom-thumb.active {
  border-color: #333;
}

.zoom-preview-main {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.zoom-hint-text {
  color: #999;
  font-family: Tahoma, Arial, Helvetica, Sans-Serif;
  font-size: 12px;
  font-style: italic;
  margin: 0 0 5px 0;
}

.zoom-lens-container {
  position: relative;
  width: 500px;
  height: 500px;
  background: #fff;
  border: 1px solid #ccc;
}

.zoom-lens-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.zoom-lens {
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid #aaa;
  cursor: crosshair;
  display: none;
  pointer-events: none;
}

.zoom-preview-result {
  width: 500px;
  height: 500px;
  background-repeat: no-repeat;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  display: block;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .zoom-preview-content {
    flex-wrap: wrap;
  }
  
  .zoom-preview-thumbs {
    flex-direction: row;
    max-height: none;
    width: 100%;
    justify-content: center;
  }
  
  .zoom-lens-container,
  .zoom-preview-result {
    width: 300px;
    height: 300px;
  }
}

@media (max-width: 600px) {
  .zoom-preview-result {
    display: none !important;
  }
  
  .zoom-lens-container {
    width: 280px;
    height: 280px;
  }
  
  .zoom-lens {
    display: none !important;
  }
}
