/* ============================================================
   MovieBazar — custom styles, animations & mobile polish
   Tailwind handles layout; this file handles the "wow" factor.
   ============================================================ */

:root {
  --accent: #f97316;
  --night: #05070d;
}

html { -webkit-tap-highlight-color: transparent; }
body { background: var(--night); overflow-x: hidden; }
body.modal-open { overflow: hidden; }

::selection { background: rgba(249, 115, 22, .35); color: #fff; }

/* Ambient cinematic background */
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(249, 115, 22, .14), transparent 60%),
    radial-gradient(50% 35% at 90% 10%, rgba(6, 182, 212, .10), transparent 60%),
    radial-gradient(70% 50% at 50% 110%, rgba(139, 92, 246, .10), transparent 60%);
}

/* Scrollbars */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }
* { scrollbar-width: thin; scrollbar-color: #27272a transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: #27272a; border-radius: 999px; }

/* Hero */
.hero-backdrop {
  position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px);
  object-fit: cover; filter: blur(22px) saturate(1.25) brightness(.7);
  transform: scale(1.12); opacity: .5; z-index: 0;
}
.hero-vignette {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(180deg, rgba(5,7,13,.35) 0%, rgba(5,7,13,.72) 55%, var(--night) 100%),
    radial-gradient(80% 60% at 50% 0%, transparent 40%, rgba(5,7,13,.6) 100%);
}
.poster-card {
  position: relative; border-radius: 1rem; overflow: hidden;
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.09), 0 0 46px -12px var(--accent);
  animation: float 6s ease-in-out infinite;
}
.poster-card img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Animated action buttons — the two most important CTAs */
.btn-action {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: center; gap: .8rem;
  border-radius: 1.1rem; font-weight: 800; letter-spacing: .01em; color: #fff;
  transition: transform .18s ease, box-shadow .3s ease, filter .3s ease;
  will-change: transform;
}
.btn-action::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(115deg, transparent 28%, rgba(255,255,255,.55) 48%, transparent 68%);
  transform: translateX(-130%); animation: shine 2.8s ease-in-out infinite;
}
.btn-action:hover { filter: brightness(1.1) saturate(1.06); transform: translateY(-2px) scale(1.01); }
.btn-action:active { transform: scale(.96); }
.hero-cta {
  border: 1.5px solid rgba(255,255,255,.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 -2px 6px rgba(0,0,0,.18), 0 16px 38px -16px rgba(0,0,0,.8);
}
.btn-watch {
  background: linear-gradient(135deg, #ffb347 0%, #ff6a3d 35%, #ef4444 65%, #e11d48 100%);
  animation: glowRed 2.2s ease-in-out infinite;
}
.btn-download {
  background: linear-gradient(135deg, #5eead4 0%, #22d3ee 35%, #06b6d4 65%, #3b82f6 100%);
  animation: glowCyan 2.2s ease-in-out infinite .55s;
}
/* Attractive CTA icons */
.cta-ico {
  position: relative; display: grid; place-items: center; flex-shrink: 0;
  width: 2.9rem; height: 2.9rem; border-radius: 999px; font-size: 1.05rem;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.5), rgba(255,255,255,.16) 60%);
  border: 1.5px solid rgba(255,255,255,.5);
  box-shadow: inset 0 2px 6px rgba(255,255,255,.4), inset 0 -3px 8px rgba(0,0,0,.2), 0 8px 18px -8px rgba(0,0,0,.6);
}
.cta-ico-watch::before, .cta-ico-watch::after {
  content: ""; position: absolute; inset: -3px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.6); animation: ctaRing 1.9s ease-out infinite;
}
.cta-ico-watch::after { animation-delay: .95s; }
.cta-ico-watch i { margin-left: 3px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.cta-ico-dl i { animation: dlBounce 1.7s ease-in-out infinite; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.cta-spark {
  position: absolute; top: -5px; right: -5px; font-size: .6rem; color: #fff;
  text-shadow: 0 0 8px rgba(255,255,255,.95); animation: sparkle 1.8s ease-in-out infinite;
}
.cta-arrow { margin-left: auto; font-size: .8rem; opacity: .9; animation: nudge 1.6s ease-in-out infinite; }
.btn-icon { transition: transform .18s ease, background .2s ease, color .2s ease; }
.btn-icon:active { transform: scale(.9); }

/* Play pulse */
.play-pulse { position: relative; }
.play-pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.7); animation: pulseRing 1.8s ease-out infinite;
}
.trailer-play { box-shadow: 0 0 0 7px rgba(239,68,68,.18), 0 18px 44px -12px rgba(239,68,68,.95); }

/* Cards & sections */
.section-card {
  background: rgba(255,255,255,.032);
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 1.25rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px -24px rgba(0,0,0,.8);
}
.glass { background: rgba(11,17,32,.72); backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.08); }
.text-gradient { background: linear-gradient(90deg, #fb923c, #f43f5e 60%, #fb923c); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Section nav pills */
.nav-pill {
  flex: 0 0 auto; border-radius: 999px; padding: .45rem .95rem; font-size: .8rem; font-weight: 600;
  color: #a1a1aa; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  transition: all .25s ease; white-space: nowrap;
}
.nav-pill.active { color: #fff; background: linear-gradient(135deg, rgba(249,115,22,.9), rgba(244,63,94,.9)); border-color: transparent; box-shadow: 0 6px 20px -8px rgba(244,63,94,.8); }

/* Cast & related */
.cast-card { transition: transform .25s ease; }
.cast-card:active { transform: scale(.95); }
.cast-card img { box-shadow: 0 10px 26px -14px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.08); }
.related-card { transition: transform .25s ease, box-shadow .25s ease; }
.related-card:hover { transform: translateY(-4px); }
.related-card:hover img { transform: scale(1.06); }
.related-card img { transition: transform .5s ease; }
.related-card:active { transform: scale(.96); }

/* Gallery */
.gallery-item { position: relative; overflow: hidden; border-radius: .9rem; cursor: zoom-in; }
.gallery-item img { transition: transform .5s ease; }
.gallery-item:hover img { transform: scale(1.07); }
.gallery-item::after { content: "\f00e"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: .5rem; bottom: .5rem; width: 1.75rem; height: 1.75rem; display: grid; place-items: center; border-radius: .5rem; background: rgba(0,0,0,.55); color: #fff; font-size: .75rem; opacity: 0; transition: opacity .25s; }
.gallery-item:hover::after { opacity: 1; }

/* Download quality cards */
.quality-card { border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); border-radius: 1rem; transition: border-color .2s, box-shadow .2s, transform .2s; }
.quality-card:hover { border-color: rgba(255,255,255,.2); }
.quality-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 30px -18px var(--accent); }
.quality-card:active { transform: scale(.99); }

/* Stars */
.star-on { color: #f5c518; }
.star-off { color: #3f3f46; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .65s ease, transform .65s ease; }
.reveal.revealed { opacity: 1; transform: none; }

/* Modals / sheets */
.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.78); backdrop-filter: blur(10px); }
.modal-panel { position: relative; width: 100%; max-width: 42rem; transform: translateY(24px) scale(.97); opacity: 0; transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .32s ease; }
.modal.open .modal-panel { transform: none; opacity: 1; }
.sheet { align-items: flex-end; padding: 0; }
.sheet .modal-panel { max-width: 34rem; border-radius: 1.5rem 1.5rem 0 0; transform: translateY(100%); opacity: 1; }
.sheet.open .modal-panel { transform: none; }

/* Lightbox */
.lightbox-img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: .75rem; box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); }

/* Toast */
.toast {
  display: flex; align-items: center; gap: .6rem; max-width: 92vw;
  background: rgba(17,24,39,.95); border: 1px solid rgba(255,255,255,.12); color: #fff;
  padding: .7rem 1rem; border-radius: .9rem; font-size: .85rem; font-weight: 600;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.8); backdrop-filter: blur(12px);
  animation: toastIn .3s cubic-bezier(.2,.8,.2,1);
}
.toast.out { animation: toastOut .3s ease forwards; }

/* Ripple */
.ripple-host { position: relative; overflow: hidden; }
.ripple { position: absolute; border-radius: 9999px; background: rgba(255,255,255,.45); transform: scale(0); animation: ripple .65s ease-out forwards; pointer-events: none; }

/* Sticky mobile bar */
#stickyBar { transform: translateY(110%); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
#stickyBar.show { transform: translateY(0); }

/* Drawer */
#drawer { transition: transform .35s cubic-bezier(.2,.8,.2,1); }

/* Loader */
#loader { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; gap: 1rem; align-items: center; justify-content: center; background: var(--night); transition: opacity .5s ease; }
#loader.hide { opacity: 0; pointer-events: none; }
.loader-ring { width: 52px; height: 52px; border-radius: 999px; border: 3px solid rgba(255,255,255,.1); border-top-color: #f97316; border-right-color: #f43f5e; animation: spin 1s linear infinite; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, #111827 25%, #1f2937 50%, #111827 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

/* Misc */
.safe-bottom { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + .6rem); }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-4 { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] .chev { transform: rotate(180deg); }
.chev { transition: transform .25s ease; }
input, textarea, button { font: inherit; }
:focus-visible { outline: 2px solid rgba(249,115,22,.8); outline-offset: 2px; border-radius: .4rem; }

/* Keyframes */
@keyframes shine { 0% { transform: translateX(-130%); } 55%, 100% { transform: translateX(130%); } }
@keyframes glowRed {
  0%,100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 0 0 1px rgba(255,255,255,.16), 0 14px 34px -14px rgba(239,68,68,.9), 0 0 34px -6px rgba(249,115,22,.55); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 0 0 1px rgba(255,255,255,.3), 0 18px 46px -12px rgba(239,68,68,1), 0 0 56px -4px rgba(249,115,22,.9); }
}
@keyframes glowCyan {
  0%,100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 0 0 1px rgba(255,255,255,.16), 0 14px 34px -14px rgba(6,182,212,.9), 0 0 34px -6px rgba(59,130,246,.55); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 0 0 1px rgba(255,255,255,.3), 0 18px 46px -12px rgba(6,182,212,1), 0 0 56px -4px rgba(59,130,246,.9); }
}
@keyframes ctaRing { 0% { transform: scale(.92); opacity: .85; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes dlBounce { 0%,100% { transform: translateY(-1px); } 50% { transform: translateY(3px); } }
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes sparkle { 0%,100% { transform: scale(.7) rotate(0deg); opacity: .6; } 50% { transform: scale(1.25) rotate(25deg); opacity: 1; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes pulseRing { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(10px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
