/* AXLDRONE Dashboard — Design System */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a1f35;
  --bg-card-hover: #222845;
  --bg-sidebar: #0d1117;
  --bg-input: #1e2538;
  --border: #2a3050;
  --border-hover: #3d4670;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-hover: #818cf8;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --gradient-primary: linear-gradient(135deg, #6366f1, #06b6d4);
  --gradient-green: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-amber: linear-gradient(135deg, #f59e0b, #ef4444);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(99,102,241,0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: rgba(99,102,241,0.1); border-radius: var(--radius-sm); }
.logo-title { font-size: 16px; font-weight: 800; letter-spacing: 1.5px; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: block; }
.logo-subtitle { font-size: 9px; font-weight: 500; letter-spacing: 3px; color: var(--text-muted); display: block; }

.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--radius-sm); color: var(--text-secondary);
  text-decoration: none; font-size: 14px; font-weight: 500;
  transition: all 0.2s ease; position: relative;
}
.nav-item:hover { background: rgba(99,102,241,0.08); color: var(--text-primary); }
.nav-item.active { background: rgba(99,102,241,0.12); color: var(--accent-primary); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: var(--accent-primary); border-radius: 0 2px 2px 0; }

.nav-badge {
  margin-left: auto; background: var(--bg-card); padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.alert-badge { background: rgba(239,68,68,0.15); color: var(--accent-red); }

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

.connection-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.offline { background: var(--accent-red); }

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

.top-bar {
  height: var(--topbar-height); padding: 0 24px; display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
}
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }

.menu-toggle { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; }

.page-title { font-size: 20px; font-weight: 700; }

.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px;
}
.search-box input { background: none; border: none; color: var(--text-primary); font-size: 13px; width: 200px; outline: none; font-family: var(--font-sans); }
.search-box input::placeholder { color: var(--text-muted); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.live-indicator {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2);
  border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--accent-green);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

/* ─── Pages ─── */
.page { display: none; padding: 24px; flex: 1; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Stats Grid ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 20px; display: flex; align-items: center; gap: 16px;
  transition: all 0.3s ease; cursor: default;
}
.stat-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-glow); transform: translateY(-2px); }

.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.online { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.stat-icon.total { background: rgba(99,102,241,0.12); color: var(--accent-primary); }
.stat-icon.events { background: rgba(6,182,212,0.12); color: var(--accent-cyan); }
.stat-icon.screenshots { background: rgba(168,85,247,0.12); color: var(--accent-purple); }

.stat-value { font-size: 28px; font-weight: 800; display: block; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ─── Section Headers ─── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { font-size: 16px; font-weight: 700; }
.section-badge { font-size: 12px; color: var(--text-muted); background: var(--bg-input); padding: 4px 12px; border-radius: 12px; }

/* ─── Clients Grid ─── */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 32px; }

.client-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 20px; transition: all 0.3s ease; cursor: pointer;
}
.client-card:hover { border-color: var(--accent-primary); box-shadow: var(--shadow-glow); transform: translateY(-2px); }

.client-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.client-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.client-os { font-size: 11px; color: var(--text-muted); background: var(--bg-input); padding: 2px 8px; border-radius: 4px; font-weight: 500; }

.client-status { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.client-status.online { color: var(--accent-green); }
.client-status.offline { color: var(--accent-red); }
.client-status.idle { color: var(--accent-amber); }
.client-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.client-status.online .dot { box-shadow: 0 0 6px currentColor; }

.client-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.client-meta-item { font-size: 12px; }
.client-meta-label { color: var(--text-muted); display: block; margin-bottom: 2px; }
.client-meta-value { color: var(--text-primary); font-weight: 500; font-family: var(--font-mono); font-size: 11px; }

.client-bars { display: flex; gap: 12px; margin-top: 12px; }
.bar-container { flex: 1; }
.bar-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.bar-track { height: 4px; background: var(--bg-input); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.bar-fill.cpu { background: var(--gradient-primary); }
.bar-fill.mem { background: var(--gradient-green); }

/* ─── Activity Feed ─── */
.activity-feed { max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }

.feed-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  animation: slideIn 0.3s ease; font-size: 13px;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

.feed-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.feed-icon.window { background: rgba(99,102,241,0.12); }
.feed-icon.clipboard { background: rgba(245,158,11,0.12); }
.feed-icon.usb { background: rgba(239,68,68,0.12); }
.feed-icon.idle { background: rgba(16,185,129,0.12); }
.feed-icon.screenshot { background: rgba(168,85,247,0.12); }

.feed-content { flex: 1; min-width: 0; }
.feed-agent { font-size: 11px; color: var(--accent-cyan); font-weight: 600; }
.feed-text { color: var(--text-secondary); line-height: 1.4; word-break: break-word; }
.feed-text strong { color: var(--text-primary); font-weight: 600; }
.feed-time { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }

/* ─── Data Table ─── */
.clients-table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: var(--bg-card-hover); }
.data-table .status-cell { display: flex; align-items: center; gap: 6px; }

/* ─── Timeline & Controls ─── */
.timeline-controls { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

.select-input {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); padding: 10px 14px; font-size: 13px; font-family: var(--font-sans);
  cursor: pointer; outline: none; min-width: 160px;
}
.select-input:focus { border-color: var(--accent-primary); }

.btn-primary {
  background: var(--gradient-primary); border: none; border-radius: var(--radius-sm);
  color: white; padding: 10px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-sans); transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ghost { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); padding: 6px 14px; font-size: 12px; cursor: pointer; font-family: var(--font-sans); }
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text-primary); }

.timeline-container { display: flex; flex-direction: column; gap: 8px; }

.timeline-event {
  display: flex; gap: 16px; padding: 12px 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  align-items: flex-start;
}
.timeline-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); min-width: 80px; padding-top: 2px; }
.timeline-type { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.timeline-type.active_window { background: rgba(99,102,241,0.12); color: var(--accent-primary); }
.timeline-type.clipboard { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.timeline-type.usb_event { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.timeline-type.idle_state { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.timeline-detail { flex: 1; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.timeline-detail strong { color: var(--text-primary); }

/* ─── Screenshots Gallery ─── */
.screenshots-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.screenshot-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; cursor: pointer; transition: all 0.3s;
}
.screenshot-card:hover { border-color: var(--accent-primary); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.screenshot-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.screenshot-card .screenshot-info { padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; }
.screenshot-card .screenshot-time { font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); }
.screenshot-card .screenshot-size { font-size: 11px; color: var(--text-muted); }

/* ─── Alerts ─── */
.alerts-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-red);
}
.alert-item.warning { border-left-color: var(--accent-amber); }
.alert-item.info { border-left-color: var(--accent-cyan); }

/* ─── Downloads Page ─── */
.downloads-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; margin-top: 16px; }
.download-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 24px; display: flex; flex-direction: column; gap: 16px;
}
.download-card-header { display: flex; align-items: center; gap: 16px; }
.download-icon { font-size: 32px; width: 56px; height: 56px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: rgba(99,102,241,0.1); }
.download-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.download-meta { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.download-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }
.btn-download { display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; padding: 12px 20px; font-size: 13px; font-weight: 700; border-radius: var(--radius-sm); }
.cmd-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-size: 12px; }
.cmd-title { font-size: 11px; color: var(--text-muted); display: block; font-weight: 600; margin-bottom: 6px; }
.cmd-box code { font-family: var(--font-mono); color: var(--accent-cyan); word-break: break-all; }

/* ─── Modal ─── */
.modal { display: none; position: fixed; inset: 0; z-index: 200; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); }
.modal-content { position: relative; max-width: 90vw; max-height: 90vh; z-index: 1; }
.modal-content img { max-width: 100%; max-height: 85vh; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.modal-close { position: absolute; top: -12px; right: -12px; width: 32px; height: 32px; border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2; }
.modal-info { text-align: center; padding: 12px; color: var(--text-muted); font-size: 12px; }

/* ─── Empty State ─── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state p { font-size: 15px; margin: 12px 0 4px; color: var(--text-secondary); }
.empty-state span { font-size: 12px; }
.empty-state.small { padding: 24px; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .search-box input { width: 120px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .clients-grid { grid-template-columns: 1fr; }
}
