/* ============================================
   StreamLive — Fully Responsive CSS
   Mobile · Tablet · Laptop · Desktop · TV
   ============================================ */

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

*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Colors */
  --bg-primary:      #090912;
  --bg-secondary:    #111120;
  --bg-card:         #181828;
  --bg-card-hover:   #1e1e34;
  --border:          rgba(255,255,255,0.07);
  --border-glow:     rgba(124,58,237,0.35);

  --purple:          #7C3AED;
  --purple-light:    #9D6EF5;
  --cyan:            #06B6D4;
  --rose:            #F43F5E;
  --amber:           #F59E0B;
  --green:           #10B981;

  --text-primary:    #F1F5F9;
  --text-secondary:  #94A3B8;
  --text-muted:      #475569;

  --grad-main:       linear-gradient(135deg, #7C3AED 0%, #06B6D4 100%);
  --grad-purple:     linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%);
  --grad-blue:       linear-gradient(135deg, #0EA5E9 0%, #06B6D4 100%);
  --grad-green:      linear-gradient(135deg, #10B981 0%, #059669 100%);
  --grad-rose:       linear-gradient(135deg, #F43F5E 0%, #E11D48 100%);
  --grad-orange:     linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
  --grad-pink:       linear-gradient(135deg, #EC4899 0%, #A855F7 100%);

  /* Spacing / Radii */
  --r-sm:   8px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;

  /* Layout — Mobile defaults */
  --sidebar-w:      240px;
  --sidebar-w-icon: 72px;
  --header-h:       58px;
  --bottom-nav-h:   64px;

  /* Fluid font base */
  font-size: clamp(14px, 1.5vw, 18px);
}

/* ============ BASE ============ */
html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  overflow: hidden;
  height: 100dvh;
  width: 100%;
}

/* ============================================
   SPLASH SCREEN
   ============================================ */
.splash-screen {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.splash-screen.fade-out { opacity: 0; transform: scale(1.04); pointer-events: none; }

.splash-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(124,58,237,0.22) 0%, transparent 70%),
    radial-gradient(ellipse 40% 35% at 80% 70%, rgba(6,182,212,0.12) 0%, transparent 60%);
}

.splash-content { position: relative; z-index: 1; text-align: center; }

.splash-logo {
  position: relative;
  width: clamp(100px, 15vmin, 140px);
  height: clamp(100px, 15vmin, 140px);
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
}

.logo-ring {
  position: absolute; border-radius: 50%;
  border: 2px solid transparent;
  animation: spinRing linear infinite;
}
.ring1 { width:100%;height:100%; border-top-color:rgba(124,58,237,.8); border-right-color:rgba(124,58,237,.2); animation-duration:3s; }
.ring2 { width:76%;height:76%; border-top-color:rgba(6,182,212,.8); border-left-color:rgba(6,182,212,.2); animation-duration:2s; animation-direction:reverse; }
.ring3 { width:54%;height:54%; border-top-color:rgba(244,63,94,.5); animation-duration:1.4s; }

@keyframes spinRing { to { transform: rotate(360deg); } }

.logo-icon {
  width: clamp(44px,8vmin,60px); height: clamp(44px,8vmin,60px);
  background: rgba(124,58,237,.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.logo-icon svg { width: clamp(24px,5vmin,36px); height: clamp(24px,5vmin,36px); }

.splash-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  background: var(--grad-main);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.splash-sub { color: var(--text-secondary); font-size: clamp(.85rem,1.5vw,1rem); margin-bottom: 16px; }

.splash-count {
  margin-top: 12px;
  font-size: .78rem;
  color: var(--purple-light);
  font-weight: 600;
  animation: fadeUp .5s ease 2s both;
}
@keyframes fadeUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }

.splash-loader { width: clamp(160px,25vw,220px); height: 3px; background: rgba(255,255,255,.08); border-radius:2px; margin:0 auto; overflow:hidden; }
.loader-bar { height:100%; background: var(--grad-main); border-radius:2px; animation: loadBar 2.2s ease-in-out forwards; }
@keyframes loadBar { 0%{width:0%} 60%{width:70%} 100%{width:100%} }

/* ============================================
   APP SHELL — Sidebar + Main
   ============================================ */
.app {
  display: flex;
  width: 100%; height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: width 0.3s ease, transform 0.3s ease;
  z-index: 200;
}

/* Sidebar Logo */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: rgba(124,58,237,.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 1.05rem; font-weight: 800;
  background: var(--grad-main);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s, width 0.3s;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border: none; border-radius: var(--r-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: .88rem; font-weight: 600;
  transition: all .2s ease;
  white-space: nowrap;
  text-align: right;
  position: relative;
}

.sidebar-nav-item svg { flex-shrink: 0; }

.sidebar-nav-item:hover {
  background: rgba(124,58,237,.1);
  color: var(--purple-light);
}
.sidebar-nav-item.active {
  background: rgba(124,58,237,.18);
  color: var(--purple-light);
  border: 1px solid rgba(124,58,237,.25);
}
.sidebar-nav-item.active::before {
  content: '';
  position: absolute; right: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 2px 0 0 2px;
  background: var(--grad-main);
}

.nav-badge {
  font-size: .6rem; font-weight: 700; letter-spacing: .8px;
  background: var(--rose);
  color: white; padding: 2px 6px; border-radius: 100px;
  margin-right: auto;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-add-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border: 1px dashed rgba(124,58,237,.4);
  border-radius: var(--r-md);
  background: rgba(124,58,237,.06);
  color: var(--purple-light);
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: .85rem; font-weight: 600;
  transition: all .2s;
  white-space: nowrap;
}
.sidebar-add-btn:hover {
  background: rgba(124,58,237,.15);
  border-color: rgba(124,58,237,.6);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 190;
}
.sidebar-overlay.show { display: block; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ============================================
   TOP HEADER
   ============================================ */
.top-header {
  height: var(--header-h);
  padding: 0 16px;
  background: rgba(9,9,18,.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}

.header-left { display: flex; align-items: center; gap: 10px; }
.header-center { flex: 1; max-width: 400px; margin: 0 auto; }
.header-right { display: flex; align-items: center; gap: 4px; margin-right: auto; }

/* Mobile logo (shown only on mobile) */
.mobile-logo {
  display: none;
  align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 800;
  background: var(--grad-main);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Desktop page title */
.page-title {
  font-size: 1.2rem; font-weight: 700;
  color: var(--text-primary);
  display: none;
}

/* Hamburger button (mobile only) */
.hamburger-btn {
  width: 38px; height: 38px; border: none;
  background: rgba(255,255,255,.06);
  border-radius: 10px; cursor: pointer;
  color: var(--text-secondary);
  display: none; align-items: center; justify-content: center;
  transition: all .2s;
}
.hamburger-btn:hover { background: rgba(124,58,237,.2); color: var(--purple-light); }

/* Desktop Search */
.desktop-search {
  display: none;
  align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 16px;
  height: 40px;
  transition: all .2s;
}
.desktop-search:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.desktop-search svg { color: var(--text-muted); flex-shrink: 0; }
.desktop-search input {
  flex: 1; min-width: 160px;
  border: none; background: transparent;
  color: var(--text-primary);
  font-family: 'Cairo',sans-serif; font-size: .88rem;
  direction: rtl; outline: none;
}
.desktop-search input::placeholder { color: var(--text-muted); }

/* Header Buttons */
.header-btn {
  width: 38px; height: 38px;
  border: none; background: rgba(255,255,255,.06);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  position: relative;
}
.header-btn:hover { background: rgba(124,58,237,.2); color: var(--purple-light); transform: scale(.95); }

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--rose); border-radius: 50%;
  border: 1.5px solid var(--bg-primary);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(1.3)} }

/* Mobile Search Bar */
.search-bar-wrap {
  overflow: hidden; max-height: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid transparent;
  transition: max-height .3s ease, border-color .3s;
  flex-shrink: 0;
}
.search-bar-wrap.open {
  max-height: 64px;
  border-color: var(--border);
}
.search-bar-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin: 10px 16px;
  padding: 0 14px; height: 42px;
}
.search-bar-inner:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.search-bar-inner svg { color: var(--text-muted); flex-shrink: 0; }
.search-bar-inner input {
  flex: 1; border: none; background: transparent;
  color: var(--text-primary);
  font-family: 'Cairo',sans-serif; font-size: .88rem; direction: rtl; outline: none;
}
.search-bar-inner input::placeholder { color: var(--text-muted); }
#closeSearch { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: .8rem; transition: color .2s; }
#closeSearch:hover { color: var(--text-primary); }

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============================================
   HOME LAYOUT: Player + Channels side by side
   ============================================ */
.home-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ===== PLAYER COLUMN ===== */
.player-col {
  flex-shrink: 0;
  display: flex; flex-direction: column;
}

.player-wrap {
  width: 100%;
  position: relative;
}

.player-container {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  position: relative;
  overflow: hidden;
}

/* Placeholder */
.player-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(124,58,237,.1) 0%, transparent 70%),
              linear-gradient(180deg, #0e0e1e 0%, var(--bg-primary) 100%);
}
.placeholder-inner {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  color: var(--text-muted); font-size: clamp(.8rem,1.5vw,.95rem);
}
.pulse-ring {
  position: absolute;
  width: clamp(70px,10vw,100px); height: clamp(70px,10vw,100px);
  border-radius: 50%; border: 2px solid rgba(124,58,237,.4);
  animation: pulseRing 2.2s ease-out infinite;
}
@keyframes pulseRing { 0%{transform:scale(.9);opacity:1} 100%{transform:scale(1.8);opacity:0} }

/* Overlay */
.player-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 45%, rgba(0,0,0,.25) 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(8px,1.5vw,14px);
  pointer-events: none;
}
.overlay-top, .overlay-bottom { display: flex; align-items: center; justify-content: space-between; pointer-events: all; }

.live-badge {
  display: flex; align-items: center; gap: 5px;
  background: rgba(244,63,94,.9); color: white;
  font-size: clamp(.6rem,1vw,.72rem); font-weight: 700;
  padding: 3px 10px; border-radius: 100px; letter-spacing: 1px;
}
.live-dot {
  width: 6px; height: 6px; background: white; border-radius: 50%;
  animation: livePulse 1s infinite;
}
@keyframes livePulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.fullscreen-btn {
  background: rgba(255,255,255,.15);
  border: none; border-radius: var(--r-sm);
  padding: clamp(4px,1vw,8px); color: white; cursor: pointer;
  backdrop-filter: blur(4px); transition: background .2s;
}
.fullscreen-btn:hover { background: rgba(255,255,255,.28); }

.overlay-bottom-info { display: flex; flex-direction: column; gap: 2px; }
.current-channel-name { font-size: clamp(.8rem,1.5vw,1rem); font-weight: 700; color: white; }
.current-channel-cat { font-size: clamp(.65rem,1vw,.78rem); color: rgba(255,255,255,.6); }

.viewer-count {
  display: flex; align-items: center; gap: 5px;
  font-size: clamp(.68rem,1.2vw,.8rem); color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.45); padding: 4px 10px; border-radius: 100px;
  backdrop-filter: blur(4px);
}

/* Player Loading State */
.player-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  background: rgba(0,0,0,.85);
  color: var(--text-secondary);
  font-size: clamp(.8rem,1.5vw,.95rem);
}
.loading-spinner {
  width: clamp(36px,6vw,50px); height: clamp(36px,6vw,50px);
  border: 3px solid rgba(124,58,237,.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Player Error State */
.player-error {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  background: rgba(0,0,0,.88);
  color: var(--text-muted);
  text-align: center; padding: 20px;
}
.player-error svg { color: var(--rose); opacity: .7; }
.player-error p { font-size: clamp(.85rem,1.5vw,1rem); font-weight: 600; color: var(--text-secondary); }
.player-error small { font-size: .75rem; }
.retry-btn {
  margin-top: 8px; padding: 8px 20px;
  background: var(--grad-main); color: white;
  border: none; border-radius: 100px;
  font-family: 'Cairo',sans-serif; font-size: .85rem; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.retry-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,58,237,.4); }

/* Player Controls */
.player-controls {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-shrink: 0;
}
.ctrl-left, .ctrl-center, .ctrl-right {
  display: flex; align-items: center; gap: 8px;
}
.ctrl-center { flex: 1; justify-content: center; }

.ctrl-btn {
  width: clamp(36px,5vw,44px); height: clamp(36px,5vw,44px);
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 50%; color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.ctrl-btn:hover { background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.4); color: var(--purple-light); transform: scale(.95); }

.ctrl-channel-label {
  font-size: clamp(.72rem,1.2vw,.85rem); font-weight: 600;
  color: var(--text-secondary); white-space: nowrap;
}

.vol-info {
  font-size: clamp(.65rem,1vw,.75rem);
  color: var(--text-muted); white-space: nowrap;
}

/* Now Playing (desktop sidebar) */
.now-playing-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: rgba(124,58,237,.06);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.np-icon { font-size: 1.5rem; flex-shrink: 0; }
.np-info { flex: 1; min-width: 0; }
.np-title { font-size: .85rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { font-size: .72rem; color: var(--text-muted); }
.np-live { display: flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; color: var(--rose); flex-shrink: 0; }

/* ===== CHANNELS COLUMN ===== */
.channels-col {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Tabs */
.tabs-wrap {
  flex-shrink: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}
.tabs {
  display: flex; overflow-x: auto; scrollbar-width: none;
  padding: 0 12px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; padding: 11px 16px;
  border: none; background: transparent;
  color: var(--text-muted);
  font-family: 'Cairo',sans-serif; font-size: clamp(.78rem,1.2vw,.88rem); font-weight: 600;
  cursor: pointer; position: relative; transition: color .2s;
  white-space: nowrap;
}
.tab::after {
  content: ''; position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%; height: 2px;
  background: var(--grad-main); border-radius: 2px 2px 0 0;
  transition: transform .25s ease;
}
.tab.active { color: var(--purple-light); }
.tab.active::after { transform: translateX(-50%) scaleX(1); }

/* Section Header */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
.section-title { font-size: clamp(.88rem,1.3vw,1rem); font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.channels-count {
  font-size: .72rem; color: var(--text-muted);
  background: var(--bg-card); padding: 3px 10px;
  border-radius: 100px; border: 1px solid var(--border);
}
.view-toggle {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  background: var(--bg-card); border-radius: var(--r-sm);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.view-toggle:hover { background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.4); color: var(--purple-light); }

/* Channels Grid */
.channels-grid {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: max-content;
  gap: 12px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,.2) transparent;
}
.channels-grid::-webkit-scrollbar { width: 4px; }
.channels-grid::-webkit-scrollbar-thumb { background: rgba(124,58,237,.25); border-radius: 2px; }

/* LIST VIEW MODE */
.channels-grid[data-view="list"] {
  grid-template-columns: 1fr;
  grid-auto-rows: max-content;
  gap: 8px;
}
.channels-grid[data-view="list"] .channel-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  border-radius: var(--r-md);
}
.channels-grid[data-view="list"] .channel-thumb {
  width: 80px; min-width: 80px;
  aspect-ratio: 1/1;
  border-radius: var(--r-md);
  overflow: hidden;
  flex-shrink: 0;
}
.channels-grid[data-view="list"] .channel-info {
  flex: 1; padding: 8px 12px 8px 0;
}
.channels-grid[data-view="list"] .channel-name {
  font-size: .9rem;
  white-space: normal;
  overflow: visible;
}
.channels-grid[data-view="list"] .thumb-live-badge { font-size: .56rem; }

/* Channel Card */
.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer;
  transition: all .25s ease;
  animation: cardIn .35s ease both;
  display: flex;
  flex-direction: column;
  min-height: fit-content;
}
@keyframes cardIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.channel-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124,58,237,.4);
  box-shadow: 0 10px 30px rgba(0,0,0,.4), 0 0 0 1px rgba(124,58,237,.2);
}
.channel-card.active {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(124,58,237,.3), 0 8px 24px rgba(0,0,0,.4);
}

.channel-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.thumb-gradient {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.thumb-logo { font-size: clamp(1.4rem,3vw,2rem); position: relative; z-index: 1; }

.thumb-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.25);
  opacity: 0; transition: opacity .2s;
  display: flex; align-items: center; justify-content: center;
}
.channel-card:hover .thumb-overlay,
.channel-card.active .thumb-overlay { opacity: 1; }

.play-icon-overlay {
  width: clamp(32px,5vw,42px); height: clamp(32px,5vw,42px);
  background: rgba(255,255,255,.9); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transform: scale(.8); transition: transform .2s;
}
.channel-card:hover .play-icon-overlay { transform: scale(1); }
.play-icon-overlay svg { color: #090912; margin-right: -2px; }

.thumb-live-badge {
  position: absolute; top: 7px; right: 7px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(244,63,94,.92); color: white;
  font-size: .58rem; font-weight: 700;
  padding: 2px 7px; border-radius: 100px; letter-spacing: .8px;
}
.thumb-live-badge .live-dot { width: 5px; height: 5px; }

/* Channel name on thumbnail */
.thumb-channel-name {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 18px 8px 6px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  font-size: clamp(.62rem, 1.1vw, .75rem);
  font-weight: 700;
  color: white;
  text-align: center;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  line-height: 1.3;
}

.channel-info { padding: clamp(8px,1.5vw,12px); }
.channel-name {
  font-size: clamp(.76rem,1.2vw,.85rem); font-weight: 700;
  color: var(--text-primary); margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.channel-meta { display: flex; align-items: center; justify-content: space-between; }
.channel-category {
  font-size: .65rem; color: var(--text-muted);
  background: rgba(255,255,255,.05); padding: 2px 8px; border-radius: 100px;
}
.fav-btn {
  width: 26px; height: 26px; border: none; background: none;
  cursor: pointer; color: var(--text-muted); padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.fav-btn.active { color: var(--amber); }
.fav-btn:active { transform: scale(.8); }

/* No Results */
.no-results {
  grid-column: 1 / -1; text-align: center;
  padding: 40px 20px; color: var(--text-muted);
}
.no-results svg { margin-bottom: 12px; opacity: .35; }
.no-results p { font-size: .9rem; }

/* ============================================
   BOTTOM NAV (Mobile only)
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--bottom-nav-h);
  background: rgba(17,17,32,.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: none;
  align-items: stretch;
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  flex: 1; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; transition: all .2s; font-family: 'Cairo',sans-serif;
  position: relative;
}
.nav-item span { font-size: .6rem; font-weight: 600; }
.nav-item::before {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 28px; height: 2px;
  background: var(--grad-main); border-radius: 0 0 3px 3px;
  transition: transform .25s;
}
.nav-item.active { color: var(--purple-light); }
.nav-item.active::before { transform: translateX(-50%) scaleX(1); }
.nav-item:active { transform: scale(.88); }

/* Mobile FAB */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 14px);
  left: 16px;
  width: 50px; height: 50px;
  border-radius: 50%; border: none;
  background: var(--grad-main); color: white; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(124,58,237,.5);
  transition: all .2s;
  z-index: 100;
}
.fab:active { transform: scale(.9) rotate(45deg); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(8px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: overlayIn .2s ease;
}
@keyframes overlayIn { from{opacity:0} to{opacity:1} }

.modal {
  background: var(--bg-secondary);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  width: 100%; max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: modalIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalIn { from{opacity:0;transform:scale(.95) translateY(10px)} to{opacity:1;transform:scale(1) translateY(0)} }

.modal-header {
  padding: 20px 20px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-secondary); z-index: 1;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; border: none;
  background: rgba(255,255,255,.07); border-radius: 50%;
  color: var(--text-muted); cursor: pointer; font-size: .75rem;
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.modal-close:hover { background: rgba(244,63,94,.2); color: var(--rose); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); }
.form-group input, .form-group select {
  height: 44px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 0 14px; color: var(--text-primary);
  font-family: 'Cairo',sans-serif; font-size: .87rem; outline: none;
  transition: all .2s; direction: rtl;
}
.form-group input[dir="ltr"] { direction: ltr; }
.form-group input:focus, .form-group select:focus {
  border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.form-group select option { background: var(--bg-secondary); }

.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.color-swatch {
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; transition: all .2s;
  border: 3px solid transparent; outline: 2px solid transparent;
}
.color-swatch.active { outline: 2px solid white; outline-offset: 2px; transform: scale(1.12); }

.modal-footer {
  padding: 0 20px 20px; display: flex; gap: 10px;
}
.btn-cancel, .btn-add {
  flex: 1; height: 46px; border-radius: var(--r-md); border: none;
  font-family: 'Cairo',sans-serif; font-size: .88rem; font-weight: 700; cursor: pointer;
  transition: all .2s;
}
.btn-cancel {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-cancel:hover { background: var(--bg-card-hover); }
.btn-add {
  background: var(--grad-main); color: white;
  box-shadow: 0 4px 16px rgba(124,58,237,.35);
}
.btn-add:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,.5); }
.btn-add:active { transform: scale(.97); }

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(28,28,46,.97);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  color: var(--text-primary); font-size: .85rem; font-weight: 500;
  padding: 11px 22px; border-radius: 100px;
  z-index: 1000; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* ──── MOBILE (< 768px) ──── */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    right: 0; top: 0; bottom: 0;
    transform: translateX(0);
    z-index: 200;
    width: min(280px, 80vw);
  }
  .hamburger-btn { display: flex; }
  .mobile-logo { display: flex; }
  .page-title { display: none; }
  .desktop-search { display: none; }
  .header-btn#addChannelBtnHeader { display: none; }
  .main-content { padding-bottom: var(--bottom-nav-h); }
  .bottom-nav { display: flex; }
  .fab { display: flex; }

  .player-container { aspect-ratio: 16/9; }

  .toast { bottom: calc(var(--bottom-nav-h) + 12px); }
}

/* ──── TABLET (768px – 1023px) ──── */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar { width: var(--sidebar-w-icon); }
  .sidebar-logo-text { display: none; }
  .sidebar-nav-item span:not(.nav-badge) { display: none; }
  .sidebar-nav-item { justify-content: center; padding: 12px; }
  .sidebar-nav-item.active::before { right: 0; top: auto; left: 0; bottom: 0; width: 100%; height: 2px; border-radius: 0; }
  .sidebar-add-btn span { display: none; }
  .sidebar-add-btn { justify-content: center; padding: 10px; }
  .sidebar-footer { padding: 10px 8px; }
  .nav-badge { display: none; }

  .hamburger-btn { display: none; }
  .mobile-logo { display: none; }
  .page-title { display: block; }
  .desktop-search { display: flex; }
  .header-btn#searchBtn { display: none; }
  .bottom-nav { display: none; }
  .fab { display: none; }

  .home-layout { flex-direction: column; }
  .channels-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ──── LAPTOP / DESKTOP (1024px – 1599px) ──── */
@media (min-width: 1024px) {
  .hamburger-btn { display: none; }
  .mobile-logo { display: none; }
  .page-title { display: block; }
  .desktop-search { display: flex; }
  .header-btn#searchBtn { display: none; }
  .bottom-nav { display: none; }
  .fab { display: none; }

  /* Two-column layout: player left, channels right */
  .home-layout {
    flex-direction: row;
    align-items: stretch;
  }

  .player-col {
    flex: 0 0 55%;
    max-width: 55%;
    border-left: 1px solid var(--border);
    overflow-y: auto;
    scrollbar-width: none;
  }
  .player-col::-webkit-scrollbar { display: none; }

  .player-container { aspect-ratio: 16/9; }

  .channels-col {
    flex: 1;
    overflow: hidden;
  }

  .channels-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ──── LARGE DESKTOP (1600px+) ──── */
@media (min-width: 1600px) {
  :root { font-size: 17px; }
  .player-col { flex: 0 0 60%; max-width: 60%; }
  .channels-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ──── TV / 4K (1920px+) ──── */
@media (min-width: 1920px) {
  :root {
    font-size: 20px;
    --sidebar-w: 280px;
    --header-h: 72px;
  }
  .sidebar-nav-item { padding: 14px 16px; font-size: 1rem; gap: 14px; }
  .player-col { flex: 0 0 62%; max-width: 62%; }
  .channels-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .channel-card:focus { outline: 3px solid var(--purple); outline-offset: 3px; }
  /* TV remote navigation focus styles */
  .channel-card:focus-within, .ctrl-btn:focus, .sidebar-nav-item:focus {
    outline: 2px solid var(--purple-light);
    outline-offset: 2px;
  }
}

/* ──── Landscape Mobile ──── */
@media (max-width: 767px) and (orientation: landscape) {
  .home-layout { flex-direction: row; }
  .player-col { flex: 0 0 50%; max-width: 50%; }
  .channels-col { flex: 1; }
  .player-container { aspect-ratio: 16/9; }
  .channels-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(124,58,237,.2) transparent; }
