/**
 * FilmyBazaar Ultimate Premium Streaming — 2026 design layer
 * Cinematic detail · rails · retention · mobile-first chrome
 */

/* ── Quick section navigator ── */
.fb-quick-rail {
  position: sticky;
  top: var(--fb-quick-top, 64px);
  z-index: 850;
  padding: 0.65rem clamp(1rem, 3vw, 2rem);
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.92) 0%, rgba(10, 10, 10, 0.75) 100%);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--fb-glass-border, rgba(255, 255, 255, 0.08));
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.fb-quick-rail::-webkit-scrollbar {
  display: none;
}

.fb-quick-rail-inner {
  display: flex;
  gap: 0.5rem;
  min-width: min-content;
}

.fb-quick-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #c8c8c8);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.2s var(--fb-ease, ease), background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.fb-quick-chip i {
  font-size: 0.72rem;
  color: var(--fb-red, #e50914);
}

.fb-quick-chip:hover,
.fb-quick-chip.fb-quick-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(229, 9, 20, 0.35), rgba(138, 43, 226, 0.2));
  border-color: rgba(229, 9, 20, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.25);
}

/* ── Daily discovery marquee ── */
.fb-daily-discovery {
  margin: 0 clamp(1rem, 3vw, 2rem) 1.25rem;
  padding: 1.25rem 1.35rem;
  border-radius: var(--fb-radius-lg, 20px);
  background: linear-gradient(125deg, rgba(229, 9, 20, 0.18) 0%, rgba(10, 10, 10, 0.9) 40%, rgba(0, 200, 255, 0.12) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  position: relative;
  overflow: hidden;
  opacity: 1;
  transform: none;
}

.fb-daily-discovery::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(255, 215, 0, 0.12), transparent 50%);
  pointer-events: none;
}

.fb-daily-discovery-text {
  position: relative;
  z-index: 1;
}

.fb-daily-discovery-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fb-gold, #ffd700);
  margin-bottom: 0.35rem;
}

.fb-daily-discovery h2 {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  font-weight: 700;
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.fb-daily-discovery p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary, #c8c8c8);
  max-width: 48ch;
}

.fb-daily-discovery-btn {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.fb-daily-discovery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.fb-daily-discovery-tcmp {
  border-color: rgba(255, 184, 90, 0.45) !important;
  color: #ffe4b8 !important;
  background: rgba(255, 184, 90, 0.08) !important;
}

@media (max-width: 640px) {
  .fb-daily-discovery {
    grid-template-columns: 1fr;
  }

  .fb-daily-discovery-actions {
    width: 100%;
    justify-content: stretch;
  }

  .fb-daily-discovery-actions .btn {
    flex: 1 1 calc(50% - 0.3rem);
    justify-content: center;
  }
}

/* ── Section rails with arrows ── */
.fb-section-rail-wrap {
  position: relative;
}

.fb-rail-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.fb-section-rail-wrap:hover .fb-rail-nav,
.fb-section-rail-wrap:focus-within .fb-rail-nav {
  opacity: 1;
}

.fb-rail-nav:hover {
  background: var(--fb-red, #e50914);
  transform: translateY(-50%) scale(1.06);
}

.fb-rail-prev {
  left: 0.25rem;
}

.fb-rail-next {
  right: 0.25rem;
}

@media (max-width: 768px) {
  .fb-rail-nav {
    width: 36px;
    height: 36px;
    opacity: 0.85;
  }
}

/* ── Recently viewed compact strip ── */
#recently-viewed .slider {
  grid-auto-columns: min(140px, 32vw);
}

#recently-viewed .movie-poster {
  height: 200px;
}

/* ── Cinematic detail modal ── */
#movieModal .modal-container.fb-detail-modal {
  max-width: min(1100px, 96vw);
  width: 96%;
  padding: 0;
  overflow: hidden;
  background: #0a0a0a;
}

#movieModal .modal-content {
  padding: 0;
}

#movieModal .modal-close {
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.fb-detail-cinematic {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.fb-detail-hero {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  isolation: isolate;
}

.fb-detail-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: brightness(0.45) saturate(1.15);
  transform: scale(1.02);
}

.fb-detail-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, #0a0a0a 0%, rgba(10, 10, 10, 0.4) 45%, transparent 100%),
    linear-gradient(90deg, rgba(10, 10, 10, 0.95) 0%, rgba(10, 10, 10, 0.5) 50%, transparent 100%);
}

.fb-detail-hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: min(160px, 28vw) 1fr;
  gap: 1.25rem;
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 1.75rem;
  width: 100%;
  align-items: end;
}

.fb-detail-poster-wrap img {
  width: 100%;
  border-radius: var(--fb-radius, 14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  aspect-ratio: 2/3;
  object-fit: cover;
}

.fb-detail-hero-copy h2 {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 0.5rem;
  color: #fff;
}

.fb-detail-type-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fb-blue, #00c8ff);
  margin-left: 0.5rem;
}

.fb-detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-secondary, #c8c8c8);
}

.fb-detail-meta-row .fb-detail-score {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  background: #f5c518;
  color: #111;
  font-weight: 800;
}

.fb-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.fb-detail-body {
  padding: 0 clamp(1rem, 3vw, 2rem) 1.5rem;
}

.fb-detail-body .movie-description {
  font-size: 0.95rem;
  line-height: 1.75;
  margin: 0 0 1.25rem;
}

.fb-detail-episode {
  background: var(--fb-glass, rgba(18, 18, 18, 0.72));
  border: 1px solid var(--fb-glass-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--fb-radius, 14px);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.fb-detail-episode h3 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  color: #fff;
}

.fb-detail-episode .fb-ep-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.fb-detail-similar {
  padding: 0 clamp(1rem, 3vw, 2rem) 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.fb-detail-similar h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fb-detail-similar h3 i {
  color: var(--fb-red, #e50914);
}

.fb-similar-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(130px, 28vw);
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
}

.fb-similar-rail .movie-card {
  scroll-snap-align: start;
}

.fb-similar-rail .movie-poster {
  height: 195px;
}

/* Legacy detail layout inside cinematic shell */
.fb-detail-cinematic .movie-detail {
  display: none;
}

.fb-detail-cinematic .cast-section {
  margin-top: 0;
}

.fb-detail-cinematic .cast-section h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

/* ── Mobile bottom navigation ── */
.fb-mobile-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 980;
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
}

.fb-mobile-dock-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.15rem;
  max-width: 520px;
  margin: 0 auto;
}

.fb-dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.2rem;
  border: none;
  background: none;
  color: var(--text-muted, #6b6b6b);
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.fb-dock-btn i {
  font-size: 1.15rem;
}

.fb-dock-btn.fb-dock-active,
.fb-dock-btn:hover {
  color: #fff;
}

.fb-dock-btn.fb-dock-active i {
  color: var(--fb-red, #e50914);
  filter: drop-shadow(0 0 8px rgba(229, 9, 20, 0.5));
}

@media (max-width: 768px) {
  .fb-mobile-dock {
    display: block;
  }

  body.fb-premium {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .fb-quick-rail {
    top: var(--fb-quick-top, 56px);
  }

  .scroll-top {
    bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  #fb-apk-popup {
    bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  }

  .fb-detail-hero-inner {
    grid-template-columns: 110px 1fr;
    padding-top: 2.5rem;
  }

  .fb-detail-hero {
    min-height: 240px;
  }
}

/* ── Click ripple (premium-ui injects element) ── */
.fb-click-ripple {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, rgba(229, 9, 20, 0.35) 0%, transparent 70%);
  animation: fbRippleExpand 0.65s ease-out forwards;
  z-index: 99999;
}

@keyframes fbRippleExpand {
  to {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

/* ── New release toast ── */
.fb-release-toast {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 10002;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  background: var(--fb-glass, rgba(18, 18, 18, 0.92));
  backdrop-filter: blur(16px);
  border: 1px solid rgba(229, 9, 20, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.45s var(--fb-ease, cubic-bezier(0.22, 1, 0.36, 1));
  font-size: 0.85rem;
}

.fb-release-toast.fb-release-toast-show {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .fb-release-toast {
    bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Scroll reveal stagger for new sections ── */
body.fb-premium .fb-scroll-section:not(.fb-scroll-visible) {
  opacity: 0;
  transform: translateY(28px);
}

body.fb-premium .fb-scroll-section.fb-scroll-visible {
  animation: fbSecReveal 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.fb-app-ready .fb-daily-discovery {
  animation: none;
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  body.fb-premium .fb-scroll-section:not(.fb-scroll-visible) {
    opacity: 1;
    transform: none;
  }

  body.fb-premium .fb-scroll-section.fb-scroll-visible,
  body.fb-app-ready .fb-daily-discovery {
    animation: none;
  }
}
