/* ==========================================================================
   GLOBAL IPTV 3D GLOBE STREAM MESH - DESIGN SYSTEM & CYBER HUD
   Open Network SaaS by Samin Sami
   ========================================================================== */

:root {
  --bg-void: #030708;
  --bg-panel: rgba(8, 14, 18, 0.88);
  --bg-panel-solid: #090e13;
  --bg-panel-hover: rgba(18, 30, 38, 0.95);
  
  --emerald-primary: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.4);
  --cyan-primary: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.4);
  --gold-primary: #f59e0b;
  --crimson-primary: #ef4444;
  --purple-primary: #8b5cf6;
  --pink-primary: #ec4899;
  
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(16, 185, 129, 0.35);
  --border-cyan: rgba(6, 182, 212, 0.35);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Share Tech Mono', monospace;
  
  --header-height: 56px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-void);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  user-select: none;
}

/* Background Atmosphere Grid */
.radar-grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(to right, rgba(16, 185, 129, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 1;
}

/* Scanline Effect */
.scanlines {
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%);
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 999;
  opacity: 0.25;
}

/* App Root Container */
#globeApp {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Map Canvas Container */
#mapContainer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: radial-gradient(circle at center, #071317 0%, #030708 85%);
}

/* Top Navigation Bar */
.globe-topbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 100;
  pointer-events: none;
}

.topbar-left, .topbar-right, .topbar-center {
  pointer-events: auto;
}

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

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 24px;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.brand-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--emerald-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 10px var(--emerald-glow);
}

.brand-icon::after {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--emerald-primary);
  border-radius: 50%;
  animation: pulseBeacon 2s infinite ease-in-out;
}

.brand-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title .tag {
  font-size: 0.65rem;
  color: var(--emerald-primary);
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-glow);
}

/* Global Quick Search Box */
.globe-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 4px 12px;
  width: 320px;
  max-width: calc(100vw - 260px);
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.globe-search-box:focus-within {
  border-color: var(--cyan-primary);
  box-shadow: 0 0 16px var(--cyan-glow);
  width: 380px;
}

.globe-search-box svg {
  color: var(--text-dim);
  flex-shrink: 0;
  margin-right: 8px;
}

.globe-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  width: 100%;
}

.globe-search-input::placeholder {
  color: var(--text-dim);
}

/* Country Dropdown Selector in Header */
.country-select-wrap {
  display: flex;
  align-items: center;
}

.country-select {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 7px 12px;
  border-radius: 20px;
  backdrop-filter: blur(16px);
  cursor: pointer;
  outline: none;
  transition: border 0.2s;
  max-width: 180px;
}

.country-select:focus, .country-select:hover {
  border-color: var(--emerald-primary);
}

.country-select option {
  background: var(--bg-panel-solid);
  color: #fff;
}

/* Top Right Action Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: blur(16px);
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: var(--bg-panel-hover);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.hud-btn.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-primary);
  border-color: var(--emerald-primary);
  box-shadow: 0 0 12px var(--emerald-glow);
}

/* Floating 4 Map Control Buttons (Bottom Left - EXACT NORTHSTAR MAP REPLICA) */
.globe-controls-pill {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 100;
}

.globe-ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.globe-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.globe-ctrl-btn.active {
  background: rgba(6, 182, 212, 0.18);
  color: var(--cyan-primary);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.globe-ctrl-btn.active.sat {
  background: rgba(16, 185, 129, 0.18);
  color: var(--emerald-primary);
  box-shadow: 0 0 10px var(--emerald-glow);
}

.ctrl-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 2px;
}

/* Bottom Coordinates Radar Telemetry */
.radar-telemetry {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  backdrop-filter: blur(16px);
  z-index: 90;
}

.telemetry-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.telemetry-val {
  color: var(--emerald-primary);
  font-weight: 600;
}

/* Category Filter Pills Bar (Top Center) */
.category-filter-bar {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(6, 10, 14, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  backdrop-filter: blur(16px);
  z-index: 95;
  max-width: 95vw;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.filter-pill.active {
  background: rgba(16, 185, 129, 0.18);
  color: var(--emerald-primary);
  border: 1px solid var(--border-glow);
  font-weight: 600;
}

.filter-pill.bd {
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

/* Floating HUD Live Video Player */
.hud-video-player-panel {
  position: absolute;
  top: 115px;
  right: 20px;
  width: 420px;
  max-width: calc(100vw - 40px);
  background: rgba(8, 14, 18, 0.94);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  backdrop-filter: blur(24px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 20px rgba(16, 185, 129, 0.15);
  z-index: 150;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-video-player-panel.collapsed {
  transform: translateY(-20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
}

.player-header {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.player-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #111;
  object-fit: contain;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.player-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.player-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-primary);
  border: 1px solid var(--border-glow);
}

.signal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-primary);
  animation: pulseBeacon 1.5s infinite;
}

.signal-badge.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--crimson-primary);
  border-color: rgba(239, 68, 68, 0.3);
}

.signal-badge.offline .signal-dot {
  background: var(--crimson-primary);
  animation: none;
}

/* Video Stage */
.player-video-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--emerald-primary);
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, rgba(0,0,0,0.9) 70%);
  pointer-events: none;
}

.player-placeholder.hidden {
  display: none;
}

.player-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--emerald-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Player Custom Controls Toolbar */
.player-toolbar {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.8);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.p-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.p-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.volume-slider {
  width: 60px;
  height: 4px;
  accent-color: var(--emerald-primary);
  cursor: pointer;
}

.stream-coords-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--cyan-primary);
  background: rgba(6, 182, 212, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-cyan);
}

/* Side Channel Drawer Panel (Left Sidebar) */
.channels-drawer {
  position: absolute;
  top: 115px;
  left: 20px;
  bottom: 70px;
  width: 360px;
  max-width: calc(100vw - 40px);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  backdrop-filter: blur(24px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
  z-index: 120;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.channels-drawer.hidden-drawer {
  transform: translateX(-400px);
  opacity: 0;
  pointer-events: none;
}

.drawer-header {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-count-tag {
  font-size: 0.7rem;
  color: var(--emerald-primary);
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-glow);
}

.channel-list-scroll {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 4px 0;
}

.channel-list-scroll::-webkit-scrollbar {
  width: 6px;
}

.channel-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.15s ease;
}

.channel-row:hover {
  background: rgba(16, 185, 129, 0.08);
}

.channel-row.active {
  background: rgba(16, 185, 129, 0.18);
  border-left: 3px solid var(--emerald-primary);
}

.row-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #111;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.row-info {
  flex: 1;
  overflow: hidden;
}

.row-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.row-country-tag {
  color: var(--text-muted);
}

.row-cat-tag {
  color: var(--cyan-primary);
  background: rgba(6, 182, 212, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.load-more-btn {
  width: 100%;
  padding: 12px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: var(--emerald-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
  border-top: 1px solid var(--border-subtle);
}

.load-more-btn:hover {
  background: rgba(16, 185, 129, 0.1);
}

/* MapLibre Tactical Cyber Popups (Northstar Glassmorphic Style) */
.maplibregl-popup {
  max-width: 320px !important;
  z-index: 500 !important;
  font-family: var(--font-sans) !important;
}

.maplibregl-popup-content {
  background: rgba(10, 16, 22, 0.95) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  border-radius: 10px !important;
  padding: 14px !important;
  color: #fff !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(16, 185, 129, 0.25) !important;
  backdrop-filter: blur(16px) !important;
}

.maplibregl-popup-close-button {
  color: #94a3b8 !important;
  font-size: 18px !important;
  padding: 4px 8px !important;
  line-height: 1 !important;
  outline: none !important;
}

.maplibregl-popup-close-button:hover {
  color: #10b981 !important;
}

.maplibregl-popup-tip {
  border-top-color: rgba(16, 185, 129, 0.5) !important;
}

.map-popup-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.map-popup-country {
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-popup-cat {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.map-popup-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin-top: 2px;
}

.map-popup-coords {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #64748b;
}

.map-popup-play-btn {
  background: #10b981;
  color: #000000;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.map-popup-play-btn:hover {
  background: #34d399;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.5);
  transform: translateY(-1px);
}

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

@keyframes pulseBeacon {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 6px var(--emerald-primary)); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Responsive Styles */
@media (max-width: 900px) {
  .globe-search-box {
    width: 200px;
  }
  .hud-video-player-panel {
    top: auto;
    bottom: 80px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: 100%;
  }
  .channels-drawer {
    top: 115px;
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 80px;
  }
  .radar-telemetry {
    display: none;
  }
}
