/* ==============================================================================
   NETFLIX MOBILE UI - SHASHATI (شاشتي) - V2 Enhanced
   Authentic mobile app aesthetic: Pitch black, Netflix Red, sleek typography,
   fluid responsive posters, platform filter bar, slide-up bottom sheets,
   and clean icon-only download actions.
============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&display=swap');

:root {
  --bg-black: #000000;
  --bg-dark: #121212;
  --bg-card: #1c1c1c;
  --bg-card-hover: #262626;
  --netflix-red: #E50914;
  --netflix-red-hover: #b80710;
  --text-main: #FFFFFF;
  --text-muted: #A3A3A3;
  --text-dim: #737373;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --bottom-nav-height: 60px;
  --top-header-height: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --card-width-mobile: 138px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-black);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 15px);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 0px;
  height: 0px;
  display: none;
}
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* ==============================================================================
   TOP HEADER (Netflix Style Floating Navigation)
============================================================================== */
.netflix-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-header-height);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.5) 75%, transparent 100%);
  transition: background-color 0.25s ease;
  backdrop-filter: blur(10px);
}

.netflix-header.scrolled {
  background-color: rgba(18, 18, 18, 0.98);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.netflix-logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--netflix-red);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.netflix-logo .n-icon {
  background: var(--netflix-red);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(229, 9, 20, 0.5);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-icon-btn {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.header-icon-btn:active {
  transform: scale(0.9);
}

.avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(135deg, #E50914 0%, #1f1f1f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  border: 1.5px solid rgba(255,255,255,0.3);
}

/* ==============================================================================
   TIER 1: TOP SECTION PILLS (مطابقة 100% للصورة المرفقة)
   [سيرفرات IPTV] [تلفزيون مباشر] [الرئيسية]
============================================================================== */
.top-section-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  position: relative;
  z-index: 95;
  margin-top: var(--top-header-height);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}

.section-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  padding: 7px 18px;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.section-pill.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  font-weight: 900;
  box-shadow: 0 3px 12px rgba(255, 255, 255, 0.3);
  transform: scale(1.02);
}

.section-pill:active {
  transform: scale(0.95);
}

/* ==============================================================================
   TIER 2: CONTEXTUAL SUB-FILTER BAR (وتحتها يكون فرز المنصات أو تصنيفات القنوات أو سيرفرات IPTV)
============================================================================== */
.subfilter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  overflow-x: auto;
  white-space: nowrap;
  position: relative;
  z-index: 90;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-overflow-scrolling: touch;
}

.subfilter-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  padding: 5px 13px;
  border-radius: 18px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.subfilter-chip .chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.subfilter-chip.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(255,255,255,0.2);
}

.subfilter-chip:active {
  transform: scale(0.94);
}

/* IPTV Selected Server Hero Card */
.iptv-server-hero {
  background: linear-gradient(135deg, #222222 0%, #151515 100%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.iptv-server-hero::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: var(--netflix-red);
}

.iptv-server-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.iptv-server-name {
  font-size: 1.05rem;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.iptv-server-code {
  background: rgba(229, 9, 20, 0.18);
  border: 1px dashed var(--netflix-red);
  color: #ff5252;
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
}

.iptv-server-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

/* ==============================================================================
   HERO BILLBOARD (Featured Mobile Banner)
============================================================================== */
.hero-billboard {
  position: relative;
  width: 100%;
  height: 440px;
  margin-top: -55px; /* Pull under header & filter bar */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 16px 26px 16px;
}

.hero-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center 20%;
  filter: brightness(0.85);
  transition: background-image 0.4s ease-in-out;
}

.hero-vignette {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, 
    rgba(0,0,0,0.65) 0%, 
    rgba(0,0,0,0) 25%, 
    rgba(0,0,0,0.45) 60%, 
    var(--bg-black) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hero-badge-top10 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.hero-badge-top10 .top10-tag {
  background: var(--netflix-red);
  color: #fff;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 900;
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0,0,0,0.9);
  line-height: 1.25;
}

.hero-genres {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-genres span:not(:last-child)::after {
  content: "•";
  margin-right: 8px;
  color: var(--netflix-red);
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  margin-top: 6px;
}

.hero-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 0.75rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.hero-play-btn {
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: 5px;
  padding: 9px 26px;
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  transition: transform 0.15s, background-color 0.2s;
}

.hero-play-btn:active {
  transform: scale(0.95);
  background: #e6e6e6;
}

/* ==============================================================================
   CAROUSEL ROWS (Horizontal Shelves with Larger Mobile Posters)
============================================================================== */
.shelf-section {
  margin-top: 24px;
  padding: 0 12px;
  position: relative;
}

.shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.shelf-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-title .shelf-indicator {
  width: 3.5px;
  height: 18px;
  background: var(--netflix-red);
  border-radius: 2px;
  flex-shrink: 0;
}

.shelf-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 2 Navigation Arrows in Header (3 at a time in both directions) */
.shelf-arrows {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.shelf-nav-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.shelf-nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--netflix-red);
  transform: scale(1.1);
}

.shelf-nav-btn:active {
  background: var(--netflix-red);
  color: #ffffff;
  transform: scale(0.9);
}

.shelf-page-indicator {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 26px;
  text-align: center;
  user-select: none;
}

.shelf-see-all {
  color: var(--netflix-red);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

/* Carousel Wrapper & Side Overlay Arrows */
.carousel-wrapper {
  position: relative;
  width: 100%;
}

.carousel-side-nav {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 28px;
  height: 44px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  opacity: 0.85;
  user-select: none;
}

.carousel-side-nav:hover {
  background: rgba(229, 9, 20, 0.9);
  border-color: var(--netflix-red);
  opacity: 1;
  transform: translateY(-50%) scale(1.06);
}

.carousel-side-nav:active {
  transform: translateY(-50%) scale(0.92);
}

/* RTL orientation: In Arabic, Right is PREV (▶), Left is NEXT (◀) */
.carousel-side-nav.prev {
  right: -6px;
}
.carousel-side-nav.next {
  left: -6px;
}

/* 3 Items per row exactly */
.carousel-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 4px 0 10px 0;
  margin: 0;
  width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.carousel-container::-webkit-scrollbar {
  display: none;
}

/* Movie/Show Card Base */
.media-card {
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s;
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
  box-sizing: border-box;
}

/* Inside Carousels: EXACTLY 3 Cards Per Row on Mobile */
.carousel-container .media-card {
  flex: 0 0 calc((100% - 16px) / 3);
  width: calc((100% - 16px) / 3);
  max-width: calc((100% - 16px) / 3);
  min-width: calc((100% - 16px) / 3);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.media-card:active {
  transform: scale(0.96);
}

.card-poster-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  background: radial-gradient(circle at 50% 35%, #880004 0%, #220003 100%);
  overflow: hidden;
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  display: block;
}

.media-card:active .card-poster {
  transform: scale(1.03);
}

.card-badge-platform {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  border: 0.5px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-badge-quality {
  position: absolute;
  bottom: 5px;
  left: 5px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  border: 0.5px solid rgba(255,255,255,0.3);
}

/* Fast Download Icon on Card */
.card-quick-download {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border: 0.5px solid rgba(255,255,255,0.3);
  text-decoration: none;
  z-index: 5;
}

.card-info {
  padding: 8px;
  background: var(--bg-card);
}

.card-title {
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
  line-height: 1.25;
}

.card-subtitle {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
}

/* Wide Card (For Live TV Channels 16/9) */
.media-card.wide {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.carousel-container .media-card.wide {
  flex: 0 0 220px;
  width: 220px;
  max-width: 220px;
  min-width: 220px;
}

.media-card.wide .card-poster-wrapper {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1e1e1e 0%, #0d0d0d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-card.wide .live-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #ff0000;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ==============================================================================
   DEDICATED PLATFORM SHOWCASE (شاشات وترتيب المواضيع عند الفتح لتصنيف معين)
============================================================================== */
.platform-showcase {
  display: none;
  padding: 0 12px;
  margin-top: 14px;
}

.platform-showcase.active {
  display: block;
}

/* 1. Category Header Banner */
.category-header-banner {
  background: linear-gradient(135deg, rgba(30,30,30,0.95) 0%, rgba(15,15,15,0.98) 100%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.category-header-banner::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  background: var(--netflix-red);
  box-shadow: 0 0 12px var(--netflix-red);
}

.category-brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.category-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.badge-quality {
  background: rgba(255,255,255,0.1);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  border: 0.5px solid rgba(255,255,255,0.2);
}

.category-main-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.3;
}

.category-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
  max-width: 850px;
}

.category-stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e6e6e6;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* 2. Category Topics Bar (شريط ترتيب المواضيع) */
.category-topics-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  background: rgba(18, 18, 18, 0.9);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

.topics-chips-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 4px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.topic-chip {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-family: inherit;
}

.topic-chip:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.3);
}

.topic-chip.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  font-weight: 900;
  box-shadow: 0 2px 10px rgba(255,255,255,0.3);
}

.category-view-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-toggle-btns {
  display: flex;
  background: rgba(255,255,255,0.08);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
}

.view-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.view-mode-btn.active {
  background: #ffffff;
  color: #000000;
  font-weight: 800;
}

.category-sort-select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.category-sort-select option {
  background: #181818;
  color: #fff;
}

/* 3. Category Shelves & Grid Views */
.category-shelves-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-grid-view {
  margin-top: 10px;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 30px;
}

.platform-grid .media-card {
  flex: unset;
  width: 100%;
  max-width: 100%;
}

/* Section Header Rows with Live Search (For TV & IPTV) */
.section-top-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 14px;
  flex-wrap: wrap;
}

.tv-search-box,
.iptv-search-box {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 6px 14px;
  width: 240px;
  max-width: 100%;
}

.tv-search-box input,
.iptv-search-box input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.78rem;
  font-family: inherit;
  outline: none;
  width: 100%;
}

.iptv-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.iptv-categories-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 10px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

/* ==============================================================================
   IPTV RECEIVER TILES
============================================================================== */
.receiver-card {
  flex: 0 0 210px;
  scroll-snap-align: start;
  background: linear-gradient(135deg, #1c1c1c 0%, #121212 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.receiver-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: var(--netflix-red);
}

.receiver-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.receiver-code-badge {
  background: rgba(229, 9, 20, 0.15);
  border: 1px dashed var(--netflix-red);
  color: #ff5252;
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  direction: ltr;
  margin: 6px 0;
}

.receiver-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.receiver-btn {
  margin-top: 8px;
  background: var(--netflix-red);
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* ==============================================================================
   BOTTOM NAVIGATION BAR (Icon-Only Download Tab)
============================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(18, 18, 18, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav-tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
  padding: 6px 0;
}

.nav-tab-item i {
  font-size: 1.35rem;
  transition: transform 0.15s;
}

.nav-tab-item.active {
  color: #ffffff;
  font-weight: 800;
}

.nav-tab-item.active i {
  transform: translateY(-2px);
  color: var(--netflix-red);
}

.nav-tab-item:active {
  transform: scale(0.92);
}

/* Clean Icon-Only Download Tab */
.nav-tab-item.icon-only-tab {
  justify-content: center;
}
.nav-tab-item.icon-only-tab i {
  font-size: 1.5rem;
}

/* ==============================================================================
   VIEWS CONTAINER (Tabs Switching)
============================================================================== */
.tab-view {
  display: none;
}
.tab-view.active {
  display: block;
}

/* ==============================================================================
   SLIDE-UP DETAILS & EPISODE DRAWER (BottomSheet)
============================================================================== */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(5px);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: #181818;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  z-index: 310;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
}

.drawer-backdrop.open .drawer-sheet {
  transform: translateY(0);
}

.drawer-drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  margin: 10px auto 4px auto;
}

.drawer-header {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 14px 16px 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.drawer-poster {
  width: 80px;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.drawer-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.drawer-title {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.3;
}

.drawer-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.drawer-close-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.drawer-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

/* Icon-First Zero-Load Actions Box */
.drawer-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.drawer-play-main {
  flex: 1;
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.drawer-play-main:active {
  background: #e6e6e6;
}

/* Icon-Only Download Button */
.icon-circle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  font-size: 1.15rem;
}

.icon-circle-btn.download-btn {
  background: var(--netflix-red);
  border-color: var(--netflix-red);
}

.icon-circle-btn:active {
  transform: scale(0.92);
}

/* Episodes List Inside Drawer */
.episodes-section-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.episode-num {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-dim);
  width: 20px;
  text-align: center;
}

.episode-info {
  flex: 1;
}

.episode-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.episode-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.episode-icon-action {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  background: rgba(0,0,0,0.4);
  text-decoration: none;
  font-size: 0.85rem;
}

/* ==============================================================================
   VIDEO PLAYER MODAL & ADVANCED CONTROLS (سيرفرات البث والترجمة)
============================================================================== */
.player-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000000;
  z-index: 500;
  display: none;
  flex-direction: column;
}

.player-modal.open {
  display: flex;
}

.player-top-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.5) 75%, transparent 100%);
  gap: 10px;
}

.player-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}

.player-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.player-back-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  text-align: right;
  padding: 4px;
}

.player-back-arrow {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  transition: transform 0.2s;
}

.player-back-btn:hover .player-back-arrow {
  transform: translateX(4px);
  color: var(--netflix-red);
}

.player-meta-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.player-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

.player-subtitle {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-ctrl-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s;
  font-family: inherit;
  font-weight: 700;
}

.player-ctrl-btn:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}

.player-ctrl-btn.active {
  background: rgba(229, 9, 20, 0.35);
  border-color: var(--netflix-red);
  color: #fff;
}

.player-close-btn {
  background: rgba(229, 9, 20, 0.25);
  border-color: var(--netflix-red);
}

.player-close-btn:hover {
  background: var(--netflix-red);
}

.btn-label-desktop {
  display: none;
}

@media (min-width: 768px) {
  .btn-label-desktop {
    display: inline;
  }
  .player-title {
    font-size: 1.15rem;
  }
}

.video-container {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

video.netflix-video,
iframe.netflix-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  object-fit: contain;
  background: #000;
}

/* Ad Shield Overlay & Notice */
.player-shield-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  cursor: pointer;
}

.shield-notice {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #4cd964;
  color: #4cd964;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.8);
  pointer-events: none;
  animation: fadeInOut 4s forwards;
}

/* Subtitles Rendering via ::cue */
video::cue {
  background-color: rgba(0, 0, 0, 0.75);
  color: #ffee55;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Cairo", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95);
}

/* Subtitle Popup Menu */
.subtitle-popup {
  position: absolute;
  top: 60px;
  left: 18px;
  z-index: 100;
  background: #181818;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px;
  padding: 14px;
  min-width: 270px;
  max-width: 340px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.9);
}

.subtitle-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sub-close-btn {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.sub-close-btn:hover {
  color: #fff;
}

.sub-option-btn {
  width: 100%;
  background: #242424;
  border: 1px solid rgba(255,255,255,0.08);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  text-align: right;
  font-family: inherit;
  transition: all 0.15s;
}

.sub-option-btn:hover {
  background: #333333;
}

.sub-option-btn.active {
  background: rgba(229, 9, 20, 0.25);
  border-color: var(--netflix-red);
  font-weight: 800;
}

.sub-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 10px 0;
}

.sub-upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #262626;
  border: 1px dashed rgba(255,255,255,0.3);
  color: #ffee55;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}

.sub-upload-label:hover {
  border-color: #ffee55;
  background: rgba(255, 238, 85, 0.1);
}

/* Bottom Player Dock Bar (قائمة سفلية شاملة ومحمية لا تتعدى عرض الشاشة) */
.player-dock-bar {
  background: linear-gradient(0deg, rgba(0,0,0,0.98) 0%, rgba(14,14,14,0.96) 80%, transparent 100%);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 35;
  border-top: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: hidden;
}

/* 1. Subtitle & Ad Protection Row (منظمة بدقة لمنع أي تداخل) */
.player-dock-sub-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  box-sizing: border-box;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dock-sub-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.dock-sub-select-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.dock-sub-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.dock-sub-select {
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  flex: 1;
  min-width: 0;
  max-width: 220px;
}

.dock-sub-select:focus,
.dock-sub-select:hover {
  border-color: var(--netflix-red);
}

.dock-shield-box {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.dock-shield-btn {
  background: rgba(0, 200, 83, 0.12);
  border: 1px solid #00c853;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.dock-shield-btn.active {
  background: rgba(0, 200, 83, 0.2);
  border-color: #00e676;
}

.dock-shield-btn:not(.active) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
}

.shield-state-tag {
  background: #00c853;
  color: #000000;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 3px;
}

.dock-sub-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.dock-sub-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65%;
}

.dock-sub-status-badge.available {
  background: rgba(76, 217, 100, 0.15);
  border: 1px solid #4cd964;
  color: #4cd964;
}

.dock-sub-status-badge.active {
  background: rgba(255, 235, 59, 0.15);
  border: 1px solid #ffeb3b;
  color: #ffeb3b;
}

.dock-sub-status-badge.optional {
  background: rgba(33, 150, 243, 0.15);
  border: 1px solid #2196f3;
  color: #2196f3;
}

.dock-sub-status-badge.neutral {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
}

.dock-upload-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.dock-upload-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #ffeb3b;
  color: #ffeb3b;
}

/* 2. Server Switcher Row & Navigation Arrows */
.player-dock-servers-row,
.player-dock-series-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.player-servers-wrapper,
.player-episodes-wrapper {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
}

.player-servers-scroll,
.player-episodes-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  box-sizing: border-box;
  padding: 2px 0;
}

.player-servers-scroll::-webkit-scrollbar,
.player-episodes-scroll::-webkit-scrollbar {
  display: none;
}

.dock-nav-arrow {
  background: #242424;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: bold;
  flex-shrink: 0;
  transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  user-select: none;
  padding: 0;
  line-height: 1;
}

.dock-nav-arrow:hover {
  background: var(--netflix-red);
  border-color: var(--netflix-red);
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(229,9,20,0.6);
}

.dock-nav-arrow:active {
  transform: scale(0.95);
}

.dock-nav-arrow.mini {
  width: 26px;
  height: 26px;
  font-size: 0.72rem;
}

.player-server-chip {
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ddd;
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.18s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-server-chip:hover {
  background: #2c2c2c;
  border-color: #fff;
  color: #fff;
}

.player-server-chip.active {
  background: var(--netflix-red) !important;
  border-color: var(--netflix-red) !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(229,9,20,0.6);
  font-weight: 800;
}

.player-ep-chip {
  background: #1c1c1c;
  border: 1px solid rgba(255,255,255,0.12);
  color: #bbb;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: all 0.15s;
}

.player-ep-chip:hover {
  background: #2a2a2a;
  color: #fff;
}

.player-ep-chip.active {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #ffffff !important;
  font-weight: 900;
}

/* Drawer Server Selector Box */
.drawer-servers-box {
  margin: 12px 0;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
}

.drawer-servers-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drawer-servers-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.drawer-server-pill {
  background: #242424;
  border: 1px solid rgba(255,255,255,0.12);
  color: #ccc;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
  flex-shrink: 0;
}

.drawer-server-pill:hover {
  border-color: #fff;
  color: #fff;
}

.drawer-server-pill.active {
  background: var(--netflix-red);
  border-color: var(--netflix-red);
  color: #fff;
  font-weight: 800;
}

/* ==============================================================================
   SEARCH OVERLAY
============================================================================== */
.search-container {
  padding: 14px;
}

.search-input-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  background: #222222;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 42px 12px 16px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.search-input:focus {
  background: #2b2b2b;
  border-color: rgba(255,255,255,0.3);
}

.search-icon-inside {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* ==============================================================================
   DOWNLOADS TAB (Icon-First Clean UI)
============================================================================== */
.downloads-container {
  padding: 14px;
}

.downloads-hero {
  text-align: center;
  padding: 26px 16px;
  background: linear-gradient(180deg, #1c1c1c 0%, #111111 100%);
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid rgba(255,255,255,0.06);
}

.downloads-hero i {
  font-size: 2.8rem;
  color: var(--netflix-red);
  margin-bottom: 8px;
  display: inline-block;
}

.downloads-hero h2 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.downloads-hero p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.download-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a1a;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.download-task-info h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.download-task-info span {
  font-size: 0.7rem;
  color: #4cd964;
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 999;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==============================================================================
   RESPONSIVE DESIGN: MOBILE, TABLET, AND DESKTOP (حاسوب وتابلت وموبيل)
============================================================================== */

/* Base Defaults (Mobile-first: < 768px) */
.app-frame {
  width: 100%;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
}

.desktop-nav-links,
.desktop-search-box,
.device-badge {
  display: none;
}

.mobile-only-btn {
  display: flex;
}

.bottom-nav {
  display: flex;
}

/* ==============================================================================
   LIVE TV CHANNEL GRID & DEDICATED CARDS
============================================================================== */
#tv-channels-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
}

.tv-channel-card {
  width: 100% !important;
  box-sizing: border-box;
  background: linear-gradient(135deg, #1c1c1c 0%, #121212 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  position: relative;
}

.tv-channel-card:hover {
  transform: translateY(-4px);
  border-color: var(--netflix-red);
  box-shadow: 0 8px 24px rgba(0,0,0,0.8), 0 0 16px rgba(229, 9, 20, 0.3);
}

.tv-card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: radial-gradient(circle at center, #262626 0%, #0a0a0a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.tv-card-icon {
  font-size: 3rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.8));
  transition: transform 0.2s;
}

.tv-channel-card:hover .tv-card-icon {
  transform: scale(1.1);
}

.live-pulse-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff0000;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(255,0,0,0.5);
  animation: pulse 1.5s infinite;
}

.tv-card-country {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  border: 0.5px solid rgba(255,255,255,0.25);
}

.tv-card-details {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #161616;
}

.tv-card-text {
  overflow: hidden;
  flex: 1;
}

.tv-card-name {
  font-size: 1.05rem;
  font-weight: 900;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.tv-card-category {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
}

.tv-card-actions {
  flex-shrink: 0;
}

.tv-play-btn {
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  font-family: inherit;
}

.tv-play-btn:hover {
  background: var(--netflix-red);
  color: #ffffff;
  transform: scale(1.05);
}

/* IPTV Dedicated Grid & Cards (كل سطر شعارين مع اسم القناة والتشغيل الفوري) */
#iptv-pool-list {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 12px !important;
  width: 100% !important;
  box-sizing: border-box;
  margin: 12px 0 30px 0;
}

.iptv-channel-card {
  display: flex !important;
  flex-direction: column !important;
  background: #161616;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.22s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}

.iptv-channel-card:hover {
  background: #1f1f1f;
  border-color: rgba(229, 9, 20, 0.55);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 16px rgba(229, 9, 20, 0.25);
}

.iptv-channel-card:active {
  transform: scale(0.97);
}

.iptv-logo-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #202020 0%, #101010 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.iptv-channel-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  box-sizing: border-box;
  transition: transform 0.25s ease;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.iptv-channel-logo.is-poster {
  object-fit: cover;
  padding: 0;
}

.iptv-channel-card:hover .iptv-channel-logo {
  transform: scale(1.06);
}

.iptv-live-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(229, 9, 20, 0.92);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 2;
  letter-spacing: 0.3px;
}

.iptv-play-btn-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(229, 9, 20, 0.92);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  padding-right: 2px;
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.6);
  opacity: 0;
  transition: all 0.22s ease;
  z-index: 3;
  pointer-events: none;
}

.iptv-channel-card:hover .iptv-play-btn-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.iptv-card-action-icons {
  position: absolute;
  bottom: 6px;
  left: 6px;
  display: flex;
  gap: 5px;
  z-index: 4;
}

.iptv-mini-action {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.iptv-mini-action:hover {
  background: var(--netflix-red);
  border-color: var(--netflix-red);
  transform: scale(1.1);
}

.iptv-channel-details {
  padding: 8px 10px 10px 10px;
  background: #131313;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  flex: 1;
  justify-content: space-between;
}

.iptv-channel-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.iptv-channel-subtitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.68rem;
}

.iptv-badge-cat {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65%;
}

.iptv-badge-srv {
  color: #4cd964;
  font-weight: 700;
  font-size: 0.65rem;
  background: rgba(76, 217, 100, 0.12);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) {
  body {
    background-color: #0d0d0d;
    padding-bottom: 30px; /* No bottom nav needed */
  }

  .bottom-nav {
    display: none !important;
  }

  .mobile-only-btn {
    display: none !important;
  }

  .desktop-nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 14px;
    white-space: nowrap;
    overflow-x: auto;
  }

  .desktop-nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    transition: color 0.2s;
  }

  .desktop-nav-link:hover,
  .desktop-nav-link.active {
    color: #ffffff;
  }

  .desktop-search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 5px 14px;
    gap: 8px;
    width: 220px;
  }

  .desktop-search-box input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    width: 100%;
  }

  .desktop-search-icon {
    color: var(--text-muted);
    cursor: pointer;
  }

  .device-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid rgba(229, 9, 20, 0.4);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    color: #ff5252;
    font-weight: 700;
  }

  .device-dot {
    width: 6px;
    height: 6px;
    background: #4cd964;
    border-radius: 50%;
    box-shadow: 0 0 6px #4cd964;
  }

  .app-frame {
    max-width: 1080px;
    padding: 0 20px;
  }

  /* 4 Cards per row on Tablet in Carousels */
  .carousel-container .media-card {
    flex: 0 0 calc((100% - 32px) / 4) !important;
    width: calc((100% - 32px) / 4) !important;
    max-width: calc((100% - 32px) / 4) !important;
    min-width: calc((100% - 32px) / 4) !important;
  }

  .platform-grid .media-card,
  #tv-channels-grid .media-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: unset !important;
    flex: unset !important;
  }

  .platform-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px !important;
  }

  #tv-channels-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px !important;
  }

  #iptv-pool-list {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .hero-billboard {
    height: 480px;
    padding: 30px 24px 34px 24px;
  }

  .hero-title {
    font-size: 2.3rem;
  }

  /* Centered Details Modal on Tablet */
  .drawer-sheet {
    bottom: auto !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) scale(0.95) !important;
    max-width: 720px !important;
    width: 90% !important;
    max-height: 85vh !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9) !important;
  }

  .drawer-backdrop.open .drawer-sheet {
    transform: translate(-50%, -50%) scale(1) !important;
  }
}

/* Desktop / PC (min-width: 1025px) */
@media (min-width: 1025px) {
  body {
    background-color: #080808;
    padding-bottom: 40px;
  }

  .app-frame {
    max-width: 1560px;
    padding: 0 36px;
  }

  .desktop-search-box {
    width: 290px;
  }

  /* 6 Cards per row on Desktop in Carousels */
  .carousel-container .media-card {
    flex: 0 0 calc((100% - 50px) / 6) !important;
    width: calc((100% - 50px) / 6) !important;
    max-width: calc((100% - 50px) / 6) !important;
    min-width: calc((100% - 50px) / 6) !important;
  }

  .platform-grid .media-card,
  #tv-channels-grid .media-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: unset !important;
    flex: unset !important;
  }

  /* Smooth Desktop Card Hover Elevation */
  .carousel-container .media-card:hover,
  .platform-grid .media-card:hover {
    transform: scale(1.08) translateY(-5px);
    z-index: 25;
    box-shadow: 0 14px 35px rgba(0,0,0,0.9), 0 0 20px rgba(229, 9, 20, 0.35);
  }

  .platform-grid {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 16px !important;
  }

  #tv-channels-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px !important;
  }

  #iptv-pool-list {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 14px !important;
  }

  /* Grand Cinematic Hero Billboard for Desktop */
  .hero-billboard {
    height: 560px;
    padding: 40px 48px 50px 48px;
    align-items: flex-start;
    text-align: right;
  }

  .hero-content {
    align-items: flex-start;
    text-align: right;
    max-width: 650px;
  }

  .hero-title {
    font-size: 3rem;
    text-align: right;
  }

  .hero-actions {
    justify-content: flex-start;
    gap: 16px;
  }

  .hero-play-btn {
    padding: 12px 36px;
    font-size: 1.1rem;
  }

  /* Centered Luxury Details Modal on Desktop */
  .drawer-sheet {
    max-width: 780px !important;
  }
}
