/* IPTV Smarters Pro • Stylesheet for Meta Ray-Ban Display & Mobile Companion */

:root {
  --bg-primary: #070913;
  --bg-surface: #0e1326;
  --bg-card: rgba(18, 24, 46, 0.85);
  --bg-card-hover: rgba(28, 38, 70, 0.95);
  --border-color: rgba(139, 92, 246, 0.25);
  --border-focus: #8b5cf6;
  
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.45);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.4);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Base Root Container */
.hud-root {
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at 50% 0%, #15102a 0%, #070913 75%);
}

/* ==========================================================================
   GLASSES HUD MODE OVERRIDE (600x600 Pure Pitch Black for Waveguide Display)
   ========================================================================== */
body.mode-glasses-hud {
  background-color: #000000 !important;
  color: #00f0ff !important;
}

body.mode-glasses-hud .hud-root {
  width: 600px;
  height: 600px;
  max-width: 600px;
  max-height: 600px;
  overflow: hidden;
  background: #000000 !important;
  border: 1px solid #1e293b;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.15);
}

body.mode-glasses-hud .hub-card {
  background: #000000 !important;
  border: 2px solid #00f0ff !important;
}

body.mode-glasses-hud .hub-card:focus,
body.mode-glasses-hud .hub-card.focused {
  border-color: #00ff88 !important;
  background: rgba(0, 255, 136, 0.1) !important;
  transform: scale(1.02);
}

/* ==========================================================================
   TOP NAVIGATION & STATUS BAR
   ========================================================================== */
.top-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(14, 19, 38, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 12px var(--accent-purple-glow);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.brand-name b {
  color: var(--accent-cyan);
}

.brand-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-purple);
  text-transform: uppercase;
}

.glasses-mode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulseAnim 1.6s infinite ease-in-out;
}

@keyframes pulseAnim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.clock-display {
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--accent-purple);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.account-pill:hover {
  background: rgba(139, 92, 246, 0.28);
}

.account-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.qr-btn {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(185, 28, 28, 0.4));
  border-color: #ef4444;
  color: #ff8080;
}

.qr-btn:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #ffffff;
}

/* ==========================================================================
   GLOBAL SEARCH DRAWER
   ========================================================================== */
.search-bar-drawer {
  display: none;
  flex-direction: column;
  padding: 16px 20px;
  background: #0d1224;
  border-bottom: 2px solid var(--accent-purple);
  gap: 12px;
}

.search-bar-drawer.open {
  display: flex;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: #141b34;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  gap: 10px;
}

.search-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 15px;
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}

.search-tabs {
  display: flex;
  gap: 8px;
}

.search-tab {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.search-tab.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #ffffff;
}

.search-results-container {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   MAIN VIEW 1: DASHBOARD (IPTV SMARTERS 4-CARD HUB)
   ========================================================================== */
.dashboard-view {
  padding: 24px 20px;
  display: none;
  flex-direction: column;
  gap: 22px;
  flex: 1;
}

.dashboard-view.active-view {
  display: flex;
}

.user-greeting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.greeting-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.greeting-title span {
  color: var(--accent-cyan);
}

.greeting-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.green-text {
  color: var(--accent-emerald);
}

.dash-action-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-purple);
  border: none;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.dash-action-btn:hover {
  background: #7c3aed;
  box-shadow: 0 0 16px var(--accent-purple-glow);
}

/* 4 Main Signature Hub Cards Grid */
.smarters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.hub-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 210px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  outline: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.hub-card:hover, .hub-card:focus {
  transform: translateY(-4px);
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
  box-shadow: 0 16px 40px rgba(139, 92, 246, 0.25);
}

/* Individual Card Accent Themes */
.live-card {
  border-top: 4px solid var(--accent-emerald);
}
.live-card:hover, .live-card:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 16px 40px rgba(16, 185, 129, 0.25);
}

.vod-card {
  border-top: 4px solid var(--accent-cyan);
}
.vod-card:hover, .vod-card:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 16px 40px rgba(6, 182, 212, 0.25);
}

.series-card {
  border-top: 4px solid var(--accent-purple);
}
.series-card:hover, .series-card:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 16px 40px rgba(139, 92, 246, 0.25);
}

.fav-card {
  border-top: 4px solid var(--accent-amber);
}
.fav-card:hover, .fav-card:focus {
  border-color: var(--accent-amber);
  box-shadow: 0 16px 40px rgba(245, 158, 11, 0.25);
}

.hub-card-icon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.icon-inner {
  font-size: 38px;
}

.live-pulse {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.08em;
}

.vod-badge {
  background: rgba(6, 182, 212, 0.2);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.series-badge {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.fav-badge {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--accent-amber);
  color: var(--accent-amber);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.hub-title {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.hub-sub {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}

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

.hub-btn-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.hub-arrow {
  color: var(--accent-cyan);
  font-size: 16px;
  transition: transform 0.2s ease;
}

.hub-card:hover .hub-arrow, .hub-card:focus .hub-arrow {
  transform: translateX(4px);
}

.inlens-hud-hint {
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* ==========================================================================
   MAIN VIEW 2: CONTENT BROWSER (SPLIT LAYOUT)
   ========================================================================== */
.content-browser-view {
  display: none;
  flex-direction: column;
  flex: 1;
}

.browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #0d1222;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.back-btn {
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.browser-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.browser-type-badge {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  background: var(--accent-purple);
  color: #ffffff;
}

.browser-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
}

.browser-filter-box input {
  padding: 6px 12px;
  background: #141b33;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 13px;
  outline: none;
  min-width: 220px;
}

.browser-split-body {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 130px);
}

/* Sidebar Categories List */
.category-sidebar {
  width: 280px;
  background: #090d1a;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cat-total-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  color: #ffffff;
}

.category-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.category-item {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.category-item:hover, .category-item:focus {
  background: rgba(139, 92, 246, 0.15);
  color: #ffffff;
}

.category-item.active {
  background: var(--accent-purple);
  color: #ffffff;
  font-weight: 700;
}

/* Streams Content Area */
.streams-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: #070a14;
}

.streams-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.active-category-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
}

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

/* Items Grid */
.streams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  overflow-y: auto;
  flex: 1;
  align-content: flex-start;
}

/* Channel Card */
.channel-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.channel-card:hover, .channel-card:focus {
  background: var(--bg-card-hover);
  border-color: var(--accent-emerald);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.channel-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: #151a2d;
  padding: 4px;
}

.channel-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-emerald);
}

.channel-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Poster Card (VOD & Series) */
.poster-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.poster-card:hover, .poster-card:focus {
  border-color: var(--accent-cyan);
  transform: scale(1.03);
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.25);
}

.poster-img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: #11162b;
}

.poster-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.poster-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}

.poster-rating {
  color: var(--accent-amber);
  font-weight: 800;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.page-btn {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.page-btn:hover {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.page-info {
  font-size: 12px;
  color: var(--text-dim);
}

/* ==========================================================================
   MAIN VIEW 3: DEDICATED VIDEO PLAYER SCREEN
   ========================================================================== */
.player-overlay-view {
  display: none;
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 200;
  flex-direction: column;
}

.player-overlay-view.active {
  display: flex;
}

.video-stage {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
}

#iptv-video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000000;
}

/* Aspect Ratio classes */
#iptv-video.aspect-fill {
  object-fit: cover !important;
}
#iptv-video.aspect-16-9 {
  aspect-ratio: 16/9 !important;
}

.player-spinner {
  position: absolute;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.7);
  padding: 20px 30px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-purple);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

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

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

/* In-Lens HUD Stream OSD */
.hud-stream-osd {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 24px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, transparent 25%, transparent 75%, rgba(0,0,0,0.92) 100%);
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}

.hud-stream-osd.hidden-osd {
  opacity: 0;
  pointer-events: none;
}

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

.osd-close-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid #ef4444;
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.osd-stream-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.osd-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-emerald);
  letter-spacing: 0.1em;
}

.osd-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.osd-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.osd-right-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.osd-time {
  font-family: monospace;
  font-size: 14px;
  color: #ffffff;
}

.osd-icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
}

/* OSD Timeline */
.osd-timeline-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 10px;
}

.seek-slider {
  flex: 1;
  height: 6px;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.time-label {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-dim);
}

/* OSD Bottom Controls */
.osd-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ctrl-group-left, .ctrl-group-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.main-play-btn {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  font-size: 13px;
  padding: 8px 18px;
}

.main-play-btn:hover {
  background: #7c3aed;
  box-shadow: 0 0 16px var(--accent-purple-glow);
}

/* ==========================================================================
   MODAL WINDOWS (DETAILS, QR PAIRING, ACCOUNT SETTINGS)
   ========================================================================== */
.detail-modal-backdrop,
.pair-modal-backdrop,
.account-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.detail-modal-backdrop.open,
.pair-modal-backdrop.open,
.account-modal-backdrop.open {
  display: flex;
}

.detail-modal-card,
.pair-modal-box,
.account-modal-box {
  background: #0f1428;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.modal-x-btn, .pair-modal-close, .account-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

/* Detail Modal Specifics */
.detail-body {
  display: flex;
  padding: 24px;
  gap: 20px;
}

.detail-poster-img {
  width: 180px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.detail-info-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-cyan);
}

.detail-title {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
}

.detail-meta-row {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

.detail-plot {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.btn-play-hero {
  padding: 10px 22px;
  background: var(--accent-emerald);
  border: none;
  border-radius: var(--radius-sm);
  color: #000000;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-play-hero:hover {
  background: #34d399;
  transform: translateY(-1px);
}

.btn-fav-secondary {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

/* Series Season Select & Episodes */
.series-season-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.series-season-box select {
  padding: 6px 10px;
  background: #171d36;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 13px;
}

.episodes-list {
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.episode-item {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.episode-item:hover {
  background: rgba(139, 92, 246, 0.2);
}

/* QR Modal Specifics */
.pair-modal-head, .account-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
}

.pair-modal-content, .account-modal-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pair-instructions {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.qr-showcase-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.qr-showcase-card {
  background: #090c1a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-showcase-card.primary-qr {
  border-color: #ef4444;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, #090c1a 100%);
}

.qr-card-tag {
  font-size: 9px;
  font-weight: 800;
  background: #ef4444;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

.qr-showcase-card h3 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}

.qr-showcase-card p {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.qr-img-frame {
  background: #ffffff;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.modal-qr-image {
  width: 140px;
  height: 140px;
  display: block;
  image-rendering: pixelated;
}

.btn-open-meta, .btn-open-web {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}

.btn-open-meta {
  background: #ef4444;
  color: #ffffff;
}

.btn-open-web {
  background: #1e293b;
  color: #e2e8f0;
}

.tunnel-note {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tunnel-note code {
  color: var(--accent-emerald);
  word-break: break-all;
  font-size: 11px;
}

/* Account Form Specifics */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-row label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.form-row input {
  padding: 9px 12px;
  background: #141b33;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 13px;
  outline: none;
}

.form-row input:focus {
  border-color: var(--accent-purple);
}

.account-stats-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 14px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
}

.stat-line b {
  color: #ffffff;
}

.form-actions {
  display: flex;
  gap: 10px;
}

.btn-save-acc {
  flex: 1;
  padding: 10px;
  background: var(--accent-purple);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.btn-test-acc {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE & TABLET ADJUSTMENTS)
   ========================================================================== */
@media (max-width: 768px) {
  .top-nav-bar {
    padding: 10px 14px;
  }
  .brand-sub, .btn-text {
    display: none;
  }
  .browser-split-body {
    flex-direction: column;
  }
  .category-sidebar {
    width: 100%;
    max-height: 180px;
  }
  .qr-showcase-grid {
    grid-template-columns: 1fr;
  }
  .detail-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .detail-actions {
    justify-content: center;
  }
}

/* Two-step browser: full-screen category list first, then that category's streams */
#view-browser.step-categories .streams-container,
#view-browser.step-streams .category-sidebar {
  display: none;
}
#view-browser.step-categories .category-sidebar {
  width: 100%;
  max-height: none;
  border-right: none;
}
#view-browser.step-categories .category-list {
  max-height: calc(100vh - 170px);
}
#view-browser.step-categories .category-item {
  min-height: 52px;
  font-size: 16px;
}

/* Neural Band / D-pad focus ring: always obvious in the lens */
:focus-visible,
.category-item:focus,
.channel-card:focus,
.poster-card:focus,
.episode-item:focus,
.search-result-row:focus {
  outline: 3px solid #facc15;
  outline-offset: -3px;
}
