/* 3D Product Carousel - Rabbani Phone Custom Design */
/* Inspired by Uiverse.io by ilkhoeri - Enhanced for product showcase */

.product-carousel-3d-wrapper {
  width: 100%;
  min-height: 500px;
  position: relative;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 60px 20px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.03) 0%, rgba(0, 0, 0, 0.02) 100%);
  border-radius: 20px;
  margin: 40px 0;
}

.product-carousel-3d-inner {
  --w: 180px;
  --h: 280px;
  --translateZ: calc((var(--w) + var(--h)) * 0.8);
  --rotateX: -12deg;
  --perspective: 1400px;
  position: relative;
  width: var(--w);
  height: var(--h);
  z-index: 2;
  transform-style: preserve-3d;
  transform: perspective(var(--perspective)) rotateX(var(--rotateX));
  animation: rotating3d 25s linear infinite;
  cursor: grab;
}

.product-carousel-3d-inner:active {
  cursor: grabbing;
}

/* Pause animation on hover for better viewing */
.product-carousel-3d-inner:hover {
  animation-play-state: paused;
}

@keyframes rotating3d {
  from {
    transform: perspective(var(--perspective)) rotateX(var(--rotateX)) rotateY(0);
  }
  to {
    transform: perspective(var(--perspective)) rotateX(var(--rotateX)) rotateY(1turn);
  }
}

.product-carousel-3d-card {
  position: absolute;
  border: 3px solid rgba(var(--color-card), 0.6);
  border-radius: 16px;
  overflow: hidden;
  inset: 0;
  transform: rotateY(calc((360deg / var(--quantity)) * var(--index))) translateZ(var(--translateZ));
  background: linear-gradient(135deg, 
    rgba(var(--color-card), 0.08) 0%, 
    rgba(var(--color-card), 0.15) 50%,
    rgba(var(--color-card), 0.08) 100%
  );
  backdrop-filter: blur(10px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.product-carousel-3d-card:hover {
  border-color: rgba(var(--color-card), 1);
  box-shadow: 
    0 12px 48px rgba(var(--color-card), 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: rotateY(calc((360deg / var(--quantity)) * var(--index))) translateZ(calc(var(--translateZ) + 20px));
}

.product-carousel-3d-img {
  width: 100%;
  height: 65%;
  object-fit: cover;
  background: 
    linear-gradient(
      135deg,
      rgba(var(--color-card), 0.1) 0%,
      rgba(var(--color-card), 0.3) 50%,
      rgba(var(--color-card), 0.5) 100%
    );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.product-carousel-3d-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  transition: transform 0.3s ease;
}

.product-carousel-3d-card:hover .product-carousel-3d-img img {
  transform: scale(1.05);
}

/* Product info section */
.product-carousel-3d-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.7) 70%,
    transparent 100%
  );
  color: white;
  text-align: center;
  backdrop-filter: blur(5px);
}

.product-carousel-3d-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: rgba(var(--color-card), 1);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

.product-carousel-3d-price {
  font-size: 14px;
  font-weight: 800;
  color: #d4af37;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  margin-top: 2px;
}

.product-carousel-3d-specs {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Gold theme color variations for Rabbani Phone */
.carousel-color-1 { --color-card: 212, 175, 55; } /* Gold */
.carousel-color-2 { --color-card: 255, 215, 0; } /* Bright Gold */
.carousel-color-3 { --color-card: 218, 165, 32; } /* Dark Gold */
.carousel-color-4 { --color-card: 255, 193, 37; } /* Amber */
.carousel-color-5 { --color-card: 184, 134, 11; } /* Bronze */
.carousel-color-6 { --color-card: 255, 140, 0; } /* Orange Gold */

/* Control buttons */
.carousel-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 10;
}

.carousel-control-btn {
  background: linear-gradient(135deg, #d4af37 0%, #f4e17a 100%);
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
  color: #000;
  font-size: 18px;
}

.carousel-control-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.carousel-control-btn:active {
  transform: scale(0.95);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .product-carousel-3d-wrapper {
    min-height: 400px;
    padding: 40px 10px;
  }

  .product-carousel-3d-inner {
    --w: 140px;
    --h: 220px;
    --translateZ: calc((var(--w) + var(--h)) * 0.7);
  }

  .product-carousel-3d-name {
    font-size: 11px;
  }

  .product-carousel-3d-price {
    font-size: 12px;
  }

  .product-carousel-3d-specs {
    font-size: 9px;
  }

  .carousel-control-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .product-carousel-3d-inner {
    --w: 120px;
    --h: 190px;
    --translateZ: calc((var(--w) + var(--h)) * 0.6);
  }
}

/* Dark mode support */
body.dark-mode .product-carousel-3d-wrapper {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
}

body.dark-mode .product-carousel-3d-card {
  background: linear-gradient(135deg, 
    rgba(var(--color-card), 0.12) 0%, 
    rgba(var(--color-card), 0.2) 50%,
    rgba(var(--color-card), 0.12) 100%
  );
}

body.dark-mode .product-carousel-3d-info {
  background: linear-gradient(
    to top,
    rgba(13, 17, 23, 0.95) 0%,
    rgba(13, 17, 23, 0.8) 70%,
    transparent 100%
  );
}

/* Loading animation */
@keyframes shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.product-carousel-3d-loading {
  animation: shimmer 1.5s ease-in-out infinite;
}

/* Info overlay on mobile tap */
.carousel-mobile-info {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.85));
  color: white;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}

.carousel-mobile-info.active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .carousel-mobile-info {
    display: block;
  }
}

/* Mobile info panel styling */
.carousel-mobile-info {
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-info-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.3s ease;
}

.mobile-info-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.mobile-info-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #d4af37;
}

.mobile-info-price {
  font-size: 24px;
  font-weight: 800;
  color: #d4af37;
  margin: 10px 0;
}

.mobile-info-specs {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 15px;
}

.mobile-info-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  text-decoration: none;
}

/* Instructions text */
.carousel-instructions {
  text-align: center;
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}

body.dark-mode .carousel-instructions {
  color: rgba(255, 255, 255, 0.5);
}

/* Accessibility improvements */
.product-carousel-3d-card:focus {
  outline: 3px solid #d4af37;
  outline-offset: 3px;
}

.carousel-control-btn:focus {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

/* Performance optimization */
.product-carousel-3d-inner * {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .product-carousel-3d-inner {
    animation: none !important;
  }
  
  * {
    transition: none !important;
  }
}
