/* ============================================================
   CloudTV — Premium Dark IPTV Streaming UI
   Design: Netflix × IPTVX — Cinematic · Glassmorphic · Dark
   Option A: Cinematic Glass Guide
   grid-template-columns:104px minmax(0,1fr)
   ============================================================ */

/* ── 1. Google Fonts ──────────────────────────────────────── */
/* ── Design Tokens ────────────────────────────────────────── */
:root {
  --bg:                  #05070b;
  --surface:             #0d1117;
  --surface-elevated:    #161c26;
  --border:              rgba(255, 255, 255, 0.08);
  --accent-red:          #e11d48;
  --accent-red-glow:     rgba(225, 29, 72, 0.35);
  --accent-blue:         #38bdf8;
  --text-primary:        #f8fafc;
  --text-secondary:      #94a3b8;
  --text-muted:          #64748b;
  --radius-sm:           10px;
  --radius-md:           16px;
  --radius-lg:           24px;
  --font:                'Inter', system-ui, sans-serif;
}

/* ── 2. Global Reset & Base ───────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ── 3. Hero Banner (#homeHero) ───────────────────────────── */
#homeHero {
  position: relative;
  width: 100%;
  height: clamp(340px, 52vw, 580px);
  overflow: hidden;
}

/* Backdrop image layer */
.heroBackdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

/* Gradient overlay — right-to-left fade */
.heroBackdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(5, 7, 11, 0.96) 0%,
    rgba(5, 7, 11, 0.70) 45%,
    rgba(5, 7, 11, 0.15) 100%
  );
  z-index: 1;
}

/* Gradient overlay — bottom vignette */
.heroBackdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    #05070b 0%,
    transparent 40%
  );
  z-index: 2;
}

/* Hero content — left column */
.heroContent {
  position: absolute;
  bottom: 10%;
  left: clamp(24px, 5vw, 80px);
  max-width: 520px;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

/* Small red eyebrow label */
.heroEyebrow {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-red);
  margin-bottom: 10px;
}

/* Cinematic hero title */
.heroTitle {
  font-size: clamp(32px, 5vw, 68px);
  font-weight: 900;
  line-height: 1.05;
  color: #ffffff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
  letter-spacing: -0.02em;
}

/* Secondary meta info */
.heroMeta {
  font-size: clamp(13px, 1.4vw, 16px);
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.5;
}

/* CTA button row */
.heroActions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* Primary red CTA */
.heroBtnPrimary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  color: #ffffff;
  background: var(--accent-red);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.18s ease, transform 0.18s ease;
  will-change: transform;
  white-space: nowrap;
}

.heroBtnPrimary:hover {
  filter: brightness(1.1);
  transform: scale(1.02);
}

.heroBtnPrimary:active {
  transform: scale(0.98);
}

/* Secondary glass CTA */
.heroBtnSecondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, transform 0.18s ease;
  will-change: transform;
  white-space: nowrap;
}

.heroBtnSecondary:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.02);
}

.heroBtnSecondary:active {
  transform: scale(0.98);
}

/* LIVE badge — top-right corner */
.heroBadgeLive {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-red);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 0 16px var(--accent-red-glow);
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 12px var(--accent-red-glow); }
  50%       { box-shadow: 0 0 24px rgba(225, 29, 72, 0.6); }
}

/* EPG progress bar at bottom of hero */
.heroProgress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 20;
  overflow: hidden;
}

.heroProgressFill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), #f43f5e);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Auto-cycle indicator dots */
.heroDots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
}

.heroDot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  transition: background 0.2s ease, width 0.2s ease;
  cursor: pointer;
}

.heroDot.active {
  width: 18px;
  background: var(--accent-red);
}

/* ── 4. Home Rails ────────────────────────────────────────── */
.homeRailSection {
  margin-bottom: 40px;
  padding: 0 clamp(16px, 4vw, 60px);
}

.homeRailHeader {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.homeRailTitle {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.homeRailSeeAll {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-red);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.homeRailSeeAll:hover {
  opacity: 0.75;
}

.homeRail {
  display: flex;
  flex-direction: row;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

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

/* ── 5. Live Channel Cards (.liveCard) ────────────────────── */
.liveCard {
  position: relative;
  width: 200px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #161c26, #0d1117);
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, box-shadow;
}

.liveCard:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.15);
}

.liveCard.activeCard {
  border-color: var(--accent-red);
  box-shadow:
    0 0 0 2px rgba(225, 29, 72, 0.4),
    inset 0 0 20px rgba(225, 29, 72, 0.06);
}

/* Channel logo / thumbnail */
.liveCardThumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0a0e16;
  padding: 8px;
  display: block;
}

/* Text fallback when no logo */
.liveCardThumbFallback {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.2);
  background: #0a0e16;
  letter-spacing: -0.03em;
}

/* Card body text */
.liveCardBody {
  padding: 10px 12px 12px;
}

.liveCardName {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.liveCardProgram {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* EPG progress inside card */
.liveCardProgress {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.liveCardProgressFill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), #f43f5e);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* LIVE badge on card */
.liveCardBadge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent-red);
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  pointer-events: none;
}

/* ── 6. Channel List Premium Row (.premiumChannelRow) ─────── */
.premiumChannelRow {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.premiumChannelRow:hover {
  background: rgba(255, 255, 255, 0.04);
}

.premiumChannelRow.activeRow {
  background: rgba(225, 29, 72, 0.08);
}

/* Logo container */
.channelVisual {
  width: 44px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.channelThumb {
  width: 44px;
  height: 32px;
  object-fit: contain;
  display: block;
}

/* Text fallback logo */
.channelThumbFallback {
  width: 44px;
  height: 32px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.4);
  display: grid;
  place-items: center;
  letter-spacing: -0.02em;
}

/* Channel name + EPG column */
.channelTextBlock {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channelName {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channelCategoryLabel {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* EPG progress in row */
.channelEpgBar {
  height: 2px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 1px;
  margin-top: 5px;
  overflow: hidden;
}

.channelEpgFill {
  height: 100%;
  background: var(--accent-red);
  border-radius: 1px;
  transition: width 0.4s ease;
}

/* ── 7. Player EPG Overlay (.epgSlideOverlay) ─────────────── */
.epgSlideOverlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.epgSlideOverlay.open {
  transform: translateY(0);
}

/* Semi-transparent glass inner */
.epgOverlayInner {
  background: linear-gradient(
    180deg,
    rgba(5, 7, 11, 0.0) 0%,
    rgba(5, 7, 11, 0.97) 6%
  );
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  padding: clamp(16px, 4vw, 32px);
  padding-top: 40px;
}

/* Drag handle pill */
.epgOverlayHandle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 0 auto 20px;
}

/* Current program title */
.epgCurrentProgram {
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.epgCurrentMeta {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Progress strip */
.epgProgressStrip {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 14px 0;
  overflow: hidden;
}

.epgProgressFill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), #f43f5e);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Upcoming programs list */
.epgNextList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.epgNextItem {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease;
}

.epgNextItem:hover {
  background: rgba(255, 255, 255, 0.07);
}

.epgNextTime {
  font-size: 12px;
  color: var(--accent-red);
  font-weight: 800;
  min-width: 48px;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.epgNextTitle {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Horizontal channel switcher strip */
.epgChannelStrip {
  height: 80px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  -webkit-overflow-scrolling: touch;
}

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

/* Individual channel chip */
.epgChannelChip {
  flex-shrink: 0;
  width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.18s ease;
}

.epgChannelChip:hover,
.epgChannelChip.active {
  opacity: 1;
}

.epgChannelChipLogo {
  width: 40px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.epgChannelChipName {
  font-size: 9px;
  color: var(--text-secondary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 58px;
  font-weight: 600;
}

/* Scrim backdrop behind EPG panel */
.epgBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.38s cubic-bezier(0.32, 0.72, 0, 1);
}

.epgBackdrop.open {
  opacity: 1;
  pointer-events: all;
}

/* ── 8. Search Overlay (.searchOverlay) ───────────────────── */
.searchOverlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(5, 7, 11, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    pointer-events 0s linear 0.22s;
}

.searchOverlay.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.searchOverlayInner {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 60px) clamp(16px, 4vw, 32px);
}

/* Large search input */
.searchOverlayInput {
  width: 100%;
  font-family: var(--font);
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 800;
  background: transparent;
  border: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 14px 0;
  outline: none;
  caret-color: var(--accent-red);
  letter-spacing: -0.02em;
  transition: border-bottom-color 0.18s ease;
}

.searchOverlayInput::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.searchOverlayInput:focus {
  border-bottom-color: var(--accent-red);
}

/* Close button */
.searchOverlayClose {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.4);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.searchOverlayClose:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.07);
}

/* Results container */
.searchResultsWrap {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Group header */
.searchResultGroup {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Items list */
.searchResultList {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.searchResultItem {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.searchResultItem:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Thumbnail in result */
.searchResultThumb {
  width: 48px;
  height: 34px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  display: block;
}

.searchResultName {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.searchResultMeta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.searchResultTextBlock {
  flex: 1;
  min-width: 0;
}

/* Category badge */
.searchResultBadge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(225, 29, 72, 0.15);
  color: #f43f5e;
  white-space: nowrap;
}

/* ── 9. Grid View Toggle (.channelGridView) ───────────────── */
.channelViewToggle {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 3px;
}

.viewToggleBtn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.viewToggleBtn.active {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text-primary);
}

.viewToggleBtn:hover:not(.active) {
  color: var(--text-secondary);
}

/* Channel grid layout */
.channelGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  padding: 10px 0;
}

.channelGridCard {
  background: var(--surface-elevated);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  will-change: transform;
}

.channelGridCard:hover {
  transform: scale(1.03);
  border-color: rgba(255, 255, 255, 0.15);
}

.channelGridCard.activeCard {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.3);
}

.channelGridThumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0a0e16;
  padding: 8px;
  box-sizing: border-box;
  display: block;
}

.channelGridName {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 10. Mobile Responsive ────────────────────────────────── */
@media (max-width: 768px) {
  /* Hero */
  #homeHero {
    height: clamp(260px, 70vw, 380px);
  }

  .heroContent {
    bottom: 8%;
    left: 20px;
    right: 20px;
    max-width: unset;
  }

  .heroBtnPrimary,
  .heroBtnSecondary {
    padding: 12px 20px;
    font-size: 14px;
  }

  /* Cards */
  .liveCard {
    width: 158px;
  }

  /* Rails */
  .homeRailSection {
    padding: 0 12px;
  }

  /* EPG overlay */
  .epgOverlayInner {
    padding: 24px 16px;
    padding-top: 32px;
  }

  /* Search */
  .searchOverlayInner {
    padding: 20px 16px;
  }

  .searchOverlayClose {
    top: 14px;
    right: 10px;
  }

  /* Grid */
  .channelGrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Utility: focus-visible accessibility ring ────────────── */
:focus-visible {
  outline: 2px solid var(--accent-red);
  outline-offset: 2px;
}

/* ── Utility: no-select for UI chrome ─────────────────────── */
.heroDots,
.epgOverlayHandle,
.channelViewToggle,
.liveCardBadge,
.heroBadgeLive {
  user-select: none;
  -webkit-user-select: none;
}

/* ── Ambient Backdrop Glow (Cinema Mode) ──────────────────── */
.ambientGlowContainer {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  z-index: 0;
  pointer-events: none;
  filter: blur(80px) saturate(160%);
  opacity: 0;
  transition: opacity 0.5s ease, background 0.5s ease;
  will-change: background, opacity;
}

#video {
  position: relative;
  z-index: 1;
}

/* ── Floating Mini-Player (Picture-in-Picture fallback) ─────── */
.playerShell.inAppMiniPlayer {
  position: fixed !important;
  bottom: 20px;
  right: 20px;
  width: min(360px, calc(100vw - 32px));
  aspect-ratio: 16 / 9;
  height: auto;
  z-index: 9999 !important;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #05070b;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(225, 29, 72, 0.28);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  overflow: hidden;
  cursor: grab;
  animation: miniPlayerAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: width 0.3s ease, height 0.3s ease, transform 0.2s ease;
}

.playerShell.inAppMiniPlayer:active {
  cursor: grabbing;
}

.miniPlayerDock {
  display: none;
}

.playerShell.inAppMiniPlayer .playerVideoWrap {
  height: 100%;
  min-height: 0;
  border-radius: 18px;
}

.playerShell.inAppMiniPlayer #video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.playerShell.inAppMiniPlayer .miniPlayerDock {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 8px 8px 11px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(4, 7, 12, 0.82), rgba(17, 24, 39, 0.62));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.miniPlayerText {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.miniPlayerKicker {
  color: #38bdf8;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
}

#miniPlayerTitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

.miniPlayerActions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.miniPlayerAction {
  width: auto;
  min-height: 30px;
  margin: 0;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 10px;
  font-weight: 950;
  cursor: pointer;
}

.miniPlayerAction:hover {
  background: rgba(255, 255, 255, 0.18);
}

.miniPlayerAction.close {
  background: rgba(225, 29, 72, 0.22);
  border-color: rgba(225, 29, 72, 0.46);
}

@keyframes miniPlayerAppear {
  0% { opacity: 0; transform: scale(0.8) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Hide EPG, category controls, and stats bar while in mini-player */
.playerShell.inAppMiniPlayer .channelInfoBar,
.playerShell.inAppMiniPlayer .playerEmptyState,
.playerShell.inAppMiniPlayer .streamRecoveryPanel,
.playerShell.inAppMiniPlayer .customPlayerControls .ytTime,
.playerShell.inAppMiniPlayer .customPlayerControls .ytLiveChip,
.playerShell.inAppMiniPlayer .customPlayerControls .ytProgress {
  display: none !important;
}

/* Adjust mini controls inside the mini player card */
.playerShell.inAppMiniPlayer .customPlayerControls {
  background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, transparent 54%) !important;
}

.playerShell.inAppMiniPlayer .customPlayerControls .ytCenterControls svg {
  width: 20px;
  height: 20px;
}

.playerShell.inAppMiniPlayer .customPlayerControls .ytSeek {
  display: none !important;
}

.playerShell.inAppMiniPlayer .customPlayerControls .ytCenterControls {
  inset: auto auto 16px 50%;
  transform: translateX(-50%);
}

.playerShell.inAppMiniPlayer .customPlayerControls .ytPlay {
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
}

.playerShell.inAppMiniPlayer .ytBottomBar {
  display: none !important;
}

/* Mobile adjustments for the mini-player */
@media (max-width: 768px) {
  .playerShell.inAppMiniPlayer {
    display: none !important;
  }

  .playerShell.inAppMiniPlayer .miniPlayerDock {
    left: 8px;
    right: 8px;
    top: 8px;
  }

  .miniPlayerAction {
    min-height: 28px;
    padding: 5px 8px;
  }
}

/* ── Premium Side Category Rail styling overrides ─────────────── */
#categoryList,
.mediaCategoryList {
  background: rgba(13, 17, 23, 0.45) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4) !important;
  padding: 8px !important;
}

#categoryList .listItem,
.mediaCategoryList .listItem {
  min-height: 40px !important;
  padding: 0 12px !important;
  border-radius: 10px !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: flex !important;
  align-items: center !important;
}

#categoryList .listItem:hover,
.mediaCategoryList .listItem:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
  transform: translateX(2px);
}

#categoryList .listItem.showAction,
.mediaCategoryList .listItem.showAction {
  background: linear-gradient(135deg, var(--accent-red) 0%, #9f1239 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 24px var(--accent-red-glow) !important;
  font-weight: 800 !important;
  transform: translateX(4px);
}

#categoryList .listItemTitle,
.mediaCategoryList .listItemTitle {
  font-family: var(--font) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  color: inherit !important;
}

#categoryList .listItem.showAction .listItemTitle,
.mediaCategoryList .listItem.showAction .listItemTitle {
  font-weight: 800 !important;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ── Premium Active Channel Row Highlight styling ──────────────── */
.listItem.activeChannel .premiumChannelRow {
  background: rgba(225, 29, 72, 0.12) !important;
  border-left: 3px solid var(--accent-red) !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  padding-left: 9px !important;
  box-shadow: inset 10px 0 20px rgba(225, 29, 72, 0.04);
}
