/* ========= Reset & Base ========= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface2: #16213e;
  --accent: #e94560;
  --accent2: #0f3460;
  --text: #eaeaea;
  --text-muted: #888;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --transition: 0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ========= Header ========= */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.logo-icon { font-size: 1.4rem; }

/* ========= Badge de conexión ========= */
.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255,255,255,0.07);
  border: 1px solid transparent;
  transition: var(--transition);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.badge--ok .badge-dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.badge--warn .badge-dot { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.badge--danger .badge-dot { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* ========= Suspension banner ========= */
.suspension-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(239, 68, 68, 0.15);
  border-bottom: 2px solid var(--danger);
  color: #fca5a5;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ========= Tabs ========= */
.tabs {
  display: flex;
  gap: 4px;
  padding: 16px 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.tab {
  padding: 10px 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  border-radius: 8px 8px 0 0;
}

.tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.tab--active { color: var(--accent); border-bottom-color: var(--accent); }

/* ========= Player ========= */
.player-section { padding: 20px; }

.player-container {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.player-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--text-muted);
}

.player-idle-icon { font-size: 3rem; opacity: 0.4; }

/* Audio player */
.audio-player { padding: 24px; }

.now-playing {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.now-playing-art {
  width: 64px;
  height: 64px;
  background: var(--accent2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.now-playing-info { display: flex; flex-direction: column; gap: 4px; }
.stream-title { font-size: 1rem; font-weight: 700; }
.stream-quality { font-size: 0.8rem; color: var(--text-muted); }

.player-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.btn-play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-play:hover { background: #c73652; transform: scale(1.05); }

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

input[type=range] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Video player */
.video-player { position: relative; }

#video-element {
  width: 100%;
  display: block;
  max-height: 340px;
  background: #000;
}

.video-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0,0,0,0.4);
}

/* Emergency banner */
.emergency-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(245,158,11,0.15);
  border-top: 1px solid var(--warn);
  color: #fcd34d;
  font-size: 0.88rem;
}

/* ========= Streams Grid ========= */
.streams-section { padding: 0 20px 32px; }

.streams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.stream-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stream-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
  transform: translateY(-2px);
}

.stream-card.active {
  border-color: var(--accent);
  background: rgba(233,69,96,0.1);
}

.stream-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--accent2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stream-card-info { flex: 1; min-width: 0; }

.stream-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.stream-card-quality {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ========= Loading & Error ========= */
.loading-state, .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px;
  color: var(--text-muted);
}

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

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

.btn-retry {
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-retry:hover { background: #c73652; }

/* ========= Utilities ========= */
.hidden { display: none !important; }

/* ========= Responsive ========= */
@media (max-width: 480px) {
  .streams-grid { grid-template-columns: 1fr; }
  .player-idle { padding: 32px 20px; }
  .audio-player { padding: 16px; }
}
