/* ============================================
   KINAAV - Product Detail Image Styles
   Enhanced product display with Gallery & Zoom
   ============================================ */

/* -------------------- 1. Gallery Layout (Amazon Style) -------------------- */

/* Main Container: Holds Thumbnails (Left) and Main Image (Right) */
.gallery-container {
  display: flex;
  gap: 15px;
  width: 100%;
  align-items: flex-start; /* Aligns thumbnails to top */
}

/* Left Column: Vertical Thumbnails */
.thumbnail-column {
  width: 80px; /* Fixed width for thumbnail strip */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 600px; /* Prevents strip from getting too tall */
  overflow-y: auto;
  
  /* Hide scrollbar for a cleaner look */
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.thumbnail-column::-webkit-scrollbar {
  display: none;
}

/* Individual Thumbnail Images */
.thumb-btn {
  width: 100%;
  height: 80px; /* Square aspect ratio */
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  opacity: 0.6;
  background-color: var(--surface-card);
  transition: all 0.2s ease;
}

.thumb-btn:hover, 
.thumb-btn.active {
  opacity: 1;
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: var(--shadow-sm);
}

/* Right Column: Wrapper for the Main Zoom Box */
.main-image-wrapper {
  flex-grow: 1;
  position: relative;
  z-index: 1;
  min-width: 0; /* Prevents flexbox overflow issues */
}

/* -------------------- 2. Product Image Box (Zoom Container) -------------------- */
.product-image-box {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  
  /* Aspect Ratio controls height automatically based on width */
  aspect-ratio: 3 / 4; 
  width: 100%;
  
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
  transition: all var(--transition-base);
  animation: fadeIn 0.5s ease-out;
}

.product-image-box:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

/* -------------------- Main Image Element -------------------- */
.product-main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Smooth transform for subtle hover effect */
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: zoom-in;
}

/* Subtle scale on hover (works with EasyZoom) */
.product-image-box:hover .product-main-img {
  transform: scale(1.02);
}

/* -------------------- Zoom Lens (Future Enhancement) -------------------- */
.zoom-lens {
  position: absolute;
  border: 2px solid var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
  width: 100px;
  height: 100px;
  display: none;
  pointer-events: none;
  border-radius: var(--radius-sm);
}

/* -------------------- 3. Product Info Section -------------------- */
.product-info h2 {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 1rem;
  animation: fadeInUp 0.4s ease-out;
}

/* Variant selection */
.btn-group .btn-check + .btn-outline-primary {
  border: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.btn-group .btn-check:checked + .btn-outline-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-yellow);
}

.btn-group .btn-outline-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Price display */
#variant-price-container {
  font-size: 1.25rem;
  margin: 1rem 0;
  animation: fadeIn 0.3s ease-out;
}

#variant-price {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.5rem;
}

/* Stock info styling */
#variant-stock {
  margin: 1rem 0;
}

#variant-stock .text-warning {
  color: var(--warning) !important;
  font-weight: 500;
}

#variant-stock .text-danger {
  color: var(--danger) !important;
  font-weight: 500;
}

/* Add to cart form */
#add-to-cart-form {
  animation: fadeInUp 0.5s ease-out 0.2s backwards;
}

#add-to-cart-form input[type="number"] {
  width: 80px;
  text-align: center;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

#add-to-cart-form input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
  outline: none;
}

#add-to-cart-btn,
#buy-now-btn {
  padding: 0.625rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-md);
}

#add-to-cart-btn:hover,
#buy-now-btn:hover {
  transform: translateY(-2px);
}

/* -------------------- 4. Responsive Adjustments -------------------- */

/* Desktop: Large Screen Tweaks */
@media (min-width: 1400px) {
  .product-image-box {
    padding: 2rem;
  }
}

/* Mobile: Stack Gallery Vertically */
@media (max-width: 768px) {
  .gallery-container {
    flex-direction: column-reverse; /* Put thumbnails BELOW the main image */
  }

  .thumbnail-column {
    width: 100%;
    flex-direction: row; /* Horizontal scrolling strip */
    height: auto;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .thumb-btn {
    width: 60px;
    height: 60px;
    flex-shrink: 0; /* Prevents squishing */
  }

  .product-image-box {
    padding: 0.75rem;
    aspect-ratio: 1 / 1; /* Square images often look better on mobile */
  }
}