/**
 * Nightz Development dashboard - elevation + dark-cyber palette layer.
 * Loaded LAST so these tokens win over styles.css. Deep #0f1015 terminal base,
 * hairline white/5 borders, neon-green active indicators, electric-blue accents.
 */

/* ── Palette lock: dark cyber terminal ──────────────────────────── */
:root {
  --bg-primary: #0f1015;
  --bg: #0f1015;
  --bg-surface: #15161d;
  --success: #00ff00;
  --success-bg: rgba(0, 255, 0, 0.08);
  --border-color: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.1);
  /* Electric-blue interactive accent. */
  --nd-blue: #3b82f6;
  --nd-blue-bright: #60a5fa;
  --accent: #3b82f6;
  /* Amber config-alert accent. */
  --warning: #f59e0b;
  --warn: #f59e0b;
  /* Softer shadows (the old ones read too heavy on the flat terminal base). */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.34);
}

/* ── Sidebar + topbar: match the #0f1015 terminal base ──────────── */
.dashboard-sidebar {
  background: linear-gradient(180deg, rgba(18, 19, 26, 0.92) 0%, rgba(13, 14, 19, 0.96) 100%);
  border-right: 1px solid var(--border-color);
}
.dashboard-topbar {
  background: linear-gradient(180deg, rgba(18, 19, 26, 0.82), rgba(13, 14, 19, 0.6));
  border-bottom: 1px solid var(--border-color);
}
/* Active nav item: electric-blue wash + glowing left rail. */
.nav-link.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.14) 0%, transparent 100%);
  color: var(--nd-blue-bright);
}
.nav-link.active::before {
  background: var(--nd-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}
/* Section labels: slightly wider tracking for the cyber feel. */
.sidebar-section-label {
  letter-spacing: 0.14em;
}

/* ── The core component: the premium glass panel ────────────────── */
.glass-panel {
  background: linear-gradient(180deg, rgba(22, 24, 33, 0.55) 0%, rgba(15, 16, 21, 0.62) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
/* Hairline top sheen so panels read as lit glass, not flat boxes. */
.glass-panel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--nd-blue-bright), transparent);
  opacity: 0.35;
  pointer-events: none;
}
.glass-panel:hover {
  border-color: var(--border-strong);
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px var(--nd-blue-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Panel / section headings: tighten and give an accent tick. */
.glass-panel > h3,
.chart-container > h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-secondary);
}
.glass-panel > h3::before,
.chart-container > h3::before {
  content: "";
  width: 3px;
  height: 0.95em;
  border-radius: 2px;
  background: var(--nd-blue);
  box-shadow: 0 0 8px var(--nd-blue-glow);
  flex-shrink: 0;
}

/* ── Stat cards: make the numbers the hero ──────────────────────── */
.stat-card {
  background:
    radial-gradient(120% 140% at 100% 0%, var(--nd-blue-soft) 0%, transparent 45%),
    linear-gradient(180deg, rgba(22, 24, 33, 0.55) 0%, rgba(15, 16, 21, 0.6) 100%);
}
.stat-value {
  font-size: 2.25rem;
  line-height: 1.05;
  background: linear-gradient(180deg, #f8fafc 0%, var(--nd-blue-bright) 160%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-card:hover {
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px var(--nd-blue-soft),
    0 12px 32px rgba(59, 130, 246, 0.12);
}

/* ── Sidebar brand: glow the wordmark ──────────────────── */
.dashboard-logo strong {
  text-shadow: 0 0 18px var(--nd-blue-glow);
}
.dashboard-sidebar::before {
  opacity: 0.85;
}

/* Nav icons / links a touch crisper on hover. */
.nav-link:hover {
  transform: translateX(2px);
}

/* ── Topbar: version mark becomes a live status pill ────────────── */
.topbar-sentinel-mark {
  color: var(--nd-blue-bright);
  border-color: rgba(96, 165, 250, 0.3);
  background: var(--nd-blue-soft);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.12);
}

/* ── Charts: lift the containers to match panels ────────────────── */
.chart-container {
  background: linear-gradient(180deg, rgba(22, 24, 33, 0.5) 0%, rgba(15, 16, 21, 0.58) 100%);
  border-radius: var(--radius-lg);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.chart-container:hover {
  border-color: var(--border-strong);
}

/* ── Empty states: turn bare text into a designed state ─────────── */
.empty-state,
.empty-filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.empty-state::before,
.empty-filter::before {
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--nd-blue-soft);
  border: 1px solid rgba(96, 165, 250, 0.25);
  -webkit-mask: radial-gradient(circle at 50% 42%, #000 30%, transparent 31%) center/14px 14px
    no-repeat;
  opacity: 0.8;
  box-shadow: 0 0 18px var(--nd-blue-glow);
}

/* ── Motion: pages fade up on activation ────────────────────────── */
.page.active {
  animation: nd-page-in 0.32s ease both;
}
@keyframes nd-page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.stat-card,
.glass-panel,
.chart-container {
  animation: nd-rise 0.4s ease both;
}
@keyframes nd-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  .page.active,
  .stat-card,
  .glass-panel,
  .chart-container {
    animation: none;
  }
}

/* ── Command page: bento tile grid ──────────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.75rem;
  align-items: stretch;
}
.bento-grid .bento-stat {
  grid-column: span 3;
}
.bento-health {
  grid-column: span 5;
}
.bento-leaderboard {
  grid-column: span 4;
}
.bento-activity {
  grid-column: span 3;
}
.bento-announce {
  grid-column: span 12;
}
.bento-health,
.bento-leaderboard,
.bento-activity {
  min-height: 320px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
}
.bento-announce {
  padding: 1.1rem 1.25rem;
}

/* Compact metric tiles */
.bento-stat {
  padding: 0.85rem 1.05rem 0.9rem;
}
.bento-stat .stat-label {
  margin-bottom: 0.35rem;
}
.bento-stat .stat-value {
  font-size: 1.85rem;
}

/* Panel head (title + control) */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}
.panel-head > h3,
.bento-health > h3,
.bento-announce > h3 {
  margin: 0;
}
.bento-health > h3,
.bento-announce > h3 {
  margin-bottom: 0.9rem;
}

/* Key/value lists (health, leaderboard) */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.kv-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}
.kv-key {
  color: var(--text-secondary);
}
.kv-val {
  color: var(--text-primary);
  font-weight: 500;
}
.kv-online {
  color: var(--success);
  font-weight: 700;
  text-shadow: 0 0 8px var(--success);
}
.kv-mono {
  color: var(--nd-blue-bright);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.muted-center {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 1rem;
}
.panel-divider {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
.panel-sublabel {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.6rem;
}

/* Mini controls */
.mini-select {
  font-size: 0.68rem;
  padding: 3px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
}
.mini-btn {
  font-size: 0.62rem;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-tertiary);
  border-radius: 4px;
  cursor: pointer;
}
.mini-btn:hover {
  color: var(--text-primary);
  border-color: var(--nd-blue);
}

/* Real-time indicator */
.rt-indicator {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.rt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s ease-in-out infinite;
}
.rt-label {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
}
.activity-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Announcement row */
.announce-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.field {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.8rem;
}
.field:focus {
  outline: none;
  border-color: var(--nd-blue);
  box-shadow: 0 0 0 3px var(--nd-blue-soft);
}
.announce-channel {
  flex: 1;
  min-width: 200px;
}
.announce-text {
  flex: 3;
  min-width: 280px;
  resize: vertical;
}
.announce-send {
  white-space: nowrap;
}

/* Responsive bento */
@media (max-width: 1200px) {
  .bento-health {
    grid-column: span 7;
  }
  .bento-leaderboard {
    grid-column: span 5;
  }
  .bento-activity {
    grid-column: span 12;
    min-height: 240px;
  }
}
@media (max-width: 760px) {
  .bento-grid .bento-stat {
    grid-column: span 6;
  }
  .bento-health,
  .bento-leaderboard {
    grid-column: span 12;
  }
}

/* ── Merged-page tab bar ────────────────────────────────────────── */
.group-tabbar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.group-tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease;
}
.group-tab:hover {
  color: var(--text-primary);
}
.group-tab.active {
  color: var(--nd-blue-bright);
  border-bottom-color: var(--nd-blue);
  font-weight: 600;
}

/* ── Collapsible sidebar sections ───────────────────────────────── */
.sidebar-section-label[data-section] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sidebar-section-label[data-section]::after {
  content: "\25BE";
  font-size: 0.7em;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.sidebar-section-label[data-section].collapsed::after {
  transform: rotate(-90deg);
}
.sidebar-section-label[data-section]:hover {
  color: var(--text-secondary);
}
