@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Barlow:wght@400;500;600&display=swap');

/* ── VARIABLES ── */
:root {
  --bg:       #080a0f;
  --surface:  #0f1218;
  --surface2: #161b25;
  --accent:   #e8323c;
  --text:     #d8dce8;
  --muted:    #48505f;
  --border:   #1c2232;
  --online:   #1fd46a;
  --offline:  #e8323c;
  --limit:    #f0a020;
  --sidebar-w: 210px;
  --bar-h:     44px;
}

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
}

/* ── ROTATE OVERLAY ── */
#rotate-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; text-align: center;
}
#rotate-overlay .ri {
  font-size: 58px;
  animation: rh 1.6s ease-in-out infinite;
}
@keyframes rh {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(90deg); }
}
#rotate-overlay p {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px; letter-spacing: 2px;
  color: var(--accent);
}
#rotate-overlay small { color: var(--muted); font-size: 13px; }

@media (orientation: portrait) and (max-width: 768px) {
  #rotate-overlay { display: flex; }
  #app            { display: none !important; }
}

/* ── ROOT LAYOUT ── */
#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition:
    width     0.26s cubic-bezier(.4, 0, .2, 1),
    min-width 0.26s cubic-bezier(.4, 0, .2, 1),
    opacity   0.18s;
}
#sidebar.closed {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-head {
  height: var(--bar-h);
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.sidebar-head-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px; letter-spacing: 2px;
  color: var(--accent);
  white-space: nowrap;
}

/* ── CHANNEL LIST ── */
.channel-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 5px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.channel-list::-webkit-scrollbar       { width: 3px; }
.channel-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.ch-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.ch-item:hover      { background: var(--surface2); }
.ch-item.active     { background: rgba(232,50,60,0.08); border-left-color: var(--accent); }
.ch-item.is-offline { opacity: 0.4; }

.ch-logo {
  width: 32px; height: 32px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px;
  flex-shrink: 0;
}

.ch-meta  { flex: 1; overflow: hidden; }

.ch-name {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}

.ch-badge {
  display: flex; align-items: center; gap: 4px;
  margin-top: 2px; font-size: 9px; font-weight: 500;
}

.dot {
  width: 5px; height: 5px; border-radius: 50%;
  flex-shrink: 0; display: inline-block;
}
.dot.online  { background: var(--online);  box-shadow: 0 0 4px var(--online); }
.dot.offline { background: var(--offline); }
.dot.limit   { background: var(--limit); }

/* ── MAIN AREA ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
  min-width: 0;
}

/* ── TOP BAR ── */
#player-bar {
  height: var(--bar-h);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  flex-shrink: 0;
}

/* hamburger in bar */
#toggle-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text);
  width: 30px; height: 30px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
#toggle-btn:hover { background: var(--border); color: var(--accent); }
#toggle-btn svg   { width: 17px; height: 17px; }

.live-pill {
  display: flex; align-items: center; gap: 5px;
  background: var(--accent);
  color: #fff;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 11px; letter-spacing: 1.5px;
  padding: 2px 8px; border-radius: 4px;
  flex-shrink: 0;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff;
  animation: blink 1s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }

#current-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 17px; letter-spacing: 2px;
  color: var(--text); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── PLAYER WRAP ── */
#player-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
}
#player-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: none; display: block;
}

/* ── LOADING ── */
#loading {
  position: absolute; inset: 0; z-index: 5;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  transition: opacity 0.3s;
}
#loading.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loading p {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px; letter-spacing: 2px; color: var(--muted);
}

/* ── OFFLINE SCREEN ── */
#offline-screen {
  position: absolute; inset: 0; z-index: 6;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
}
#offline-screen.show { display: flex; }

#offline-screen .bi { font-size: 46px; opacity: 0.3; }
#offline-screen p {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 17px; letter-spacing: 2px; color: var(--offline);
}
#offline-screen small { color: var(--muted); font-size: 12px; }