/* =========================================================
   NOAURA RADIO PANEL — Design System v2.0
   Premium Dark · SaaS Grade · Production Ready
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* =========================================================
   01. DESIGN TOKENS
   ========================================================= */
:root {

  /* ── Color Primitives ── */
  --violet-50:  #f0efff;
  --violet-100: #e4e2ff;
  --violet-200: #ccc8ff;
  --violet-300: #a89fff;
  --violet-400: #8b7eff;
  --violet-500: #6c63ff;
  --violet-600: #5a50f0;
  --violet-700: #4840d4;
  --violet-800: #3a33a8;
  --violet-900: #2d2880;

  --pink-400: #ff7ab8;
  --pink-500: #ff5fa0;
  --pink-600: #f04080;

  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;

  --red-400:   #f87171;
  --red-500:   #ef4444;
  --red-600:   #dc2626;

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  /* ── Semantic Colors ── */
  --color-bg:         #07090f;
  --color-bg-subtle:  #0b0e18;
  --color-surface:    #0f1420;
  --color-surface-2:  #141929;
  --color-surface-3:  #1a2035;

  --color-border:         rgba(255, 255, 255, 0.07);
  --color-border-subtle:  rgba(255, 255, 255, 0.04);
  --color-border-strong:  rgba(255, 255, 255, 0.12);
  --color-border-accent:  rgba(108, 99, 255, 0.35);

  --color-accent:       var(--violet-500);
  --color-accent-hover: var(--violet-400);
  --color-accent-soft:  rgba(108, 99, 255, 0.12);
  --color-accent-glow:  rgba(108, 99, 255, 0.25);

  --color-pink:         var(--pink-500);
  --color-pink-soft:    rgba(255, 95, 160, 0.12);

  --color-success:      var(--green-500);
  --color-success-soft: rgba(34, 197, 94, 0.12);
  --color-danger:       var(--red-500);
  --color-danger-soft:  rgba(239, 68, 68, 0.12);
  --color-warning:      var(--amber-500);
  --color-warning-soft: rgba(245, 158, 11, 0.12);

  --color-text-primary:   rgba(240, 242, 255, 0.95);
  --color-text-secondary: rgba(160, 168, 196, 0.9);
  --color-text-tertiary:  rgba(100, 110, 140, 0.8);
  --color-text-disabled:  rgba(70, 80, 110, 0.6);

  /* ── Typography ── */
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  --text-xs:   0.69rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9rem;
  --text-md:   1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.3rem;
  --text-2xl:  1.6rem;
  --text-3xl:  2rem;

  /* ── Spacing Scale ── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ── Border Radius ── */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.45), 0 4px 8px rgba(0, 0, 0, 0.3);
  --shadow-xl:  0 16px 48px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.35);
  --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.55), 0 12px 24px rgba(0, 0, 0, 0.4);

  --shadow-accent: 0 4px 24px rgba(108, 99, 255, 0.3), 0 2px 8px rgba(108, 99, 255, 0.15);
  --shadow-success: 0 4px 16px rgba(34, 197, 94, 0.25);
  --shadow-danger:  0 4px 16px rgba(239, 68, 68, 0.25);

  /* ── Motion ── */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --duration-fast:   120ms;
  --duration-normal: 200ms;
  --duration-slow:   300ms;
  --duration-slower: 500ms;

  --transition-fast:   var(--duration-fast)   var(--ease-out);
  --transition-normal: var(--duration-normal) var(--ease-out);
  --transition-slow:   var(--duration-slow)   var(--ease-out);

  /* Legacy compat */
  --bg-base:     var(--color-bg);
  --bg-surface:  var(--color-surface);
  --bg-card:     rgba(255, 255, 255, 0.035);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border:      var(--color-border);
  --accent:      var(--color-accent);
  --accent-2:    var(--color-pink);
  --accent-soft: var(--color-accent-soft);
  --success:     var(--color-success);
  --danger:      var(--color-danger);
  --warning:     var(--color-warning);
  --text-primary:   var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted:     var(--color-text-tertiary);
  --shadow-card:    var(--shadow-lg);
  --transition:     all var(--duration-normal) var(--ease-out);
}

/* =========================================================
   02. BASE / RESET
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  font-size: var(--text-base);
}

/* Ambient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 8%,  rgba(108, 99, 255, 0.09) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 85% 85%, rgba(255, 95, 160, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse 60% 60% at 50% 50%, rgba(7, 9, 20, 0.4) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
}

a { color: inherit; text-decoration: none; }

input, select, textarea, button {
  font-family: var(--font-body);
  font-size: inherit;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(108, 99, 255, 0.4); }

/* Selection */
::selection {
  background: rgba(108, 99, 255, 0.25);
  color: var(--color-text-primary);
}

/* =========================================================
   03. LAYOUT
   ========================================================= */
.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
  width: 256px;
  min-height: 100vh;
  background: rgba(11, 14, 24, 0.97);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: var(--space-6) 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  transition: transform var(--duration-slow) var(--ease-out);
}

.sidebar-logo {
  padding: 0 var(--space-6) var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--space-3);
}

.sidebar-logo .logo-mark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--violet-400) 0%, var(--pink-500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .logo-sub {
  font-size: var(--text-xs);
  color: var(--color-text-disabled);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 500;
}

.sidebar-section-label {
  padding: var(--space-4) var(--space-6) var(--space-2);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-disabled);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-6);
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    background var(--transition-fast);
  border-left: 2px solid transparent;
  text-decoration: none;
  position: relative;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background var(--transition-fast);
}

.nav-item:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.active {
  color: var(--color-accent);
  background: linear-gradient(90deg, rgba(108, 99, 255, 0.1) 0%, transparent 100%);
  border-left-color: var(--color-accent);
}

.nav-item i {
  width: 16px;
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.85;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-5) var(--space-6) 0;
  border-top: 1px solid var(--color-border-subtle);
}

/* ── Main Content ── */
.main-content {
  margin-left: 256px;
  flex: 1;
  padding: var(--space-8);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-top: 3px;
  font-weight: 400;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ── User ── */
.user-mini {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--violet-500), var(--pink-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
}

.user-role {
  font-size: var(--text-xs);
  color: var(--color-text-disabled);
  font-weight: 500;
}

/* ── Content Grids ── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.content-grid.three         { grid-template-columns: repeat(3, 1fr); }
.content-grid.full          { grid-template-columns: 1fr; }
.content-grid.sidebar-layout { grid-template-columns: 1fr 320px; }

/* =========================================================
   04. COMPONENTS
   ========================================================= */

/* ── Card ── */
.card {
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  padding: var(--space-6);
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    transform var(--transition-normal);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.02) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.glass {
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glass-hover {
  transition:
    background var(--transition-normal),
    border-color var(--transition-normal),
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.glass-hover:hover {
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── Stats Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.stat-card {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid var(--color-border);
  transition:
    border-color var(--transition-normal),
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--color-accent-soft);
  opacity: 0.6;
  pointer-events: none;
}

.stat-card:hover {
  border-color: rgba(108, 99, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
}

.stat-icon.success { background: var(--color-success-soft); color: var(--color-success); }
.stat-icon.danger  { background: var(--color-danger-soft);  color: var(--color-danger);  }
.stat-icon.warning { background: var(--color-warning-soft); color: var(--color-warning); }

.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  border: none;
  transition:
    background var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    opacity var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(108, 99, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.45);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-danger:hover {
  background: var(--red-400);
  box-shadow: var(--shadow-danger);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--color-success);
  color: #fff;
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-success:hover {
  background: var(--green-400);
  box-shadow: var(--shadow-success);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-secondary);
}
.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-tertiary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--color-border);
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary);
}

.btn-gradient {
  background: linear-gradient(135deg, var(--violet-500), var(--pink-500));
  color: #fff;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.35);
}
.btn-gradient:hover {
  box-shadow: 0 6px 28px rgba(108, 99, 255, 0.5);
  transform: translateY(-1px);
  opacity: 0.92;
}

.btn-icon { padding: 9px; border-radius: var(--radius-sm); }
.btn-lg   { padding: 12px 24px; font-size: var(--text-base); border-radius: var(--radius-md); }
.btn-sm   { padding: 6px 13px;  font-size: var(--text-xs);  border-radius: var(--radius-sm); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-success { background: var(--color-success-soft); color: var(--green-400);  border: 1px solid rgba(34,197,94,0.2); }
.badge-danger  { background: var(--color-danger-soft);  color: var(--red-400);    border: 1px solid rgba(239,68,68,0.2);  }
.badge-warning { background: var(--color-warning-soft); color: var(--amber-400);  border: 1px solid rgba(245,158,11,0.2); }
.badge-accent  { background: var(--color-accent-soft);  color: var(--violet-400); border: 1px solid rgba(108,99,255,0.2); }

/* ── Status Dots ── */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.online {
  background: var(--color-success);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
  animation: pulse-dot 2.5s ease-in-out infinite;
}
.status-dot.offline { background: var(--color-text-disabled); }
.status-dot.warning { background: var(--color-warning); }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2); }
  50%       { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1), 0 0 8px rgba(34, 197, 94, 0.3); }
}

/* ── Form Elements ── */
.form-group   { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.form-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  padding: 10px 14px;
  font-size: var(--text-sm);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
  width: 100%;
  outline: none;
}

.form-input:hover {
  border-color: var(--color-border-strong);
  background: rgba(255, 255, 255, 0.055);
}

.form-input:focus {
  border-color: var(--color-accent);
  background: rgba(108, 99, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12), 0 1px 4px rgba(0,0,0,0.2);
}

.form-input::placeholder { color: var(--color-text-disabled); }

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23646e8c' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

select.form-input option {
  background: var(--color-surface-2);
  color: var(--color-text-primary);
}

.form-input-icon { position: relative; }
.form-input-icon .form-input { padding-left: 38px; }
.form-input-icon .input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-disabled);
  font-size: 0.82rem;
  pointer-events: none;
}

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-disabled);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
  transition: background var(--transition-fast);
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: none; }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 3px;
  width: fit-content;
}

.tab {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-tertiary);
  border: none;
  background: none;
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
  white-space: nowrap;
}

.tab.active {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.35);
  font-weight: 600;
}

.tab:not(.active):hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* ── Tags ── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text-tertiary);
  letter-spacing: 0.02em;
}

/* ── Alerts ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.alert-info    { background: rgba(108,99,255,0.08);  border: 1px solid rgba(108,99,255,0.18);  color: var(--violet-300); }
.alert-success { background: rgba(34,197,94,0.08);   border: 1px solid rgba(34,197,94,0.18);   color: var(--green-400);  }
.alert-danger  { background: rgba(239,68,68,0.08);   border: 1px solid rgba(239,68,68,0.18);   color: var(--red-400);    }

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  gap: var(--space-4);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

/* ── Now Playing Card ── */
.now-playing-card {
  background: linear-gradient(
    135deg,
    rgba(108, 99, 255, 0.12) 0%,
    rgba(255, 95, 160, 0.07) 100%
  );
  border: 1px solid rgba(108, 99, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.now-playing-card::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(108,99,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.now-playing-inner { position: relative; z-index: 1; }

.track-artwork {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(108,99,255,0.3), rgba(255,95,160,0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--color-accent);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.track-artwork img { width: 100%; height: 100%; object-fit: cover; }
.track-info { flex: 1; min-width: 0; }

.track-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.track-artist {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-top: 3px;
}

/* ── Progress Bar ── */
.progress-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-4);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--violet-500), var(--pink-500));
  border-radius: var(--radius-full);
  transition: width 1s linear;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,0.6);
}

/* ── Player Controls ── */
.player-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
  font-size: 0.8rem;
}

.ctrl-btn-main {
  width: 44px;
  height: 44px;
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.4);
  font-size: 0.95rem;
}

.ctrl-btn-main:hover {
  background: var(--color-accent-hover);
  transform: scale(1.06);
  box-shadow: 0 6px 24px rgba(108, 99, 255, 0.5);
}

.ctrl-btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-tertiary);
  border: 1px solid var(--color-border);
}

.ctrl-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--color-text-primary);
  transform: scale(1.04);
}

/* ── Volume Slider ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  cursor: pointer;
  flex: 1;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(108, 99, 255, 0.5);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
}

/* ── Waveform ── */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 28px;
}

.wave-bar {
  width: 2.5px;
  background: linear-gradient(to top, var(--violet-500), var(--pink-500));
  border-radius: var(--radius-full);
  opacity: 0.6;
  animation: wave var(--dur, 0.8s) var(--ease-in-out) infinite alternate;
  animation-delay: var(--delay, 0s);
}

@keyframes wave {
  from { transform: scaleY(0.25); }
  to   { transform: scaleY(1); }
}

/* ── Upload Zone ── */
.upload-zone {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--transition-normal),
    background var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 60% at 50% 50%, var(--color-accent-soft), transparent);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--color-accent);
}

.upload-zone:hover::before,
.upload-zone.dragover::before { opacity: 1; }

.upload-icon {
  font-size: 2.2rem;
  color: var(--color-text-disabled);
  margin-bottom: var(--space-3);
  transition: color var(--transition-normal), transform var(--transition-normal);
  position: relative;
}

.upload-zone:hover .upload-icon {
  color: var(--color-accent);
  transform: translateY(-2px);
}

.upload-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  margin-bottom: var(--space-2);
  position: relative;
}

.upload-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  position: relative;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: rgba(15, 20, 32, 0.95);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 380px;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.04);
  animation: toast-in var(--duration-slow) var(--ease-spring) forwards;
  pointer-events: all;
  font-size: var(--text-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error   { border-left: 3px solid var(--color-danger);  }
.toast.info    { border-left: 3px solid var(--color-accent);  }
.toast.warning { border-left: 3px solid var(--color-warning); }

@keyframes toast-in {
  from { transform: translateX(calc(100% + 24px)); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(110%); opacity: 0; }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 14, 0.75);
  backdrop-filter: blur(8px) saturate(150%);
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-normal) var(--ease-out),
    visibility var(--duration-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: rgba(13, 18, 32, 0.98);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  padding: var(--space-8);
  transform: scale(0.96) translateY(16px);
  transition:
    transform var(--duration-slow) var(--ease-spring),
    opacity var(--duration-slow) var(--ease-out);
  box-shadow: var(--shadow-2xl), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(24px);
  opacity: 0;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 0.9rem;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border-subtle);
}

/* ── Playlist Items ── */
.playlist-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-subtle);
  transition:
    background var(--transition-fast),
    padding var(--transition-fast);
  border-radius: var(--radius-sm);
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.025);
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  margin: 0 calc(-1 * var(--space-3));
}

.playlist-item:last-child { border-bottom: none; }

.track-num {
  width: 22px;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-disabled);
  font-variant-numeric: tabular-nums;
}

.track-thumb {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-size: 0.82rem;
  flex-shrink: 0;
  border: 1px solid rgba(108,99,255,0.15);
}

.track-meta { flex: 1; min-width: 0; }
.track-name {
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
}
.track-dur {
  font-size: var(--text-xs);
  color: var(--color-text-disabled);
  margin-top: 1px;
}

/* ── Schedule ── */
.schedule-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.schedule-time {
  width: 88px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.schedule-playlist { flex: 1; font-size: var(--text-sm); }
.schedule-actions  { display: flex; gap: var(--space-2); }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: var(--space-6);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(11, 14, 24, 0.92);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-2xl), 0 0 0 1px rgba(255,255,255,0.03);
}

.login-logo { text-align: center; margin-bottom: var(--space-10); }

.login-logo-mark {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--violet-400) 0%, var(--pink-500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}

.login-logo-sub {
  font-size: var(--text-xs);
  color: var(--color-text-disabled);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 4px;
  display: block;
  font-weight: 500;
}

.login-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-8);
  line-height: 1.5;
}

.login-form { display: flex; flex-direction: column; gap: var(--space-5); }

.login-switch {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.login-switch a {
  color: var(--color-accent);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.login-switch a:hover { color: var(--color-accent-hover); }

/* ── Chart ── */
.chart-container {
  width: 100%;
  height: 180px;
  position: relative;
}

#listenerChart {
  width: 100% !important;
  height: 180px !important;
  border-radius: var(--radius-sm);
}

/* =========================================================
   05. UTILITIES
   ========================================================= */
.divider {
  height: 1px;
  background: var(--color-border-subtle);
  margin: var(--space-5) 0;
}

/* Flex */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: var(--space-1); }
.gap-8  { gap: var(--space-2); }
.gap-12 { gap: var(--space-3); }
.gap-16 { gap: var(--space-4); }

/* Spacing */
.mb-4  { margin-bottom: var(--space-1); }
.mb-8  { margin-bottom: var(--space-2); }
.mb-16 { margin-bottom: var(--space-4); }
.mb-24 { margin-bottom: var(--space-6); }
.mt-auto { margin-top: auto; }

/* Text */
.text-accent   { color: var(--color-accent); }
.text-success  { color: var(--color-success); }
.text-danger   { color: var(--color-danger); }
.text-muted    { color: var(--color-text-tertiary); }
.text-sm       { font-size: var(--text-sm); }
.fw-700        { font-weight: 700; }

/* Layout */
.w-full          { width: 100%; }
.hidden          { display: none !important; }
.pointer         { cursor: pointer; }
.relative        { position: relative; }
.overflow-hidden { overflow: hidden; }
.rounded-full    { border-radius: var(--radius-full); }

/* =========================================================
   06. ANIMATIONS
   ========================================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.fade-in   { animation: fadeIn 0.35s var(--ease-out) forwards; opacity: 0; }
.fade-in-1 { animation-delay: 0.05s; }
.fade-in-2 { animation-delay: 0.1s;  }
.fade-in-3 { animation-delay: 0.15s; }
.fade-in-4 { animation-delay: 0.2s;  }
.fade-in-5 { animation-delay: 0.25s; }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* =========================================================
   07. RESPONSIVE
   ========================================================= */
@media (max-width: 1200px) {
  .content-grid.sidebar-layout { grid-template-columns: 1fr; }
  .content-grid.three { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-2xl);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-5);
  }

  .content-grid { grid-template-columns: 1fr; }
  .stats-grid   { grid-template-columns: 1fr 1fr; }

  .page-title { font-size: var(--text-xl); }
  .topbar { flex-wrap: wrap; gap: var(--space-3); }
}

@media (max-width: 600px) {
  .main-content { padding: var(--space-4); }
  .login-card   { padding: var(--space-8) var(--space-6); }
  .stats-grid   { grid-template-columns: 1fr; }
  .card         { padding: var(--space-5); }
  .modal        { padding: var(--space-6); }

  .tabs {
    flex-wrap: wrap;
    width: 100%;
  }

  .tab { flex: 1; text-align: center; }

  .topbar-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 400px) {
  .toast { min-width: calc(100vw - 48px); }
  .toast-container { left: var(--space-6); right: var(--space-6); }
}