/* ==========================================================================
   StreamPulse IPTV - Design System & Stylesheet
   ========================================================================== */

:root {
  --bg-dark: #090c15;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --bg-glass: rgba(15, 21, 35, 0.65);
  --bg-input: rgba(255, 255, 255, 0.05);

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-purple: #7f00ff;
  --accent-pink: #ff007f;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 242, 254, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --glow-cyan: 0 0 20px rgba(0, 242, 254, 0.25);
  --glow-purple: 0 0 20px rgba(127, 0, 255, 0.25);
  --shadow-main: 0 20px 40px -15px rgba(0, 0, 0, 0.5);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Background Glowing Elements */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-purple), transparent);
  top: -100px;
  left: -100px;
}
.bg-glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-cyan), transparent);
  top: 40%;
  right: -150px;
}
.bg-glow-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--accent-pink), transparent);
  bottom: -100px;
  left: 20%;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 28px;
  background: rgba(9, 12, 21, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
}

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

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: var(--glow-cyan);
}

.logo-text h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-live {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Header Search */
.header-search {
  position: relative;
  flex: 1;
  max-width: 520px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

.header-search input {
  width: 100%;
  padding: 12px 42px 12px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.25s ease;
}

.header-search input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

#search-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

/* Header Actions & Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

.btn-glass {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  padding: 10px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-glass:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.badge-pill {
  background: var(--accent-amber);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.btn-icon, .btn-icon-lg, .btn-icon-sm {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-sm { width: 32px; height: 32px; font-size: 12px; }
.btn-icon { width: 38px; height: 38px; font-size: 14px; }
.btn-icon-lg { width: 48px; height: 48px; font-size: 18px; background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue)); color: #000; border: none; }

.btn-icon:hover, .btn-icon-sm:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-cyan);
}
.btn-icon-lg:hover {
  transform: scale(1.08);
  box-shadow: var(--glow-cyan);
}

/* Geo-Bypass Select Component */
.geo-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--accent-emerald);
}

.geo-select-wrapper label {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

#geo-bypass-select {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

#geo-bypass-select option {
  background: #121726;
  color: #fff;
}

.top-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-glass-sm {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-glass-sm:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}
.btn-glass-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-glass-lg {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.12), rgba(127, 0, 255, 0.12));
  color: var(--text-main);
  border: 1px solid var(--border-focus);
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s ease;
}
.btn-glass-lg:hover {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.3);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

/* Main Container Layout */
.app-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1800px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: calc(100vh - 120px);
  position: sticky;
  top: 96px;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}
.sidebar-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.filter-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-pills, .quality-pills, .provider-pills, .language-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 2px;
}

.cat-pill, .qual-pill, .prov-pill, .lang-pill {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-pill:hover, .qual-pill:hover, .prov-pill:hover, .lang-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.cat-pill.active, .qual-pill.active, .prov-pill.active, .lang-pill.active {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 242, 254, 0.25);
}

/* Country List Filter */
.country-filter-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.country-filter-header input {
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 12px;
}
.country-filter-header input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.country-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.country-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.country-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.country-item.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

.country-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.country-flag {
  font-size: 16px;
}

.country-count {
  font-size: 11px;
  opacity: 0.6;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* Main Content Area */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero Player Wrapper */
.player-wrapper {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-main);
}

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

#video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Custom Overlays */
.player-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 13, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
  padding: 30px;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error-icon {
  font-size: 44px;
  color: var(--accent-red);
}

.error-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Custom Player Controls */
.custom-controls {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.85) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.video-container:hover .custom-controls {
  opacity: 1;
}

.controls-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.channel-meta-overlay {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-flag-lg {
  font-size: 32px;
}

.channel-titles h3 {
  font-size: 18px;
  font-weight: 800;
}
.channel-titles p {
  font-size: 12px;
  color: var(--text-muted);
}

.controls-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

#volume-slider {
  width: 80px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.live-indicator {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.4);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* Player Info Bar */
.player-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(10, 14, 24, 0.6);
  border-top: 1px solid var(--border-glass);
}

.info-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}
.badge-purple { background: rgba(127, 0, 255, 0.15); color: #c084fc; border-color: rgba(127, 0, 255, 0.3); }
.badge-cyan { background: rgba(0, 242, 254, 0.15); color: var(--accent-cyan); border-color: rgba(0, 242, 254, 0.3); }
.badge-emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border-color: rgba(16, 185, 129, 0.3); }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); border-color: rgba(245, 158, 11, 0.3); }

.info-actions {
  display: flex;
  gap: 8px;
}

/* Channel Grid & Controls Header */
.grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.grid-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.grid-title h2 {
  font-size: 20px;
  font-weight: 800;
}

.count-tag {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

.grid-controls-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.page-size-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 3px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.btn-size-opt {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-size-opt.active {
  background: var(--accent-cyan);
  color: #000;
}

.pagination-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.view-mode-toggle {
  display: flex;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.view-mode-toggle .btn-icon-sm.active {
  background: var(--accent-cyan);
  color: #000;
  border: none;
}

/* Channel Grid Cards */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.channel-grid.list-view {
  grid-template-columns: 1fr;
}

.channel-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.channel-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(0, 242, 254, 0.4);
  box-shadow: 0 12px 28px -10px rgba(0, 242, 254, 0.2);
}

.channel-card.active-card {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(127,0,255,0.4), rgba(0,242,254,0.4));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  border: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.card-fav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 4px;
}

.card-fav-btn:hover, .card-fav-btn.is-fav {
  color: var(--accent-amber);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-country {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-res-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(0, 242, 254, 0.12);
  color: var(--accent-cyan);
}

.card-lang-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
}

.card-cat-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
}

.card-play-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.channel-card:hover .card-play-btn {
  background: var(--accent-cyan);
  color: #000;
}

.load-more-bar {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

/* Pagination Footer */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  flex-wrap: wrap;
}

.page-numbers {
  display: flex;
  gap: 4px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  padding: 14px 22px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-main);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.text-amber { color: var(--accent-amber); }
.text-red { color: var(--accent-red); }
.hidden { display: none !important; }

/* Sidebar Backdrop Overlay for Mobile Drawer */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 499;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-filter-btn {
  display: none;
}

.mobile-close-btn {
  display: none;
}

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

/* ==========================================================================
   Responsive Breakpoints & Mobile Optimization
   ========================================================================== */

/* Tablet Breakpoint (max-width: 1024px) */
@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px;
  }
}

/* Mobile Filter Drawer Breakpoint (max-width: 900px) */
@media (max-width: 900px) {
  .mobile-filter-btn {
    display: inline-flex;
  }

  .mobile-close-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    z-index: 500;
    background: rgba(11, 15, 25, 0.98);
    backdrop-filter: blur(24px);
    border-right: 1px solid var(--border-glass);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.6);
    overflow-y: auto;
    border-radius: 0;
    padding: 20px;
  }

  .sidebar.open {
    transform: translateX(0);
  }
}

/* Smartphone Breakpoint (max-width: 768px) */
@media (max-width: 768px) {
  .app-header {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
  }

  .header-brand {
    gap: 10px;
  }

  .logo-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .logo-text h1 {
    font-size: 17px;
  }

  .subtitle {
    display: none;
  }

  .header-search {
    order: 3;
    width: 100%;
    max-width: 100%;
  }

  .header-search input {
    padding: 10px 38px 10px 38px;
    font-size: 13px;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions button span {
    display: none;
  }

  .header-actions .btn-glass,
  .header-actions .btn-accent {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: var(--radius-md);
  }

  .badge-pill {
    padding: 2px 6px;
    font-size: 10px;
  }

  /* Video Player Mobile Optimizations */
  .player-wrapper {
    border-radius: var(--radius-lg);
  }

  .channel-flag-lg {
    font-size: 24px;
  }

  .channel-titles h3 {
    font-size: 15px;
  }

  .channel-titles p {
    font-size: 11px;
  }

  .geo-select-wrapper label span {
    display: none;
  }

  #geo-bypass-select {
    font-size: 11px;
  }

  .controls-left, .controls-right {
    gap: 8px;
  }

  #volume-slider {
    width: 50px;
  }

  .btn-icon-lg {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .player-info-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }

  .info-badges {
    flex-wrap: wrap;
    gap: 6px;
  }

  .tag-badge {
    font-size: 10px;
    padding: 3px 8px;
  }

  .info-actions {
    width: 100%;
    justify-content: space-between;
  }

  .info-actions button {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 11px;
  }

  /* Grid Header & Pagination Mobile */
  .grid-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .grid-controls-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .page-size-selector {
    font-size: 11px;
  }

  .btn-size-opt {
    padding: 2px 6px;
    font-size: 10px;
  }

  /* Channel Grid Mobile Cards (2 Columns) */
  .channel-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .channel-card {
    border-radius: var(--radius-md);
  }

  .card-thumbnail {
    height: 110px;
  }

  .play-btn-overlay {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .card-details {
    padding: 10px 12px;
    gap: 4px;
  }

  .channel-name {
    font-size: 13px;
  }

  .channel-meta {
    font-size: 10px;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 20px;
    justify-content: center;
    font-size: 12px;
    padding: 12px 18px;
  }
}

/* Small Smartphone Breakpoint (max-width: 420px) */
@media (max-width: 420px) {
  .app-header {
    padding: 8px 10px;
  }

  .channel-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card-thumbnail {
    height: 95px;
  }

  .card-details {
    padding: 8px 10px;
  }

  .channel-name {
    font-size: 12px;
  }
}

/* Full Screen Container Styles (Native + CSS Fallback) */
.video-container:fullscreen,
.video-container:-webkit-full-screen,
.video-container:-moz-full-screen,
.video-container:-ms-fullscreen,
.video-container.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  aspect-ratio: unset !important;
  border-radius: 0 !important;
  background: #000 !important;
  z-index: 999999 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.video-container:fullscreen video,
.video-container:-webkit-full-screen video,
.video-container:-moz-full-screen video,
.video-container.is-fullscreen video {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

.video-container:fullscreen .custom-controls,
.video-container:-webkit-full-screen .custom-controls,
.video-container.is-fullscreen .custom-controls {
  z-index: 1000000 !important;
}

/* Footer Styling for AdSense Compliance */
.app-footer {
  margin-top: 40px;
  padding: 24px 20px;
  border-top: 1px solid var(--border-glass);
  text-align: center;
  background: rgba(5, 7, 13, 0.6);
  color: var(--text-muted);
  font-size: 13px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-links a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  text-decoration: underline;
}




