@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&display=swap');

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

:root {
  --bg:       #05070d;
  --bg2:      #080c14;
  --bg3:      #0a0f1a;
  --panel:    #0d1220;
  --border:   #0f2040;
  --border2:  #1a3a6a;
  --blue:     #0a7eff;
  --blue2:    #4da6ff;
  --cyan:     #00d4ff;
  --text:     #c0d8f0;
  --text2:    #6a90b8;
  --text3:    #3a5a7a;
  --green:    #00ff88;
  --red:      #ff2244;
  --yellow:   #ffcc00;
  --online:   #00ff88;
  --offline:  #2a4060;
  --banned:   #ff2244;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-logo { display: flex; align-items: center; gap: 12px; }
.topbar-logo img { height: 36px; }
.topbar-title { font-size: 18px; font-weight: 700; letter-spacing: 4px; color: #e0f0ff; }
.topbar-sub { font-size: 10px; color: var(--text3); letter-spacing: 3px; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.topbar-stat { text-align: center; }
.topbar-stat .val { font-size: 20px; font-weight: 700; color: var(--cyan); font-family: 'Share Tech Mono', monospace; }
.topbar-stat .lbl { font-size: 9px; color: var(--text3); letter-spacing: 2px; }
.topbar-time { font-family: 'Share Tech Mono', monospace; font-size: 13px; color: var(--text2); }
.btn-logout { background: none; border: 1px solid var(--border2); color: var(--text2); padding: 6px 14px; border-radius: 4px; cursor: pointer; font-family: inherit; font-size: 12px; letter-spacing: 2px; transition: all .2s; }
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── Main split ───────────────────────────────────────────────────────────── */
.main { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar (chat) ───────────────────────────────────────────────────────── */
.sidebar {
  width: 300px; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-size: 10px; letter-spacing: 3px; color: var(--text3); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-header .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: pulse 2s infinite; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { padding: 8px 12px; border-radius: 6px; max-width: 85%; font-size: 13px; line-height: 1.4; }
.chat-msg.in { background: var(--panel); border: 1px solid var(--border); align-self: flex-start; }
.chat-msg.out { background: rgba(10,126,255,0.15); border: 1px solid rgba(10,126,255,0.3); align-self: flex-end; }
.chat-msg .sender { font-size: 10px; color: var(--blue2); letter-spacing: 1px; margin-bottom: 3px; }
.chat-msg .time { font-size: 10px; color: var(--text3); margin-top: 3px; }
.chat-input-wrap {
  padding: 12px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.chat-target { font-size: 11px; color: var(--text3); }
.chat-target select {
  width: 100%; padding: 6px 10px; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 4px; color: var(--text); font-family: inherit; font-size: 12px; outline: none;
}
.chat-row { display: flex; gap: 6px; }
.chat-input {
  flex: 1; padding: 8px 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); font-family: inherit; font-size: 13px; outline: none;
  transition: border-color .2s;
}
.chat-input:focus { border-color: var(--blue); }
.btn-send {
  padding: 8px 14px; background: var(--blue); border: none; border-radius: 4px;
  color: #fff; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 600;
  transition: opacity .2s;
}
.btn-send:hover { opacity: .8; }

/* ── Content ─────────────────────────────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }
.section-title {
  font-size: 10px; letter-spacing: 4px; color: var(--text3); font-weight: 600;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Agent cards ─────────────────────────────────────────────────────────── */
.agents-grid { display: flex; flex-direction: column; gap: 10px; }

.agent-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
  transition: border-color .2s;
}
.agent-card:hover { border-color: var(--border2); }
.agent-card.online { border-left: 3px solid var(--online); }
.agent-card.offline { border-left: 3px solid var(--offline); }
.agent-card.banned { border-left: 3px solid var(--red); opacity: .7; }

.agent-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer; user-select: none;
}
.agent-left { display: flex; align-items: center; gap: 14px; }
.agent-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.agent-status-dot.online { background: var(--online); box-shadow: 0 0 8px var(--online); animation: pulse 2s infinite; }
.agent-status-dot.offline { background: var(--offline); }
.agent-status-dot.banned { background: var(--red); }
.agent-name { font-size: 15px; font-weight: 700; color: #ddeeff; letter-spacing: 1px; }
.agent-handle { font-size: 11px; color: var(--text3); }
.agent-meta { display: flex; align-items: center; gap: 16px; }
.agent-badge {
  font-size: 9px; letter-spacing: 2px; padding: 3px 8px; border-radius: 3px;
  font-weight: 700;
}
.badge-online { background: rgba(0,255,136,.1); color: var(--online); border: 1px solid rgba(0,255,136,.2); }
.badge-offline { background: rgba(42,64,96,.2); color: var(--text3); border: 1px solid var(--border); }
.badge-banned { background: rgba(255,34,68,.1); color: var(--red); border: 1px solid rgba(255,34,68,.2); }
.badge-root { background: rgba(0,212,255,.1); color: var(--cyan); border: 1px solid rgba(0,212,255,.2); }
.agent-ip { font-family: 'Share Tech Mono', monospace; font-size: 11px; color: var(--text3); }
.agent-expand { color: var(--text3); font-size: 12px; transition: transform .2s; }
.agent-expand.open { transform: rotate(180deg); }

.agent-body { padding: 0 16px 16px; border-top: 1px solid var(--border); display: none; }
.agent-body.open { display: block; padding-top: 14px; }

.agent-indicators { display: flex; gap: 20px; margin-bottom: 14px; }
.indicator { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.indicator-dot { width: 6px; height: 6px; border-radius: 50%; }
.ind-on { background: var(--online); }
.ind-off { background: var(--border2); }

.stream-row { display: flex; gap: 8px; margin-bottom: 12px; }
.stream-input {
  flex: 1; padding: 8px 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); font-family: 'Share Tech Mono', monospace;
  font-size: 12px; outline: none; transition: border-color .2s;
}
.stream-input:focus { border-color: var(--blue); }
.stream-input::placeholder { color: var(--text3); }
.btn-stream {
  padding: 8px 16px; background: rgba(10,126,255,.15); border: 1px solid rgba(10,126,255,.3);
  border-radius: 4px; color: var(--blue2); font-family: inherit; font-size: 12px;
  font-weight: 700; letter-spacing: 1px; cursor: pointer; transition: all .2s;
}
.btn-stream:hover { background: rgba(10,126,255,.3); }

.agent-actions { display: flex; gap: 8px; }
.btn-ban {
  padding: 7px 16px; border-radius: 4px; font-family: inherit; font-size: 11px;
  font-weight: 700; letter-spacing: 2px; cursor: pointer; transition: all .2s; border: 1px solid;
}
.btn-ban.do-ban { background: rgba(255,34,68,.1); border-color: rgba(255,34,68,.3); color: var(--red); }
.btn-ban.do-ban:hover { background: rgba(255,34,68,.25); }
.btn-ban.do-unban { background: rgba(0,255,136,.1); border-color: rgba(0,255,136,.3); color: var(--green); }
.btn-ban.do-unban:hover { background: rgba(0,255,136,.25); }
.agent-time { font-size: 11px; color: var(--text3); font-family: 'Share Tech Mono', monospace; }

/* ── Pulse animation ────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 60px 0; color: var(--text3); }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-text { font-size: 12px; letter-spacing: 3px; }
