/* Product Carousel Styles */
.product-detail-container {
  max-width: 800px;
  margin: 0 auto;
}

.product-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.product-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.product-description {
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.6;
  text-align: justify;
}

/* Carousel Styles */
.product-carousel {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
}

.carousel-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
}

.carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide.active {
  opacity: 1;
  transform: translateX(0);
}

.carousel-slide.prev {
  transform: translateX(-100%);
}

.carousel-slide:not(.active) {
  pointer-events: none;
}

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #f3f4f6;
}

/* Navigation Buttons */
.carousel-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.carousel-nav-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.carousel-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.carousel-prev {
  left: 20px;
}

.carousel-next {
  right: 20px;
}

.carousel-nav-btn svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* Dots Navigation */
.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: rgba(249, 250, 251, 0.95);
  border-top: 1px solid #e5e7eb;
}

.carousel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.carousel-dot:hover {
  border-color: #3b82f6;
  transform: scale(1.2);
}

.carousel-dot.active {
  background: #3b82f6;
  border-color: #3b82f6;
  transform: scale(1.3);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

/* Image Counter */
.carousel-counter {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.carousel-counter .current {
  color: #60a5fa;
}

/* No Images State */
.no-images-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 48px 32px;
  text-align: center;
  color: #9ca3af;
  background: #f9fafb;
  border: 2px dashed #d1d5db;
  border-radius: 16px;
}

.no-images-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.6;
  color: #d1d5db;
}

.no-images-text {
  font-size: 18px;
  font-weight: 500;
  color: #6b7280;
}

/* CSS-only carousel for fallback */
.carousel-slides-css {
  display: flex;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.carousel-slides-css::-webkit-scrollbar {
  display: none;
}

.carousel-slide-css {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

/* Hide CSS-only version when JS is available */
[data-controller*="product-carousel"] .carousel-slides-css {
  display: none;
}

[data-controller*="product-carousel"] .carousel-track {
  display: block;
}

/* Show CSS-only version when JS is not available */
.carousel-track {
  display: none;
}

/* Modal-specific styles */
.modal .product-detail-container {
  max-width: none;
  margin: 0;
}

.modal .product-carousel {
  border-radius: 12px;
  min-height: 300px;
}

.modal .carousel-container {
  aspect-ratio: 16/9;
  min-height: 300px;
}

.modal .product-header {
  margin-bottom: 1.5rem;
  text-align: left;
}

.modal .product-title {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.modal .product-description {
  font-size: 0.95rem;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .product-detail-container {
    padding: 0 1rem;
  }

  .product-title {
    font-size: 1.5rem;
  }

  .product-description {
    font-size: 0.95rem;
  }

  .product-carousel {
    border-radius: 12px;
  }

  .carousel-container {
    aspect-ratio: 4/3;
  }

  /* Modal mobile optimizations */
  .modal .product-detail-container {
    padding: 0;
  }

  .modal .carousel-container {
    aspect-ratio: 16/9;
    min-height: 250px;
  }

  .modal .product-header {
    text-align: center;
    margin-bottom: 1rem;
  }

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

  .carousel-prev {
    left: 16px;
  }

  .carousel-next {
    right: 16px;
  }

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

  .carousel-dots {
    padding: 16px;
    gap: 10px;
  }

  .carousel-dot {
    width: 10px;
    height: 10px;
  }

  .carousel-counter {
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    font-size: 12px;
  }

  .no-images-state {
    min-height: 250px;
    padding: 32px 24px;
  }

  .no-images-icon {
    width: 64px;
    height: 64px;
  }

  .no-images-text {
    font-size: 16px;
  }
}

/* Loading Animation */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-carousel {
  animation: slideIn 0.6s ease-out;
}

/* Smooth image loading */
.carousel-image {
  transition: opacity 0.3s ease;
}

.carousel-image:not([src]) {
  opacity: 0;
}

/* Focus styles for accessibility */
.carousel-nav-btn:focus,
.carousel-dot:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .carousel-nav-btn {
    border: 2px solid #000;
  }

  .carousel-dot {
    border-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .carousel-slide {
    transition: none;
  }

  .carousel-nav-btn,
  .carousel-dot {
    transition: none;
  }

  .product-carousel {
    animation: none;
  }
}
