/**
 * Modern Smooth Slider Styles
 * Eye-catching, smooth, and elegant slider experience
 */

/* Modern Slider Container */
.modern-slider {
  display: flex;
  overflow-x: auto;
  overflow-y: visible; /* allow vertical growth of taller cards */
  scroll-behavior: smooth;
  gap: 2rem;
  padding: 2rem 1rem 2.5rem; /* extra bottom space for shadows */
  position: relative;
  
  /* Hide scrollbar but keep functionality */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modern-slider::-webkit-scrollbar {
  display: none;
}

/* Smooth momentum scrolling for iOS */
.modern-slider {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

/* Modern Navigation Buttons */
.modern-nav-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.15),
    0 4px 16px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e40af;
  z-index: 20;
}

/* Ensure buttons sit above content but allow interaction */
.modern-slider + .modern-nav-btn { pointer-events: auto; }

/* General small-screen adjustments */
@media (max-width: 640px) {
  .modern-nav-btn {
    width:48px;
    height:48px;
  }
  /* Move nav buttons BELOW the slider so they do not cover card content */
  .modern-slider { margin-bottom: 70px; }
  #smartphones-slider-left, #laptops-slider-left, #proteins-slider-left,
  #smartphones-slider-right, #laptops-slider-right, #proteins-slider-right {
    top: auto;
    bottom: -60px; /* place below slider */
    transform: none;
  }
  #smartphones-slider-left, #laptops-slider-left, #proteins-slider-left { left: 50%; transform: translateX(-110%); }
  #smartphones-slider-right, #laptops-slider-right, #proteins-slider-right { right: 50%; transform: translateX(110%); }
}

/* Very small screens: tighten spacing of below-slider buttons */
@media (max-width: 430px) {
  #smartphones-slider-left, #laptops-slider-left, #proteins-slider-left,
  #smartphones-slider-right, #laptops-slider-right, #proteins-slider-right {
    bottom: -56px;
  }
  #smartphones-slider-left, #laptops-slider-left, #proteins-slider-left { transform: translateX(-115%); }
  #smartphones-slider-right, #laptops-slider-right, #proteins-slider-right { transform: translateX(115%); }
}

/* Ultra narrow: further reduce size */
@media (max-width: 360px) {
  .modern-nav-btn { width:42px; height:42px; }
  #smartphones-slider-left, #laptops-slider-left, #proteins-slider-left,
  #smartphones-slider-right, #laptops-slider-right, #proteins-slider-right { bottom: -52px; }
}

/* Preserve existing translateY from Tailwind (-translate-y-1/2) when scaling */
.modern-nav-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.2),
    0 6px 20px rgba(59, 130, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  color: #1d4ed8;
}

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

.modern-nav-btn i {
  font-size: 28px;
  font-weight: bold;
}

/* Enhanced Product Cards */
.modern-slider .crystal-card {
  flex: 0 0 auto;
  width: 340px;
  height: 420px;
  scroll-snap-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(59, 130, 246, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Card Hover Effects */
.modern-slider .crystal-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 
    0 32px 64px rgba(0, 0, 0, 0.15),
    0 16px 32px rgba(59, 130, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  border-color: rgba(59, 130, 246, 0.4);
}

/* Shimmer Effect on Hover */
.modern-slider .crystal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.modern-slider .crystal-card:hover::before {
  left: 100%;
}

/* Card Content Positioning */
.modern-slider .crystal-card > * {
  position: relative;
  z-index: 2;
}

/* Product Image Styling */
.modern-slider .crystal-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  margin-bottom: 1rem;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.modern-slider .crystal-card:hover img {
  transform: scale(1.05);
}

/* Product Title Styling */
.modern-slider .crystal-card h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.75rem;
  line-height: 1.3;
  font-family: 'Poppins', sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Product Description */
.modern-slider .crystal-card .crystal-card-desc {
  font-size: 1rem;
  color: #6366f1;
  margin-bottom: 1rem;
  line-height: 1.4;
  font-weight: 500;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.modern-slider .crystal-card:hover .crystal-card-desc {
  opacity: 1;
}

/* Rating Stars */
.modern-slider .crystal-card .rating {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  margin-bottom: 1rem;
}

.modern-slider .crystal-card .rating i {
  font-size: 18px;
  transition: transform 0.2s ease;
}

.modern-slider .crystal-card:hover .rating i {
  transform: scale(1.1);
}

/* Price Styling */
.modern-slider .crystal-card .price {
  font-size: 1.3rem;
  font-weight: 700;
  color: #059669;
  margin-bottom: 1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* View Details Button */
.modern-slider .crystal-card .view-details-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.modern-slider .crystal-card .view-details-btn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.modern-slider .crystal-card .view-details-btn i {
  transition: transform 0.3s ease;
}

.modern-slider .crystal-card .view-details-btn:hover i {
  transform: translateX(3px);
}

/* Floating Animation for Cards */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-6px);
  }
}

.modern-slider .crystal-card:nth-child(odd) {
  animation: float 6s ease-in-out infinite;
  animation-delay: 0s;
}

.modern-slider .crystal-card:nth-child(even) {
  animation: float 6s ease-in-out infinite;
  animation-delay: 3s;
}

/* Disable animation on hover for better UX */
.modern-slider .crystal-card:hover {
  animation: none;
}

/* Gradient Overlay for Visual Appeal */
.modern-slider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(102, 126, 234, 0.05) 0%,
    transparent 20%,
    transparent 80%,
    rgba(139, 92, 246, 0.05) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Progress Indicator */
.slider-progress {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.slider-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 2px;
  transition: transform 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modern-slider {
    gap: 1rem;
    padding: 1rem 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  
  .modern-slider .enhanced-card {
    width: 280px;
    height: 380px;
    scroll-snap-align: start;
    flex-shrink: 0;
  }
  
  .modern-nav-btn {
    width: 50px;
    height: 50px;
  }
  
  .modern-nav-btn i {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .modern-slider {
    padding: 0.5rem 0.25rem;
    gap: 0.75rem;
  }
  
  .modern-slider .enhanced-card {
    width: 260px;
    height: 360px;
    padding: 1rem;
  }
  
  .modern-nav-btn {
    width: 45px;
    height: 45px;
    left: 8px;
    right: 8px;
  }
}

/* Loading Animation */
.modern-slider.loading {
  opacity: 0.7;
}

.modern-slider.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 4px solid rgba(59, 130, 246, 0.3);
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10;
}

/* Utility wrapper to ensure nav button positioning is consistent */
.slider-full-bleed { position: relative; }

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}
