/* === AVMovieX UX Enhancements === */

/* --- Card Hover Enhancements --- */
/* Smoother card scale and shadow on hover */
a[href^="/watch/"] {
  transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  will-change: transform;
}
a[href^="/watch/"]:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.25),
              0 4px 12px rgba(0, 0, 0, 0.4);
  border-color: rgba(139, 92, 246, 0.4);
}
a[href^="/watch/"]:active {
  transform: translateY(-2px) scale(1.01);
}

/* --- Movie Code Badge Styling --- */
a[href^="/watch/"] span:first-of-type {
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #e9d5ff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  -webkit-text-fill-color: #e9d5ff;
}

/* --- Play Button Overlay on Card Hover --- */
a[href^="/watch/"]::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, rgba(139,92,246,0.15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
}
a[href^="/watch/"]:hover::after {
  opacity: 1;
}
/* Play triangle overlay */
a[href^="/watch/"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 14px 0 14px 24px;
  border-color: transparent transparent transparent rgba(255,255,255,0.9);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
  z-index: 3;
}
a[href^="/watch/"]:hover::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* --- Quality Badges (4K, HDTV, Uncensored) --- */
span:has(+ span:contains("4K")),
span:has(+ span:contains("HDTV")),
.badge-4k, .badge-hdtv {
  display: inline-flex !important;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bg-amber-500\/10 {
  background-color: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.bg-purple-500\/10 {
  background-color: rgba(139, 92, 246, 0.12) !important;
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.bg-red-500\/10 {
  background-color: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- Smooth image loading --- */
img[loading="lazy"] {
  transition: opacity 0.4s ease;
}
img[loading="lazy"]:not([src]) {
  opacity: 0;
}

/* --- Title text improvements --- */
a[href^="/watch/"] .line-clamp-2 {
  line-height: 1.5;
  font-size: 0.825rem;
  color: rgba(255, 255, 255, 0.9);
}

/* --- Responsive Grid Fine-Tuning --- */
@media (max-width: 640px) {
  .grid-cols-2 {
    gap: 0.5rem !important;
    padding: 0 0.25rem;
  }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .sm\:grid-cols-3 {
    gap: 0.75rem !important;
  }
}
@media (min-width: 1025px) {
  .md\:grid-cols-4 {
    gap: 1rem !important;
  }
}

/* --- Improve contrast on card overlays --- */
.gradient-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 50%, transparent 100%) !important;
}

/* --- Smooth page transitions --- */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Touch improvements for mobile --- */
@media (hover: none) and (pointer: coarse) {
  a[href^="/watch/"] {
    -webkit-tap-highlight-color: rgba(139, 92, 246, 0.2);
  }
  a[href^="/watch/"]:active {
    transform: scale(0.97);
    transition: transform 0.1s;
  }
}

/* --- Scrollbar styling for WebKit browsers --- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.5);
}

/* --- Footer improvements --- */
footer, nav[aria-label="legal"] {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

/* --- Search input glow on focus --- */
input[type="text"]:focus {
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3), 0 0 20px rgba(139, 92, 246, 0.1);
}

/* --- Optimize paint performance --- */
.grid {
  contain: layout style;
}
a[href^="/watch/"] img,
a[href^="/watch/"] picture {
  contain: content;
}
