/* CST Admin Panel Styles */
:root {
  --bg: #0a0b0f;
  --bg2: #12141a;
  --bg3: #1a1d27;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --accent2: #8b5cf6;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 220px;
  --transition: 200ms cubic-bezier(.4, 0, .2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Glassmorphism */
.glass {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── LOGIN ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  border-radius: 20px;
  padding: 48px 40px;
  animation: fadeUp 0.4s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: pulse 2s ease-in-out infinite;
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── LAYOUT ── */
#app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.logo-icon-sm {
  font-size: 22px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent);
  color: white;
}

.nav-icon {
  font-size: 16px;
}

.live-badge {
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: auto;
  animation: pulse 1.5s ease-in-out infinite;
}

.sidebar-footer {
  padding: 16px 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px;
  min-height: 100vh;
  background: var(--bg);
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-header h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* ── CHANNELS GRID ── */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.channel-card {
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  transition: all var(--transition);
  cursor: default;
}

.channel-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.channel-card.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.channel-card.inactive {
  opacity: 0.6;
}

.channel-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.channel-select {
  position: absolute;
  top: 16px;
  left: 16px;
}

.channel-title {
  font-size: 16px;
  font-weight: 600;
  margin-left: 28px;
}

.channel-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  min-height: 18px;
}

.channel-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.slug-badge {
  font-family: monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
}

.status-badge.active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge.inactive {
  background: rgba(100, 116, 139, 0.2);
  color: var(--text-dim);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.live-count {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}

.live-count.zero {
  color: var(--text-dim);
}

.channel-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── LIVE MONITOR ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 20px 24px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.live-card {
  border-radius: var(--radius);
  padding: 20px;
}

.live-card-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.live-card-slug {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
  margin-bottom: 14px;
}

.live-listeners {
  font-size: 40px;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  margin-bottom: 4px;
}

.live-listeners.zero {
  color: var(--text-dim);
}

.live-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.2s ease-in-out infinite;
}

/* ── ANALYTICS ── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.chart-card {
  border-radius: var(--radius);
  padding: 24px;
}

.chart-card.chart-small {}

.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.rank-name {
  font-weight: 500;
}

.rank-value {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
}

/* ── ADMINS TABLE ── */
.admins-table-wrap {
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-hover);
}

tbody td {
  padding: 14px 16px;
  font-size: 14px;
}

.super-badge {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeUp 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Form elements in modal */
.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}

.modal-body input:focus,
.modal-body textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-body textarea {
  min-height: 80px;
  resize: vertical;
}

.token-display {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: monospace;
  font-size: 11px;
  word-break: break-all;
  color: var(--green);
  max-height: 150px;
  overflow-y: auto;
}

.token-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Tabs in Modal */
.tabs-small {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: var(--bg3);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 320px;
}

.toast.success {
  border-left: 3px solid var(--green);
}

.toast.error {
  border-left: 3px solid var(--red);
}

.toast.info {
  border-left: 3px solid var(--accent);
}

/* ── SELECT ── */
.select-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

/* ── UTILITY ── */
.hidden {
  display: none !important;
}

.loading-state {
  color: var(--text-muted);
  padding: 48px;
  text-align: center;
  font-size: 14px;
}

.error-msg {
  color: var(--red);
  font-size: 13px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.empty-state {
  color: var(--text-muted);
  padding: 60px;
  text-align: center;
  font-size: 14px;
  grid-column: 1/-1;
}

.empty-state .empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}

.toggle-checkbox {
  width: 36px;
  height: 20px;
  appearance: none;
  background: var(--surface-hover);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-checkbox:checked {
  background: var(--accent);
}

.toggle-checkbox::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle-checkbox:checked::after {
  transform: translateX(16px);
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }

  .sidebar .sidebar-logo span,
  .sidebar .nav-item span:last-child,
  .sidebar .sidebar-user,
  .sidebar .btn-ghost {
    display: none;
  }

  .nav-item {
    justify-content: center;
  }

  .main-content {
    margin-left: 60px;
    padding: 16px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}