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

:root {
  --background: #050505;
  --foreground: #F4F4E8;
  --primary: #D1FF00;
  --primary-foreground: #050505;
  --card: #0F0F11;
  --card-hover: #151518;
  --border: rgba(156, 156, 156, 0.15);
  --border-strong: rgba(156, 156, 156, 0.45);
  --font-display: 'Geist', system-ui, sans-serif;
  --font-body: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Typography ─── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

/* ─── Layout ─── */
.view { display: none; flex: 1; flex-direction: column; height: 100%; overflow: hidden; }
.active-view { display: flex; }
.hidden { display: none !important; }

/* ─── Admin Bar ─── */
.admin-bar {
  background: var(--card-hover);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.admin-label { color: var(--foreground); }

/* Switch Toggle */
.switch { position: relative; display: inline-block; width: 34px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border-strong); transition: .2s; border-radius: 18px; }
.slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(16px); background-color: var(--primary-foreground); }

/* ─── Bot Picker ─── */
.picker-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.picker-header h2 { font-size: 20px; margin-bottom: 4px; }
.picker-header p { color: #9C9C9C; font-size: 13px; line-height: 1.4; }

.bot-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.loading-bots {
  font-family: var(--font-mono); font-size: 11px;
  color: #9C9C9C; text-align: center; padding: 32px; text-transform: uppercase;
}

.bot-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bot-card:hover {
  background: var(--card-hover);
  border-color: rgba(156, 156, 156, 0.4);
}
.bot-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bot-card-icon {
  font-size: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.bot-card-title h3 {
  font-size: 15px;
  margin-bottom: 2px;
}
.bot-card-title span {
  font-family: var(--font-mono);
  font-size: 9px;
  color: #9C9C9C;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.bot-caps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bot-cap-tag {
  background: #111113;
  color: #9C9C9C;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 6px;
}

/* ─── Chat Interface ─── */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--background);
}
.btn-back {
  background: none; border: none; color: #9C9C9C; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; transition: color 0.2s;
}
.btn-back:hover { color: var(--foreground); }
.chat-bot-info { display: flex; align-items: center; gap: 10px; }
.chat-icon { font-size: 20px; }
.chat-title-group h3 { font-size: 14px; margin: 0; }
.chat-status {
  font-family: var(--font-mono); font-size: 9px; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.1em;
  display: flex; align-items: center; gap: 4px;
}
.pulse { display: block; width: 6px; height: 6px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 10px var(--primary); animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.message {
  max-width: 90%; padding: 12px;
  line-height: 1.5; font-size: 13px;
}
.message.bot {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
}
.message.user {
  align-self: flex-end;
  background: rgba(209,255,0,0.05);
  border: 1px solid rgba(209,255,0,0.15);
}

.typing-indicator {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; gap: 4px;
}
.typing-dot { width: 4px; height: 4px; background: #9C9C9C; border-radius: 50%; animation: typing 1.4s infinite ease-in-out; }
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.chat-input-area {
  padding: 12px 16px;
  background: var(--background);
  border-top: 1px solid var(--border);
}
.message-counter {
  font-family: var(--font-mono); font-size: 9px; color: #9C9C9C;
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px;
  text-align: center;
}
#chatForm {
  display: flex; gap: 8px; position: relative;
}
#chatInput {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  color: var(--foreground); font-family: var(--font-body); font-size: 13px;
  padding: 12px; outline: none; transition: border-color 0.2s;
}
#chatInput:focus { border-color: rgba(209, 255, 0, 0.4); }
#btnSend {
  background: var(--primary); border: none; color: var(--primary-foreground);
  width: 44px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: opacity 0.2s;
}
#btnSend:hover { opacity: 0.9; }
#btnSend svg { width: 16px; height: 16px; }
#btnSend:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Admin Dashboard ─── */
.admin-dashboard {
  background: var(--card-hover);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}
.admin-stats { display: flex; gap: 12px; margin-bottom: 8px; }
.stat-card {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  padding: 8px 12px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card span { font-family: var(--font-mono); font-size: 8px; text-transform: uppercase; color: #9C9C9C; }
.stat-card strong { font-family: var(--font-mono); font-size: 16px; color: var(--primary); }
.admin-hint { font-size: 11px; color: #9C9C9C; line-height: 1.4; }

/* ─── Modal ─── */
.modal-overlay {
  position: absolute; inset: 0; background: rgba(5,5,5,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px; backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--card); border: 1px solid var(--border);
  padding: 24px; width: 100%; text-align: center;
}
.modal-content h2 { font-size: 18px; margin: 8px 0 12px; }
.modal-content p { color: #9C9C9C; font-size: 13px; line-height: 1.5; margin-bottom: 20px; }
.modal-actions { display: flex; flex-direction: column; gap: 12px; }
.btn-primary {
  background: var(--primary); color: var(--primary-foreground);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 14px; text-decoration: none; display: block;
}
.btn-text {
  background: none; border: none; color: #9C9C9C;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; cursor: pointer; padding: 8px;
}
.btn-text:hover { color: var(--foreground); }

/* Custom Scrollbar for inner widget */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--border-strong); }
