/* ═══════════════════════════════════════════════
   IPTV Suite — Futuristic Design System 2026
   ═══════════════════════════════════════════════ */

:root {
  --bg:            #03030b;
  --bg2:           #07071a;
  --bg3:           #0b0b22;
  --surface:       rgba(255,255,255,0.03);
  --surface-hover: rgba(255,255,255,0.06);
  --border:        rgba(120,100,255,0.14);
  --border-bright: rgba(120,100,255,0.4);

  --purple:      #7c6bff;
  --purple-dim:  rgba(124,107,255,0.15);
  --purple-glow: rgba(124,107,255,0.3);
  --cyan:        #00e5ff;
  --cyan-dim:    rgba(0,229,255,0.12);
  --cyan-glow:   rgba(0,229,255,0.25);
  --pink:        #ff3385;
  --green:       #00e676;
  --orange:      #ff9100;

  --text:       #eeeeff;
  --text-muted: #7777aa;
  --text-faint: #333366;

  --nav-w:  220px;
  --radius: 14px;
  --radius-sm: 8px;

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ─── Scrollbars ──────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(124,107,255,0.35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ─── Animated background ─────────────────────── */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 60%, rgba(124,107,255,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 20%, rgba(0,229,255,0.05) 0%, transparent 70%),
    var(--bg);
  background-size: cover;
  pointer-events: none;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(124,107,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,107,255,0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: gridScroll 20s linear infinite;
  pointer-events: none;
}

@keyframes gridScroll {
  0%   { background-position: 0 0; }
  100% { background-position: 44px 44px; }
}

/* ─── App layout ──────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── Sidebar ─────────────────────────────────── */
.sidebar {
  width: var(--nav-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(7,7,26,0.85);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(24px);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--purple-glow);
}

.sidebar-logo .logo-text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--text), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  -webkit-text-fill-color: var(--text-muted);
}

nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 12px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-link svg { flex-shrink: 0; opacity: 0.7; transition: opacity var(--transition); }

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: var(--purple-dim);
  color: var(--purple);
  font-weight: 600;
}
.nav-link.active svg { opacity: 1; color: var(--purple); }

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: linear-gradient(180deg, var(--purple), var(--cyan));
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.version-badge {
  font-size: 0.7rem;
  color: var(--text-faint);
  text-align: center;
  letter-spacing: 0.06em;
}

/* ─── Main content ────────────────────────────── */
.main {
  margin-left: var(--nav-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(3,3,11,0.6);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title svg { color: var(--purple); }

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

.content { padding: 32px; flex: 1; }

/* ─── Cards / Glass panels ────────────────────── */
.card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
}

.card-glow {
  box-shadow: 0 0 0 1px var(--border), 0 8px 32px rgba(0,0,0,0.4);
  transition: box-shadow var(--transition);
}
.card-glow:hover {
  box-shadow: 0 0 0 1px var(--border-bright), 0 8px 40px rgba(0,0,0,0.5), 0 0 24px var(--purple-glow);
}

/* ─── Tabs ────────────────────────────────────── */
.tabs {
  display: flex;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 3px;
}

.tab-btn {
  flex: 1;
  padding: 9px 16px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}

.tab-btn:hover { background: var(--surface-hover); color: var(--text); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--purple), #5a4fcf);
  color: #fff;
  box-shadow: 0 0 14px var(--purple-glow);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Form elements ───────────────────────────── */
.form-group { margin-top: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }

label.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea {
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

input::placeholder { color: var(--text-faint); }

.hint { margin-top: 6px; font-size: 0.76rem; color: var(--text-muted); }

/* ─── Checkboxes ──────────────────────────────── */
.checkbox-group { margin-top: 20px; }
.checkbox-group > .field-label { margin-bottom: 10px; }

.checkbox-row { display: flex; gap: 10px; flex-wrap: wrap; }

.checkbox-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 16px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.checkbox-pill input[type="checkbox"] { accent-color: var(--purple); width: 14px; height: 14px; cursor: pointer; }
.checkbox-pill:has(input:checked) { border-color: var(--purple); color: var(--text); background: var(--purple-dim); }

/* ─── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), #5a4fcf);
  color: #fff;
  box-shadow: 0 4px 16px var(--purple-glow);
}
.btn-primary:hover { filter: brightness(1.15); box-shadow: 0 6px 24px var(--purple-glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); filter: brightness(0.95); }

.btn-cyan {
  background: linear-gradient(135deg, var(--cyan), #009eb8);
  color: #000;
  box-shadow: 0 4px 16px var(--cyan-glow);
}
.btn-cyan:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-bright); }

.btn-danger {
  background: rgba(255,51,133,0.15);
  border: 1px solid rgba(255,51,133,0.3);
  color: var(--pink);
}
.btn-danger:hover { background: rgba(255,51,133,0.25); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; filter: none !important; }
.btn-full { width: 100%; }

/* ─── Spinner ─────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
}
.spinner.visible { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Status messages ─────────────────────────── */
.status-msg {
  margin-top: 14px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  display: none;
  line-height: 1.4;
}
.status-msg.show { display: block; }
.status-msg.success { background: rgba(0,230,118,0.1); border: 1px solid rgba(0,230,118,0.25); color: var(--green); }
.status-msg.error   { background: rgba(255,51,133,0.1); border: 1px solid rgba(255,51,133,0.25); color: var(--pink); }
.status-msg.info    { background: rgba(0,229,255,0.08); border: 1px solid rgba(0,229,255,0.2); color: var(--cyan); }

/* ─── Badges ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-cyan   { background: var(--cyan-dim); color: var(--cyan); }
.badge-count  { background: rgba(255,255,255,0.07); color: var(--text-muted); }

/* ─── Channel card (manager / player list) ────── */
.channel-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  position: relative;
}

.channel-card:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.channel-card.active {
  background: var(--purple-dim);
  border-color: var(--border-bright);
}

.channel-logo {
  width: 36px; height: 36px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.channel-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.channel-info { flex: 1; min-width: 0; }
.channel-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-group {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Search input ────────────────────────────── */
.search-wrap {
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-wrap input { padding-left: 38px; }

/* ─── Loading overlay ─────────────────────────── */
.loading-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.loading-overlay.show { display: flex; }

.loading-ring {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Empty state ─────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state svg { opacity: 0.3; }
.empty-state p { font-size: 0.88rem; max-width: 280px; line-height: 1.5; }

/* ─── Utilities ───────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-sm { font-size: 0.82rem; }
.fw-700 { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Divider ─────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ─── Mobile sidebar toggle ───────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: flex; }
  .content { padding: 20px; }
  .topbar { padding: 0 16px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ─── Glow pulse animation ────────────────────── */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 12px var(--purple-glow); }
  50%       { box-shadow: 0 0 24px var(--purple-glow), 0 0 48px var(--purple-dim); }
}

/* ─── Fade in ─────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.35s ease forwards; }
