/* ============================================================
 * JS Sniffer C2 v2.0 — Dark Admin Theme
 * ============================================================ */

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

:root {
  --bg-primary: #0b0b1a;
  --bg-card: #13132b;
  --bg-surface: #1a1a3a;
  --bg-hover: #22224a;
  --border: #2a2a5a;
  --text-primary: #d0d0e8;
  --text-secondary: #8080b0;
  --text-muted: #505080;
  --accent: #4a6cf7;
  --accent-glow: rgba(74,108,247,0.15);
  --green: #30c080;
  --red: #ff4060;
  --yellow: #f0b030;
  --radius: 8px;
  --radius-sm: 4px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- Login ---- */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg-primary);
}
.login-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 2.5rem; width: 360px; max-width: 90%;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.login-box h2 { font-size: 1.3rem; color: var(--text-primary); margin-bottom: 2px; }
.login-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.login-form input {
  width: 100%; padding: 0.7rem 1rem; margin-bottom: 0.8rem;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.9rem; outline: none; transition: border-color 0.2s;
}
.login-form input:focus { border-color: var(--accent); }
.login-error { color: var(--red); font-size: 0.8rem; margin-top: 0.5rem; min-height: 1.2rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.15); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(255,64,96,0.3); }
.btn-danger:hover { background: rgba(255,64,96,0.1); }

/* ---- Layout ---- */
.app-container { max-width: 1440px; margin: 0 auto; padding: 1.2rem; }

/* ---- Header ---- */
.header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.8rem 1.2rem; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 1.2rem;
}
.header-left { display: flex; align-items: center; gap: 0.6rem; }
.header-left h1 { font-size: 1.1rem; font-weight: 600; }
.header-badge {
  font-size: 0.65rem; background: var(--accent); color: #fff;
  padding: 2px 6px; border-radius: 3px; font-weight: 600;
}
.header-right { display: flex; align-items: center; gap: 0.6rem; }
.live-indicator { font-size: 0.75rem; padding: 3px 8px; border-radius: 3px; font-weight: 600; }
.live-on { background: rgba(48,192,128,0.15); color: var(--green); border: 1px solid rgba(48,192,128,0.3); }
.live-off { background: rgba(255,64,96,0.1); color: var(--red); border: 1px solid rgba(255,64,96,0.2); }
.conn-count { font-size: 0.75rem; color: var(--text-muted); }

/* ---- Stats ---- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem; margin-bottom: 1.2rem;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; text-align: center;
}
.stat-val { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); }
.stat-val.highlight { color: var(--yellow); }
.stat-lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.2rem; }

/* ---- Charts ---- */
.charts-row {
  display: grid; grid-template-columns: 1fr 2fr;
  gap: 0.8rem; margin-bottom: 1.2rem;
}
@media (max-width: 768px) { .charts-row { grid-template-columns: 1fr; } }
.chart-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.chart-box h4 { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.8rem; }
.chart-box canvas { max-height: 200px; }

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 0.25rem; margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 0.6rem 1.2rem; cursor: pointer; font-size: 0.85rem;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: all 0.2s; user-select: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; padding: 1rem 0; }
.tab-content.active { display: block; }

/* ---- Toolbar / Filters ---- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  margin-bottom: 0.8rem;
}
.toolbar input, .toolbar select {
  padding: 0.4rem 0.7rem; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.8rem; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); }
.toolbar input { min-width: 200px; }

/* ---- Table ---- */
.table-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th, td { padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg-surface); color: var(--text-secondary); font-weight: 500; cursor: pointer; user-select: none; }
th:hover { color: var(--accent); }
tr:hover { background: var(--bg-hover); }
tr.unread td { color: #fff; font-weight: 500; }
td .badge { font-size: 0.65rem; padding: 2px 6px; border-radius: 3px; }
td .badge-new { background: rgba(255,64,96,0.15); color: var(--red); }
td .badge-seen { background: rgba(128,128,176,0.1); color: var(--text-secondary); }
td .truncate { max-width: 150px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
td .cc-masked { font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; letter-spacing: 0.05em; }

/* ---- Pagination ---- */
.pagination {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem; color: var(--text-muted); font-size: 0.8rem;
}
.pagination button {
  padding: 0.35rem 0.7rem; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); cursor: pointer; font-size: 0.8rem;
}
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination button:hover:not(:disabled) { background: var(--bg-hover); }

/* ---- Live Feed ---- */
.feed-container {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.8rem;
  max-height: 400px; overflow-y: auto;
}
.feed-item {
  padding: 0.4rem 0.6rem; margin-bottom: 3px;
  background: var(--bg-surface); border-radius: var(--radius-sm);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.75rem; color: var(--green); word-break: break-all;
  animation: feedIn 0.3s ease;
}
.feed-empty { color: var(--text-muted); text-align: center; padding: 2rem; font-size: 0.85rem; }

@keyframes feedIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- Keylogs ---- */
.keylog-entry {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.7rem; margin-bottom: 0.5rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; font-size: 0.75rem;
}
.keylog-entry .meta { color: var(--text-muted); font-size: 0.65rem; margin-bottom: 0.3rem; }
.keylog-entry .keys { color: var(--text-primary); word-break: break-all; line-height: 1.6; }

/* ---- Screenshots ---- */
.screenshot-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.8rem; margin-bottom: 0.8rem;
}
.screenshot-item .meta { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.screenshot-item img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ---- Detail Modal ---- */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem;
  max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto;
}
.modal-box h3 { margin-bottom: 1rem; font-size: 1rem; }
.modal-box .field-row {
  display: flex; margin-bottom: 0.6rem; font-size: 0.85rem;
}
.modal-box .field-label {
  width: 110px; flex-shrink: 0; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase;
}
.modal-box .field-value { color: var(--text-primary); word-break: break-all; }
.modal-box .field-value.raw {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.7rem; background: var(--bg-surface); padding: 0.5rem;
  border-radius: var(--radius-sm); white-space: pre-wrap; max-height: 200px; overflow-y: auto;
}
.modal-actions { display: flex; gap: 0.5rem; margin-top: 1rem; justify-content: flex-end; }

/* Notes textarea */
#notes-textarea { font-family: inherit; }
#notes-textarea:focus { border-color: var(--accent); outline: none; }

/* ---- Export Panel ---- */
.export-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.export-panel h4 { font-size: 0.9rem; margin-bottom: 0.8rem; }
.export-section { margin-bottom: 1rem; }
.export-section label { font-size: 0.75rem; color: var(--text-muted); display: block; margin-bottom: 0.4rem; }
.export-date-row { display: flex; align-items: center; gap: 0.5rem; }
.export-date-row input[type="date"] {
  padding: 0.4rem 0.7rem; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.8rem; outline: none;
  color-scheme: dark;
}
.export-date-row span { color: var(--text-muted); font-size: 0.8rem; }
.export-buttons { display: flex; gap: 0.5rem; }

/* ---- Agents Table ---- */
#agents-container table { font-size: 0.8rem; }
#agents-container th, #agents-container td { padding: 0.4rem 0.6rem; }
#agents-container .truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }

/* ---- Settings ---- */
.settings-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.settings-panel h4 { font-size: 0.85rem; margin-bottom: 0.8rem; }
.settings-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.8rem;
}
.setting-item { display: flex; flex-direction: column; gap: 0.3rem; }
.setting-item label { font-size: 0.75rem; color: var(--text-muted); }
.setting-item input {
  padding: 0.4rem 0.7rem; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.8rem; outline: none;
}
.setting-item input:focus { border-color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .app-container { padding: 0.6rem; }
  .header { flex-direction: column; gap: 0.6rem; }
  .header-right { flex-wrap: wrap; justify-content: center; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .tabs { overflow-x: auto; }
}
