@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg-deep: #0E0E12;
  --bg-card: #16161C;
  --bg-surface: #1E1E26;
  --bg-border: #2A2A36;
  --purple: #C940FF;
  --purple-dim: #8B1FBF;
  --purple-muted: #2A0F3D;
  --purple-glow: rgba(201, 64, 255, 0.15);
  --text-white: #F0F0F8;
  --text-muted: #8888AA;
  --text-dim: #555570;
  --amber: #FFB740;
  --amber-bg: #2A1F00;
  --teal: #40FFD0;
  --teal-bg: #002A22;
  --red: #FF4466;
  --red-bg: #2A000E;
  --green: #44FF88;
  --green-bg: #002A12;
  --orange: #FF8040;
  --orange-bg: #2A1500;
}

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

body {
  background: var(--bg-deep);
  color: var(--text-white);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  min-height: 100vh;
  border-top: 3px solid var(--purple);
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 3px;
  width: 220px;
  height: calc(100vh - 3px);
  background: var(--bg-card);
  border-right: 1px solid var(--bg-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--bg-border);
}

.sidebar-logo .logo-text {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--purple);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.sidebar-logo-img {
  display: block;
  width: 160px;
  height: auto;
  margin-bottom: 2px;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-item:hover, .nav-item.active {
  background: var(--purple-muted);
  color: var(--text-white);
  border-left-color: var(--purple);
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

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

.bot-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.status-dot.online { background: var(--green); }

/* Main layout */
.layout {
  margin-left: 220px;
  min-height: calc(100vh - 3px);
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--bg-border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Search bar */
.search-bar {
  flex: 1;
  max-width: 360px;
}

.search-bar input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  color: var(--text-white);
  padding: 7px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px var(--purple-glow);
}

/* Content */
.content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 6px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}

.stat-card.purple::before { background: var(--purple); }
.stat-card.amber::before { background: var(--amber); }
.stat-card.teal::before { background: var(--teal); }
.stat-card.red::before { background: var(--red); }
.stat-card.orange::before { background: var(--orange); }

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  height: 32px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  background: transparent;
  white-space: nowrap;
}

.btn-purple {
  border-color: var(--purple);
  color: var(--purple);
}
.btn-purple:hover {
  background: var(--purple-muted);
  box-shadow: 0 0 12px var(--purple-glow);
}

.btn-teal {
  border-color: var(--teal);
  color: var(--teal);
}
.btn-teal:hover {
  background: var(--teal-bg);
  box-shadow: 0 0 12px rgba(64, 255, 208, 0.2);
}

.btn-amber {
  border-color: var(--amber);
  color: var(--amber);
}
.btn-amber:hover {
  background: var(--amber-bg);
  box-shadow: 0 0 12px rgba(255, 183, 64, 0.2);
}

.btn-red {
  border-color: var(--red);
  color: var(--red);
}
.btn-red:hover {
  background: var(--red-bg);
  box-shadow: 0 0 12px rgba(255, 68, 102, 0.2);
}

.btn-gray {
  border-color: var(--bg-border);
  color: var(--text-muted);
}
.btn-gray:hover {
  background: var(--bg-surface);
  border-color: var(--text-muted);
}

/* Tier badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-tier1 { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(255,183,64,0.3); }
.badge-tier2 { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(255,128,64,0.3); }
.badge-tier3 { background: var(--red-bg); color: var(--red); border: 1px solid rgba(255,68,102,0.3); }
.badge-active { background: var(--teal-bg); color: var(--teal); border: 1px solid rgba(64,255,208,0.3); }
.badge-opted_out { background: var(--bg-surface); color: var(--text-dim); border: 1px solid var(--bg-border); }

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 6px;
  overflow: hidden;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--bg-border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 20px;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--bg-deep);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--bg-border);
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

thead th:hover { color: var(--text-white); }

tbody tr {
  border-bottom: 1px solid var(--bg-border);
  transition: background 0.1s;
}

tbody tr:nth-child(even) { background: var(--bg-card); }
tbody tr:nth-child(odd) { background: var(--bg-surface); }
tbody tr:hover { background: var(--purple-muted) !important; }

tbody td {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-white);
  vertical-align: middle;
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 5px 14px;
  height: 30px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--bg-border);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover, .filter-btn.active {
  border-color: var(--purple);
  color: var(--purple);
  background: var(--purple-muted);
}

.sort-select {
  padding: 5px 10px;
  height: 30px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  color: var(--text-white);
  border-radius: 4px;
  cursor: pointer;
  outline: none;
}

/* Avatar */
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
}

.avatar-placeholder {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--purple-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--purple);
  vertical-align: middle;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 16px 0;
}

.pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.pagination button.active, .pagination button:hover {
  border-color: var(--purple);
  color: var(--purple);
  background: var(--purple-muted);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  min-width: 260px;
  max-width: 400px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease;
  border: 1px solid;
}

.toast.success { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.toast.error { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.toast.info { background: var(--purple-muted); border-color: var(--purple); color: var(--purple); }
.toast.warning { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 8px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
}

.modal h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--text-white);
  margin-bottom: 12px;
}

.modal p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  color: var(--text-white);
  padding: 8px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  border-radius: 4px;
  outline: none;
  margin-bottom: 16px;
}

.modal input:focus {
  border-color: var(--purple);
}

/* Slide-over panel */
.slideover {
  position: fixed;
  right: 0; top: 3px;
  width: 420px;
  height: calc(100vh - 3px);
  background: var(--bg-card);
  border-left: 1px solid var(--bg-border);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slideover.open { transform: translateX(0); }

.slideover-header {
  padding: 20px;
  border-bottom: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slideover-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  color: var(--text-white);
}

.slideover-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.close-btn:hover { color: var(--text-white); }

/* Form elements */
input[type="text"], input[type="password"], input[type="number"], input[type="time"],
textarea, select {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  color: var(--text-white);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  border-radius: 4px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px var(--purple-glow);
}

textarea { resize: vertical; min-height: 100px; }

/* Toggle switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-border);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-white);
}

.toggle-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle input:checked + .toggle-track { background: var(--purple); }

.toggle-thumb {
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: left 0.2s;
  pointer-events: none;
}

.toggle input:checked ~ .toggle-thumb { left: 23px; }

/* Slider */
.slider-group {
  margin-bottom: 20px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.slider-name { font-size: 13px; color: var(--text-white); }
.slider-value { font-family: 'Orbitron', sans-serif; font-size: 13px; color: var(--purple); }

input[type="range"] {
  width: 100%;
  height: 4px;
  background: var(--bg-border);
  border: none;
  border-radius: 2px;
  outline: none;
  padding: 0;
  cursor: pointer;
  accent-color: var(--purple);
}

/* Section */
.section {
  margin-bottom: 32px;
}

.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg-border);
}

/* Grid */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Bulk toolbar */
.bulk-toolbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--purple-muted);
  border: 1px solid var(--purple);
  border-radius: 6px;
  margin-bottom: 12px;
}

.bulk-toolbar.visible { display: flex; }
.bulk-count { color: var(--purple); font-size: 13px; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Audit log row colors */
tr.log-nudge { background: rgba(201,64,255,0.05) !important; }
tr.log-kick { background: rgba(255,68,102,0.06) !important; }
tr.log-active { background: rgba(64,255,208,0.05) !important; }
tr.log-config { background: rgba(255,183,64,0.05) !important; }

/* Countdown */
.countdown {
  font-size: 12px;
  color: var(--text-dim);
}

/* Profile section in slideover */
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--purple);
  margin-bottom: 12px;
}

.profile-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--text-white);
  margin-bottom: 4px;
}

.profile-username {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.timeline-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-border);
  font-size: 12px;
}

.timeline-time { color: var(--text-dim); min-width: 80px; }
.timeline-text { color: var(--text-muted); }

/* Chart container */
.chart-container {
  position: relative;
  height: 260px;
  padding: 4px;
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 8px;
  padding: 40px;
  width: 380px;
}

.login-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--purple);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: 3px;
}

.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 32px;
  letter-spacing: 1px;
}

.login-box label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.login-box input {
  width: 100%;
  margin-bottom: 20px;
  padding: 10px 14px;
  font-size: 14px;
}

.login-box .btn {
  width: 100%;
  height: 40px;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 1px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Checkbox */
input[type="checkbox"] {
  accent-color: var(--purple);
  width: 15px;
  height: 15px;
  cursor: pointer;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .layout { margin-left: 0; }
  .two-col { grid-template-columns: 1fr; }
  .slideover { width: 100%; }
}

/* Utility */
.text-purple { color: var(--purple); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-amber { color: var(--amber); }
.text-teal { color: var(--teal); }
.text-red { color: var(--red); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.font-orbitron { font-family: 'Orbitron', sans-serif; }
