/* StreamPanel — style.css */

:root {
  --primary:        #6366f1;
  --secondary:      #8b5cf6;
  --bg:             #0f0f1a;
  --surface:        #1a1a2e;
  --surface2:       #16213e;
  --border:         #2a2a4a;
  --text:           #e2e8f0;
  --text-muted:     #94a3b8;
  --danger:         #ef4444;
  --success:        #22c55e;
  --warning:        #f59e0b;
  --radius:         12px;
  --shadow:         0 4px 24px rgba(0,0,0,.4);
}

[data-theme="light"] {
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --surface2:       #f8fafc;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --shadow:         0 4px 24px rgba(0,0,0,.1);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  transition: background .3s, color .3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login ───────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  padding: 1rem;
}
.login-wrap::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}
.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo img { max-height: 60px; max-width: 200px; object-fit: contain; }
.login-logo h1 { font-size: 1.6rem; font-weight: 700; color: var(--primary); }

/* ── Layout ──────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  transition: transform .3s;
}
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-brand img { max-height: 36px; max-width: 130px; object-fit: contain; }
.sidebar-brand span { font-weight: 700; font-size: 1rem; color: var(--primary); }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  color: var(--text-muted);
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: rgba(99,102,241,.08);
  text-decoration: none;
}
.sidebar-nav a i { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.main-wrap { margin-left: 240px; flex: 1; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.content { padding: 1.5rem; flex: 1; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1.25rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.stat-card .stat-val { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-lbl { color: var(--text-muted); font-size: .85rem; }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface2); }
th, td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:hover { background: rgba(99,102,241,.04); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: .4rem; font-weight: 500; font-size: .875rem; }
.form-control, .form-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .55rem .85rem;
  font-size: .9rem;
  transition: border-color .2s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: all .2s;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #4f46e5; }
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning   { background: var(--warning); color: #000; }
.btn-success   { background: var(--success); color: #fff; }
.btn-sm        { padding: .3rem .65rem; font-size: .78rem; border-radius: 6px; }
.btn-icon      { padding: .35rem; border-radius: 6px; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-danger  { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-muted   { background: rgba(148,163,184,.15); color: var(--text-muted); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.show { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow);
  animation: modalIn .25s ease;
}
.modal-box.modal-lg { max-width: 720px; }
@keyframes modalIn { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
.modal-body    { padding: 1.25rem; max-height: 70vh; overflow-y: auto; }
.modal-footer  { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }
.modal-close   { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.25rem; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* ── Player page ─────────────────────────────────────────── */
.player-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.player-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
  flex: 1;
}
.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.player-card-header {
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.player-card-title { font-weight: 600; }
.player-card-body  { padding: 1rem; }

/* Audio player */
.audio-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: .5rem 0;
}
.audio-visualizer {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  justify-content: center;
}
.audio-bar {
  width: 4px;
  background: var(--primary);
  border-radius: 2px;
  animation: audioBounce 1.2s ease-in-out infinite;
  min-height: 4px;
}
.audio-bar:nth-child(2n)   { animation-delay: .2s; background: var(--secondary); }
.audio-bar:nth-child(3n)   { animation-delay: .4s; }
.audio-bar:nth-child(4n)   { animation-delay: .1s; background: var(--secondary); }
.audio-bar.paused { animation-play-state: paused; height: 4px !important; }
@keyframes audioBounce {
  0%,100% { height: 8px; }
  50%      { height: 40px; }
}
.audio-controls { display: flex; align-items: center; gap: 1rem; }
.btn-play {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, background .2s;
}
.btn-play:hover { transform: scale(1.08); background: #4f46e5; }
.volume-wrap { display: flex; align-items: center; gap: .5rem; }
.volume-wrap input[type=range] { width: 90px; accent-color: var(--primary); }

/* Video player */
.video-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.video-wrap video, .video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Live badge pulse */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: rgba(239,68,68,.15);
  color: var(--danger);
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
}
.live-dot {
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.7); }
}

/* ── Online list ─────────────────────────────────────────── */
.online-dot {
  width: 9px; height: 9px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: livePulse 2s infinite;
}

/* ── Alert ───────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .875rem;
}
.alert-danger  { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.alert-info    { background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; }

[data-theme="light"] .alert-danger  { color: #b91c1c; }
[data-theme="light"] .alert-success { color: #15803d; }
[data-theme="light"] .alert-info    { color: #4338ca; }

/* ── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1.1rem;
  min-width: 240px;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: .6rem;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease;
}
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-danger  { border-left: 4px solid var(--danger); }
@keyframes toastIn { from { opacity:0; transform:translateX(30px); } to { opacity:1; transform:translateX(0); } }

/* ── Theme toggle ────────────────────────────────────────── */
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .3rem .65rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: all .2s;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }

/* ── Flag icons ──────────────────────────────────────────── */
.fi {
  width: 1.2em;
  height: 0.9em;
  border-radius: 2px;
  vertical-align: middle;
}

/* ── Misc ────────────────────────────────────────────────── */
.flex  { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.ms-auto { margin-left: auto; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: .825rem; }
.mb-3  { margin-bottom: .75rem; }
.mb-4  { margin-bottom: 1rem; }
.mt-3  { margin-top: .75rem; }
.w-full { width: 100%; }
.color-swatch {
  width: 36px; height: 36px;
  border-radius: 6px;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .player-grid { grid-template-columns: 1fr; }
}
