/* ============================================================================
   HORIZONTAL SCROLL CARDS - Optimized CSS with Mobile Fixes
   ============================================================================ */

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Scroll snap alignment */
.snap-start {
  scroll-snap-align: start;
}

/* Prevent body scroll when touching horizontal scroll area on mobile */
#products-scroll {
  /* Prevent vertical scroll bounce */
  overscroll-behavior-x: contain;
  overscroll-behavior-y: none;
  /* Only allow horizontal scrolling */
  touch-action: pan-x;
  /* Explicit scroll-snap properties to prevent purge */
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}

/* Ensure flex children don't wrap */
#products-scroll > .flex {
  flex-wrap: nowrap;
}

/* Ensure each flex child has fixed width */
#products-scroll > .flex > * {
  flex: 0 0 auto;
}

/* Modern Card Design */
.card-modern {
  background: white;
  border-radius: 1rem;
  transition: box-shadow 0.2s ease;
  position: relative;
  /* Prevent text selection on mobile */
  -webkit-user-select: none;
  user-select: none;
}

.card-modern:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Fix for IMDB rating badge visibility */
.card-modern .relative {
  position: relative;
  z-index: 1;
}

.card-modern .absolute {
  position: absolute;
}

/* Ensure badges are visible above image */
.card-modern .absolute[style*="z-index: 15"] {
  z-index: 15 !important;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 1rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* Add to Cart Button */
.btn-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  -webkit-tap-highlight-color: transparent;
}

.btn-cart:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-cart:active {
  transform: translateY(0);
}

.btn-cart:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Badge Styles */
.badge-cart {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Line Clamp Utility */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Text Drop Shadow */
.drop-shadow-lg {
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

/* Backdrop Blur */
.backdrop-blur-sm {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Loading State for Buttons */
.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

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

/* Success State Animation */
.success::before {
  content: '✓';
  position: absolute;
  font-size: 1.25rem;
  animation: checkmark 0.5s ease;
}

@keyframes checkmark {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  50% { transform: scale(1.3) rotate(0deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Section Scroll Margin */
#nieuw {
  scroll-margin-top: 5rem;
}

/* Prevent zoom on input focus (mobile) */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
textarea,
select {
  font-size: 16px !important;
}

/* Mobile Touch Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover effects on touch devices */
  .card-modern:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .btn-primary:hover,
  .btn-cart:hover {
    transform: none;
  }

  /* Larger touch targets */
  .btn-cart {
    padding: 0.875rem 1rem;
    min-height: 48px;
  }

  /* Improve tap feedback */
  .btn-cart:active,
  .btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
}

/* Mobile Specific Styles (< 640px) */
@media (max-width: 640px) {
  /* Lock body scroll when horizontal scroll is active */
  body.scroll-lock {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  /* Product cards minimum height */
  .card-modern {
    min-height: 380px;
  }

  /* Adjust button sizes on mobile */
  .btn-cart {
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
  }

  .badge-cart {
    top: -4px;
    right: -4px;
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
  }

  /* Hide scroll arrows on mobile */
  #scroll-left,
  #scroll-right {
    display: none !important;
  }

  /* Improve horizontal scroll container */
  #products-scroll {
    /* Add some padding for better edge visibility */
    scroll-padding: 0 1rem;
    /* Smooth momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
  }
}

/* Tablet Optimizations (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .card-modern {
    min-height: 390px;
  }

  /* Hide scroll arrows on tablet */
  #scroll-left,
  #scroll-right {
    display: none !important;
  }

  /* Smooth scrolling on tablets */
  #products-scroll {
    -webkit-overflow-scrolling: touch;
  }
}

/* Desktop Optimizations (> 1024px) */
@media (min-width: 1025px) {
  .card-modern {
    min-height: 400px;
  }

  /* Show scroll buttons on desktop */
  #scroll-left,
  #scroll-right {
    display: flex !important;
  }
}

/* Animate Float Utility */
.animate-float {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

/* Accessibility: Focus States */
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.5);
  outline-offset: 2px;
}

/* Remove tap highlight on mobile */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Prevent text selection in buttons */
button,
.btn-primary,
.btn-cart {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Prevent bounce scrolling on iOS */
  #products-scroll {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
  }

  /* Fix for iOS Safari button appearance */
  button,
  .btn-cart,
  .btn-primary {
    -webkit-appearance: none;
    appearance: none;
  }
}

/* Android-specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  /* Improve scroll performance on Android */
  #products-scroll {
    will-change: scroll-position;
  }
}

/* ============================================================================
   LIGHTBOX / MODAL
   ============================================================================ */

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-image {
  display: none;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-image.active {
  display: block;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 24px;
  font-weight: bold;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.3s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 60px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.3s ease;
  font-weight: 300;
  line-height: 1;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 30px;
}

.lightbox-next {
  right: 30px;
}

.lightbox-counter {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 18px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 20px;
  z-index: 10001;
}

@media (max-width: 768px) {
  .lightbox-close {
    top: 10px;
    right: 10px;
    font-size: 40px;
    padding: 5px 15px;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 40px;
    width: 50px;
    height: 50px;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-counter {
    bottom: 20px;
    font-size: 14px;
    padding: 8px 16px;
  }

  .lightbox-content {
    max-width: 95vw;
    max-height: 85vh;
  }
}