/* Complete Disney+ Hero Carousel Styles - Rails 8 Edition */

:root {
  --disney-dark: #17171B;
  --disney-blue: #1976D2;
  --disney-text-primary: #FFFFFF;
  --disney-text-secondary: rgba(255, 255, 255, 0.8);
  --disney-text-muted: rgba(255, 255, 255, 0.6);
  --disney-overlay: rgba(0, 0, 0, 0.6);
  --disney-glass: rgba(255, 255, 255, 0.1);
  --disney-border: rgba(255, 255, 255, 0.2);
  --carousel-height-mobile: 70vh;
  --carousel-height-desktop: 60vh;
  --carousel-transition: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ==========================================
   FLICKS INDEX PAGE LAYOUT
========================================== */

/* Hero carousel section */
.hero-carousel-section {
  height: var(--carousel-height-mobile);
  min-height: 400px;
  max-height: 800px;
  display: block;
  width: 100%;
  position: relative;
  z-index: 1;
  overflow: hidden;
  background-color: var(--disney-dark);
}

@media (min-width: 768px) {
  .hero-carousel-section {
    height: var(--carousel-height-desktop);
    max-height: 500px;
  }
}

/* Shelf Collections Container */
.shelf-collections-container {
  background: #0e0e13;
  min-height: 60vh;
  padding: 2rem 0;
}

/* Content grid section */
.flicks-grid-section {
  background: #1a1a1f;
  padding: 2rem 0;
}

.no-content-section {
  background: #1a1a1f;
  padding: 4rem 0;
  min-height: 50vh;
  display: flex;
  align-items: center;
}

/* Utility classes */
.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.text-center { text-align: center; }
.text-white { color: #ffffff; }
.text-gray-300 { color: #d1d5db; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mb-8 { margin-bottom: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-6 { margin-top: 1.5rem; }

/* Button styles */
.bg-blue-600 { background-color: #2563eb; }
.bg-blue-700 { background-color: #1d4ed8; }
.hover\:bg-blue-700:hover { background-color: #1d4ed8; }
.transition-colors { transition-property: background-color, border-color, color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.rounded-lg { border-radius: 0.5rem; }

/* Link styles */
a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  text-decoration: none;
}

.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }

/* ==========================================
   HERO CAROUSEL STYLES
========================================== */

/* Main carousel container */
.hero-carousel {
  position: relative;
  width: 100%;
  height: var(--carousel-height-mobile);
  min-height: 400px;
  max-height: 800px;
  overflow: hidden;
  background: var(--disney-dark);
  color: var(--disney-text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

@media (min-width: 768px) {
  .hero-carousel {
    height: var(--carousel-height-desktop);
    max-height: 500px;
  }
}

.carousel-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* CRITICAL: Fix carousel track positioning */
.carousel-track {
  position: relative;
  display: flex;
  width: 100%; /* JavaScript will set this to 600% for 6 slides */
  height: 100%;
  transition: transform 0.6s var(--carousel-transition);
  will-change: transform;
  /* CRITICAL: Prevent wrapping */
  flex-wrap: nowrap;
}

.carousel-slide {
  position: relative;
  /* CRITICAL: Each slide must be exactly 1/n of track width */
  flex: 0 0 100%;
  min-width: 0; /* Prevent flex shrinking */
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #1a1a1a;
  /* CRITICAL: All slides should be visible in DOM */
  opacity: 1;
  visibility: visible;
}

@media (min-width: 768px) {
  .carousel-slide {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
}

.carousel-slide.active {
  opacity: 1;
}

/* Mobile poster card layout */
.mobile-poster-card {
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

@media (min-width: 768px) {
  .mobile-poster-card {
    display: none;
  }
}

.poster-image-container {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
}

.poster-image-container img,
.poster-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.poster-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
}

.placeholder-icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

.placeholder-text {
  font-size: 0.9rem;
  font-weight: 600;
}

.placeholder-content {
  text-align: center;
  padding: 2rem;
}

.poster-gradient-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
}

.poster-content-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  color: white;
}

.poster-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  line-height: 1.2;
}

.poster-meta {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.poster-rating {
  background: rgba(255,255,255,0.2);
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 8px;
}

/* Fix missing patent-specific styles */
.poster-patent-id {
  background: rgba(59, 130, 246, 0.8);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 8px;
}

.poster-date {
  color: rgba(255, 255, 255, 0.8);
  margin-right: 8px;
}

.poster-category {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
  text-transform: capitalize;
}

.poster-content-below {
  padding: 20px;
  background: #1a1a1a;
}

.poster-description {
  font-size: 0.9rem;
  color: #ccc;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.poster-actions {
  display: flex;
  gap: 0.5rem;
}

.poster-play-button {
  background: #3b82f6;
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  padding: 12px 20px;
  font-size: 0.9rem;
  justify-content: center;
  flex: 1;
}

.poster-play-button:hover {
  background: #2563eb;
}

.poster-trailer-button {
  background: rgba(255,255,255,0.2);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 12px 16px;
  font-size: 0.8rem;
}

.poster-trailer-button:hover {
  background: rgba(255,255,255,0.3);
}

.poster-external-button {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 12px 16px;
  font-size: 0.8rem;
}

.poster-external-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Desktop full background style */
.desktop-hero-style {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

@media (min-width: 768px) {
  .desktop-hero-style {
    display: block;
  }
}

.desktop-background-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
}

.desktop-background-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 1;
}

/* Fix desktop placeholder pattern */
.placeholder-pattern {
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.1) 2px, transparent 2px);
  background-size: 50px 50px;
  background-position: 0 0, 25px 25px;
}

.desktop-gradient-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.1) 100%);
  z-index: 2;
}

.carousel-content {
  position: absolute;
  bottom: 60px;
  left: 0;
  right: 0;
  z-index: 3;
  color: white;
  padding: 40px;
}

/* Fix desktop carousel content styles */
.carousel-badge {
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.category-badge {
  background: rgba(59, 130, 246, 0.8);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.patent-id-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.carousel-title {
  font-weight: bold;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  font-size: 3rem;
  line-height: 1.2;
}

.carousel-metadata {
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.meta-item {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  padding: 2px 0;
}

.meta-item:not(:last-child)::after {
  content: '•';
  margin-left: 1rem;
  color: rgba(255, 255, 255, 0.5);
}

.carousel-description {
  margin-bottom: 2rem;
  line-height: 1.4;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  font-size: 1.2rem;
  max-width: 600px;
}

.carousel-buttons {
  display: flex;
  gap: 1rem;
}

.play-button {
  background: #3b82f6;
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  padding: 12px 24px;
  font-size: 1rem;
}

.play-button:hover {
  background: #2563eb;
}

.trailer-button {
  background: rgba(255,255,255,0.2);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 12px 24px;
  font-size: 1rem;
}

.trailer-button:hover {
  background: rgba(255,255,255,0.3);
}

/* Fix button styles */
.secondary-button {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 12px 24px;
  font-size: 1rem;
  transition: background 0.2s;
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.info-button {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.info-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.button-icon {
  font-size: 1rem;
}

.button-text {
  font-size: 1rem;
}

/* Navigation Controls */
.carousel-indicators {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  bottom: 12px;
}

@media (min-width: 768px) {
  .carousel-indicators {
    bottom: 20px;
  }
}

.carousel-indicator {
  border-radius: 50%;
  background: white;
  border: none;
  cursor: pointer;
  transition: opacity 0.3s;
  width: 8px;
  height: 8px;
  opacity: 0.4;
}

@media (min-width: 768px) {
  .carousel-indicator {
    width: 12px;
    height: 12px;
  }
}

.carousel-indicator.active {
  opacity: 1;
}

.carousel-indicator:hover {
  opacity: 0.8;
}

/* Fix indicator styles */
.indicator-inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: background 0.3s;
  padding: 10px 12px;
  font-size: 16px;
}

@media (min-width: 768px) {
  .carousel-nav {
    padding: 15px 20px;
    font-size: 18px;
  }
}

.carousel-nav:hover {
  background: rgba(0,0,0,0.8);
}

.carousel-prev {
  left: 12px;
}

@media (min-width: 768px) {
  .carousel-prev {
    left: 20px;
  }
}

.carousel-next {
  right: 12px;
}

@media (min-width: 768px) {
  .carousel-next {
    right: 20px;
  }
}

.carousel-play-pause {
  position: absolute;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: background 0.3s;
  bottom: 12px;
  right: 12px;
  padding: 8px;
  font-size: 14px;
}

@media (min-width: 768px) {
  .carousel-play-pause {
    bottom: 20px;
    right: 20px;
    padding: 12px;
    font-size: 16px;
  }
}

.carousel-play-pause:hover {
  background: rgba(0,0,0,0.8);
}

/* Fix no-content fallback */
.no-carousel-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  background: var(--disney-dark);
  color: var(--disney-text-secondary);
  font-size: 1.2rem;
}

/* Fix hidden class utility */
.hidden {
  display: none !important;
}

/* CRITICAL: Ensure proper responsive behavior */
@media (max-width: 767px) {
  .carousel-slide {
    padding: 10px;
  }
  
  .desktop-hero-style {
    display: none !important;
  }
  
  .mobile-poster-card {
    display: block !important;
  }
}

@media (min-width: 768px) {
  .carousel-slide {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  
  .mobile-poster-card {
    display: none !important;
  }
  
  .desktop-hero-style {
    display: block !important;
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .carousel-track,
  .carousel-slide,
  .carousel-indicator,
  .carousel-nav {
    transition: none !important;
    animation: none !important;
  }
}

/* Debug styles for development - remove after confirming fix */
.carousel-slide:nth-child(1) { border-left: 3px solid #ff0000; }
.carousel-slide:nth-child(2) { border-left: 3px solid #00ff00; }
.carousel-slide:nth-child(3) { border-left: 3px solid #0000ff; }
.carousel-slide:nth-child(4) { border-left: 3px solid #ffff00; }
.carousel-slide:nth-child(5) { border-left: 3px solid #ff00ff; }
.carousel-slide:nth-child(6) { border-left: 3px solid #00ffff; }