/* ═══════════════════════════════════════════════════════════════════════════
   RajaMods7 AI — Ultra-Premium Dark Luxury UI
   Palette: Deep obsidian + violet/cyan gradient + gold accents
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg-base:       #080b12;
  --bg-surface:    #0d1117;
  --bg-elevated:   #111827;
  --bg-card:       #141c2b;
  --bg-hover:      #1a2235;

  --border:        rgba(255,255,255,0.06);
  --border-bright: rgba(255,255,255,0.12);

  --violet:        #a78bfa;
  --violet-dim:    #7c3aed;
  --cyan:          #06b6d4;
  --cyan-dim:      #0891b2;
  --gold:          #f59e0b;
  --emerald:       #10b981;
  --rose:          #f43f5e;

  --grad-primary:  linear-gradient(135deg, #a78bfa 0%, #06b6d4 100%);
  --grad-gold:     linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --grad-emerald:  linear-gradient(135deg, #10b981 0%, #06b6d4 100%);

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:     0 24px 64px rgba(0,0,0,0.6);
  --shadow-glow:   0 0 40px rgba(167,139,250,0.15);

  --transition:    all 0.2s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: all 0.4s cubic-bezier(0.4,0,0.2,1);

  --topbar-h:      56px;
  --sidebar-w:     280px;
  --font-size:     14px;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-size); scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ─── Ambient Background ─────────────────────────────────────────────────── */
.ambient-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.12;
  animation: orbFloat 20s ease-in-out infinite;
}
.orb-1 { width: 600px; height: 600px; background: #7c3aed; top: -200px; left: -200px; animation-delay: 0s; }
.orb-2 { width: 500px; height: 500px; background: #0891b2; bottom: -150px; right: -150px; animation-delay: -7s; }
.orb-3 { width: 400px; height: 400px; background: #a78bfa; top: 40%; left: 30%; animation-delay: -14s; }
.orb-4 { width: 300px; height: 300px; background: #f59e0b; bottom: 20%; left: 10%; animation-delay: -3s; opacity: 0.06; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-20px) scale(1.05); }
  66% { transform: translate(-20px,30px) scale(0.95); }
}

#particleCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ─── Splash Screen ──────────────────────────────────────────────────────── */
.splash-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.splash-screen.fade-out { opacity: 0; visibility: hidden; }
.splash-inner { text-align: center; }

.splash-logo {
  position: relative; width: 100px; height: 100px;
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
}
.logo-ring {
  position: absolute; border-radius: 50%;
  border: 1px solid transparent;
  animation: ringRotate 3s linear infinite;
}
.ring-1 { width: 100px; height: 100px; border-color: rgba(167,139,250,0.4); animation-duration: 4s; }
.ring-2 { width: 76px; height: 76px; border-color: rgba(6,182,212,0.4); animation-duration: 3s; animation-direction: reverse; }
.ring-3 { width: 52px; height: 52px; border-color: rgba(167,139,250,0.2); animation-duration: 2s; }
@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.logo-core { width: 40px; height: 40px; position: relative; z-index: 1; }
.logo-core svg { width: 100%; height: 100%; }

.splash-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-primary);
}
.splash-title span { background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.splash-sub { color: var(--text-secondary); margin-top: 8px; font-size: 0.95rem; }

.splash-bar {
  width: 240px; height: 2px; background: var(--border);
  border-radius: 1px; margin: 28px auto 12px; overflow: hidden;
}
.splash-fill {
  height: 100%; width: 0%; background: var(--grad-primary);
  border-radius: 1px; animation: splashLoad 2.5s ease-out forwards;
}
@keyframes splashLoad { to { width: 100%; } }
.splash-status { color: var(--text-muted); font-size: 0.8rem; font-family: 'JetBrains Mono', monospace; }

/* ─── App Shell ──────────────────────────────────────────────────────────── */
.app { position: fixed; inset: 0; z-index: 1; display: flex; flex-direction: column; }
.app.hidden { display: none; }

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: rgba(13,17,23,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 100;
}
.topbar-left { flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 32px; height: 32px; }
.brand-icon svg { width: 100%; height: 100%; }
.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text-primary);
}
.brand-name em { font-style: normal; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.topbar-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-md);
  font-size: 0.85rem; font-weight: 500; color: var(--text-secondary);
  transition: var(--transition);
}
.nav-btn svg { width: 16px; height: 16px; }
.nav-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-btn.active {
  color: var(--violet); background: rgba(167,139,250,0.1);
  box-shadow: inset 0 0 0 1px rgba(167,139,250,0.2);
}

.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  font-size: 0.75rem; color: var(--emerald);
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--emerald);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.status-pill.loading { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.2); color: var(--gold); }
.status-pill.loading .status-dot { background: var(--gold); }
.status-pill.error { background: rgba(244,63,94,0.1); border-color: rgba(244,63,94,0.2); color: var(--rose); }
.status-pill.error .status-dot { background: var(--rose); animation: none; }

.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: var(--transition);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ─── Views Container ────────────────────────────────────────────────────── */
.views-container { flex: 1; overflow: hidden; position: relative; }
.view { position: absolute; inset: 0; display: none; overflow: hidden; }
.view.active { display: flex; }

/* ─── Chat Layout ────────────────────────────────────────────────────────── */
.chat-layout { display: flex; width: 100%; height: 100%; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.chat-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgba(13,17,23,0.6);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition-slow);
}
.chat-sidebar.collapsed { width: 0; }

.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.new-chat-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; border-radius: var(--radius-md);
  background: var(--grad-primary); color: white;
  font-size: 0.85rem; font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(167,139,250,0.3);
}
.new-chat-btn svg { width: 16px; height: 16px; }
.new-chat-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(167,139,250,0.4); }

.panel-label {
  display: block; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 8px;
}

.model-selector-panel { padding: 16px; border-bottom: 1px solid var(--border); }
.model-select-wrapper { position: relative; }
.model-select {
  width: 100%; padding: 8px 32px 8px 10px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.82rem; appearance: none; cursor: pointer;
  transition: var(--transition);
}
.model-select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 2px rgba(167,139,250,0.15); }
.select-arrow {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--text-muted);
}
.select-arrow svg { width: 14px; height: 14px; }

.model-badge-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.model-badge {
  padding: 2px 8px; border-radius: 20px; font-size: 0.7rem; font-weight: 500;
  background: rgba(167,139,250,0.1); color: var(--violet);
  border: 1px solid rgba(167,139,250,0.2);
}
.model-badge.speed { background: rgba(16,185,129,0.1); color: var(--emerald); border-color: rgba(16,185,129,0.2); }
.model-badge.budget { background: rgba(245,158,11,0.1); color: var(--gold); border-color: rgba(245,158,11,0.2); }

.provider-filter { padding: 16px; border-bottom: 1px solid var(--border); }
.provider-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.provider-chip {
  padding: 3px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 500;
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer; transition: var(--transition);
}
.provider-chip:hover { border-color: var(--border-bright); color: var(--text-primary); }
.provider-chip.active { background: rgba(167,139,250,0.1); color: var(--violet); border-color: rgba(167,139,250,0.3); }

.chat-history { flex: 1; overflow-y: auto; padding: 16px; }
.history-list { display: flex; flex-direction: column; gap: 4px; }
.history-empty { color: var(--text-muted); font-size: 0.8rem; text-align: center; padding: 20px 0; }
.history-item {
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 0.82rem; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid transparent;
}
.history-item:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.history-item.active { background: rgba(167,139,250,0.08); color: var(--violet); border-color: rgba(167,139,250,0.2); }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.token-counter { display: flex; justify-content: space-between; align-items: center; }
.token-label { font-size: 0.72rem; color: var(--text-muted); }
.token-value { font-size: 0.8rem; font-weight: 600; color: var(--violet); font-family: 'JetBrains Mono', monospace; }

/* ─── Chat Main ──────────────────────────────────────────────────────────── */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
  height: 52px; flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(13,17,23,0.4);
}
.sidebar-toggle { color: var(--text-secondary); transition: var(--transition); }
.sidebar-toggle svg { width: 18px; height: 18px; }
.sidebar-toggle:hover { color: var(--text-primary); }

.active-model-display { display: flex; align-items: center; gap: 8px; flex: 1; }
.model-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); animation: pulse 2s infinite; }
#activeModelName { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }

.chat-actions { display: flex; gap: 4px; }

/* ─── Messages ───────────────────────────────────────────────────────────── */
.messages-container {
  flex: 1; overflow-y: auto; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 20px;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px;
  animation: fadeInUp 0.6s ease;
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.welcome-logo { position: relative; width: 80px; height: 80px; margin: 0 auto 24px; }
.welcome-rings { position: absolute; inset: 0; }
.w-ring {
  position: absolute; border-radius: 50%;
  border: 1px solid transparent; inset: 0;
  animation: ringRotate 4s linear infinite;
}
.w-ring-1 { border-color: rgba(167,139,250,0.3); }
.w-ring-2 { inset: 10px; border-color: rgba(6,182,212,0.3); animation-direction: reverse; animation-duration: 3s; }
.w-ring-3 { inset: 20px; border-color: rgba(167,139,250,0.15); animation-duration: 2s; }
.welcome-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.welcome-icon svg { width: 48px; height: 48px; }

.welcome-screen h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.welcome-screen p { color: var(--text-secondary); font-size: 0.9rem; max-width: 400px; }

.quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 24px; max-width: 560px; }
.quick-prompt {
  padding: 8px 14px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 0.82rem;
  transition: var(--transition); cursor: pointer;
}
.quick-prompt:hover { border-color: var(--violet); color: var(--violet); background: rgba(167,139,250,0.05); transform: translateY(-1px); }

/* Message Bubbles */
.message {
  display: flex; gap: 12px; animation: fadeInUp 0.3s ease;
  max-width: 100%;
}
.message.user { flex-direction: row-reverse; }
.message-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
}
.message.user .message-avatar { background: var(--grad-primary); color: white; }
.message.assistant .message-avatar { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--violet); }
.message.system .message-avatar { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: var(--gold); }

.message-content { flex: 1; min-width: 0; }
.message-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.message.user .message-meta { flex-direction: row-reverse; }
.message-role { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.message-time { font-size: 0.7rem; color: var(--text-muted); }
.message-model-tag {
  font-size: 0.68rem; padding: 1px 6px; border-radius: 10px;
  background: rgba(167,139,250,0.1); color: var(--violet);
  border: 1px solid rgba(167,139,250,0.2);
}

.message-bubble {
  padding: 12px 16px; border-radius: var(--radius-lg);
  font-size: 0.88rem; line-height: 1.65;
  max-width: 720px;
}
.message.user .message-bubble {
  background: rgba(167,139,250,0.12);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: var(--radius-lg) var(--radius-sm) var(--radius-lg) var(--radius-lg);
  color: var(--text-primary);
}
.message.assistant .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg);
}
.message.system .message-bubble {
  background: rgba(245,158,11,0.05);
  border: 1px solid rgba(245,158,11,0.15);
  color: var(--gold); font-size: 0.82rem;
  border-radius: var(--radius-md);
}

/* Code blocks in messages */
.message-bubble pre {
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  overflow-x: auto; margin: 8px 0;
  font-family: 'JetBrains Mono', monospace; font-size: 0.8rem;
}
.message-bubble code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.82em;
  background: rgba(255,255,255,0.06); padding: 1px 5px;
  border-radius: 3px;
}
.message-bubble pre code { background: none; padding: 0; }
.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { padding-left: 20px; margin: 8px 0; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble h1,.message-bubble h2,.message-bubble h3 { margin: 12px 0 6px; font-family: 'Space Grotesk', sans-serif; }
.message-bubble strong { color: var(--text-primary); font-weight: 600; }
.message-bubble a { color: var(--cyan); text-decoration: underline; }
.message-bubble blockquote { border-left: 3px solid var(--violet); padding-left: 12px; color: var(--text-secondary); margin: 8px 0; }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--violet); opacity: 0.6;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Tool call display */
.tool-call-block {
  background: rgba(6,182,212,0.05); border: 1px solid rgba(6,182,212,0.2);
  border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0;
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
}
.tool-call-header { color: var(--cyan); font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.tool-call-header::before { content: '⚙'; }
.tool-call-args { color: var(--text-secondary); white-space: pre-wrap; }

/* ─── Input Area ─────────────────────────────────────────────────────────── */
.input-area {
  flex-shrink: 0; padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(13,17,23,0.6);
  backdrop-filter: blur(20px);
}
.input-options {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.option-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.option-toggle input { display: none; }
.toggle-track {
  width: 32px; height: 18px; border-radius: 9px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  position: relative; transition: var(--transition);
}
.toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-muted); transition: var(--transition);
}
.option-toggle input:checked + .toggle-track { background: rgba(167,139,250,0.2); border-color: var(--violet); }
.option-toggle input:checked + .toggle-track::after { transform: translateX(14px); background: var(--violet); }
.toggle-label { font-size: 0.78rem; color: var(--text-secondary); }

.temp-control, .max-tokens-control { display: flex; align-items: center; gap: 8px; }
.temp-label { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.temp-slider {
  width: 80px; height: 4px; appearance: none;
  background: var(--bg-elevated); border-radius: 2px; cursor: pointer;
}
.temp-slider::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--violet); cursor: pointer;
  box-shadow: 0 0 6px rgba(167,139,250,0.5);
}
.temp-value { font-size: 0.75rem; color: var(--violet); font-family: 'JetBrains Mono', monospace; min-width: 24px; }
.tokens-input {
  width: 72px; padding: 3px 6px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.75rem; text-align: center;
}
.tokens-input:focus { outline: none; border-color: var(--violet); }

.input-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px 10px 10px 16px;
  transition: var(--transition);
}
.input-box:focus-within { border-color: var(--violet); box-shadow: 0 0 0 2px rgba(167,139,250,0.1); }
.input-box textarea {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 0.9rem; line-height: 1.5;
  resize: none; max-height: 200px; overflow-y: auto;
}
.input-box textarea::placeholder { color: var(--text-muted); }
.input-actions { display: flex; gap: 4px; align-items: flex-end; }
.attach-btn { color: var(--text-muted); transition: var(--transition); padding: 6px; border-radius: var(--radius-sm); }
.attach-btn svg { width: 16px; height: 16px; }
.attach-btn:hover { color: var(--cyan); background: rgba(6,182,212,0.1); }

.send-btn {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: var(--grad-primary); color: white;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(167,139,250,0.3);
}
.send-btn svg { width: 16px; height: 16px; }
.send-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(167,139,250,0.4); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.send-btn.loading { animation: sendPulse 1s ease-in-out infinite; }
@keyframes sendPulse { 0%,100% { box-shadow: 0 4px 12px rgba(167,139,250,0.3); } 50% { box-shadow: 0 4px 20px rgba(167,139,250,0.6); } }

.input-footer { display: flex; justify-content: space-between; margin-top: 6px; }
.input-footer span { font-size: 0.72rem; color: var(--text-muted); }
.model-hint { color: var(--violet); }

/* ─── View Inner (Models, Keys, Agents) ──────────────────────────────────── */
.view-inner { flex: 1; overflow-y: auto; padding: 32px; }
.view-header { margin-bottom: 28px; }
.view-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em;
  background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.view-header p { color: var(--text-secondary); margin-top: 4px; font-size: 0.9rem; }

/* ─── Models View ────────────────────────────────────────────────────────── */
.models-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.search-input {
  padding: 8px 14px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 0.85rem; width: 240px;
  transition: var(--transition);
}
.search-input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 2px rgba(167,139,250,0.1); }
.search-input::placeholder { color: var(--text-muted); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  padding: 4px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 500;
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer; transition: var(--transition);
}
.filter-chip:hover { border-color: var(--border-bright); color: var(--text-primary); }
.filter-chip.active { background: rgba(167,139,250,0.1); color: var(--violet); border-color: rgba(167,139,250,0.3); }

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.model-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  transition: var(--transition); cursor: pointer;
  position: relative; overflow: hidden;
}
.model-card::before {
  content: ''; position: absolute; inset: 0;
  background: var(--grad-primary); opacity: 0;
  transition: var(--transition);
}
.model-card:hover { border-color: rgba(167,139,250,0.3); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.model-card:hover::before { opacity: 0.03; }
.model-card.selected { border-color: var(--violet); box-shadow: 0 0 0 1px rgba(167,139,250,0.3), var(--shadow-glow); }

.model-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.model-card-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); line-height: 1.3; }
.model-card-provider {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 20px;
}
.model-card-id { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 10px; word-break: break-all; }
.model-card-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.stat-badge {
  font-size: 0.7rem; padding: 2px 7px; border-radius: 4px;
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.stat-badge.rank-1 { background: rgba(245,158,11,0.1); color: var(--gold); border-color: rgba(245,158,11,0.2); }
.stat-badge.rank-top { background: rgba(167,139,250,0.1); color: var(--violet); border-color: rgba(167,139,250,0.2); }
.stat-badge.speed { background: rgba(16,185,129,0.1); color: var(--emerald); border-color: rgba(16,185,129,0.2); }
.stat-badge.budget { background: rgba(6,182,212,0.1); color: var(--cyan); border-color: rgba(6,182,212,0.2); }
.stat-badge.disabled { background: rgba(244,63,94,0.1); color: var(--rose); border-color: rgba(244,63,94,0.2); }

.model-card-actions { display: flex; gap: 6px; }
.use-model-btn {
  flex: 1; padding: 7px; border-radius: var(--radius-sm);
  background: rgba(167,139,250,0.1); color: var(--violet);
  border: 1px solid rgba(167,139,250,0.2);
  font-size: 0.78rem; font-weight: 600; transition: var(--transition);
}
.use-model-btn:hover { background: rgba(167,139,250,0.2); }

/* Provider color coding */
.provider-google { background: rgba(234,67,53,0.1); color: #ea4335; border-color: rgba(234,67,53,0.2); }
.provider-groq { background: rgba(245,158,11,0.1); color: var(--gold); border-color: rgba(245,158,11,0.2); }
.provider-cerebras { background: rgba(167,139,250,0.1); color: var(--violet); border-color: rgba(167,139,250,0.2); }
.provider-openrouter { background: rgba(99,102,241,0.1); color: #818cf8; border-color: rgba(99,102,241,0.2); }
.provider-sambanova { background: rgba(16,185,129,0.1); color: var(--emerald); border-color: rgba(16,185,129,0.2); }
.provider-mistral { background: rgba(249,115,22,0.1); color: #fb923c; border-color: rgba(249,115,22,0.2); }
.provider-github { background: rgba(255,255,255,0.08); color: #e2e8f0; border-color: rgba(255,255,255,0.15); }
.provider-cloudflare { background: rgba(245,158,11,0.1); color: #fbbf24; border-color: rgba(245,158,11,0.2); }
.provider-cohere { background: rgba(6,182,212,0.1); color: var(--cyan); border-color: rgba(6,182,212,0.2); }
.provider-zhipu { background: rgba(244,63,94,0.1); color: #fb7185; border-color: rgba(244,63,94,0.2); }
.provider-nvidia { background: rgba(118,185,0,0.1); color: #84cc16; border-color: rgba(118,185,0,0.2); }
.provider-ollama { background: rgba(20,184,166,0.1); color: #2dd4bf; border-color: rgba(20,184,166,0.2); }
.provider-kilo { background: rgba(139,92,246,0.1); color: #a78bfa; border-color: rgba(139,92,246,0.2); }
.provider-pollinations { background: rgba(236,72,153,0.1); color: #f472b6; border-color: rgba(236,72,153,0.2); }
.provider-llm7 { background: rgba(251,191,36,0.1); color: #fbbf24; border-color: rgba(251,191,36,0.2); }

/* ─── Keys View ──────────────────────────────────────────────────────────── */
.keys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.key-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: var(--transition);
}
.key-card:hover { border-color: var(--border-bright); }
.key-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.key-provider-name { font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.key-provider-badge { font-size: 0.68rem; padding: 2px 8px; border-radius: 20px; }
.key-status { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; }
.key-status-dot { width: 6px; height: 6px; border-radius: 50%; }
.key-status.has-key .key-status-dot { background: var(--emerald); }
.key-status.no-key .key-status-dot { background: var(--text-muted); }
.key-status.has-key { color: var(--emerald); }
.key-status.no-key { color: var(--text-muted); }

.key-input-row { display: flex; gap: 8px; margin-bottom: 10px; }
.key-input {
  flex: 1; padding: 8px 12px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  transition: var(--transition);
}
.key-input:focus { outline: none; border-color: var(--violet); }
.key-input::placeholder { color: var(--text-muted); font-family: 'Inter', sans-serif; }
.key-save-btn {
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--grad-primary); color: white;
  font-size: 0.8rem; font-weight: 600; transition: var(--transition);
}
.key-save-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(167,139,250,0.3); }
.key-clear-btn {
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: rgba(244,63,94,0.1); color: var(--rose);
  border: 1px solid rgba(244,63,94,0.2); font-size: 0.8rem; transition: var(--transition);
}
.key-clear-btn:hover { background: rgba(244,63,94,0.2); }

.key-models-count { font-size: 0.75rem; color: var(--text-muted); }
.key-models-count span { color: var(--violet); font-weight: 600; }

.key-note { font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; line-height: 1.4; }
.key-note a { color: var(--cyan); }

/* ─── Agents View ────────────────────────────────────────────────────────── */
.agents-layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; }
.glass-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.glass-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem; font-weight: 700; margin-bottom: 20px;
  color: var(--text-primary);
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.85rem; transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 2px rgba(167,139,250,0.1); }
.form-textarea { resize: vertical; line-height: 1.5; }
.form-select { appearance: none; cursor: pointer; }

.tools-checkboxes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool-check { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-secondary); cursor: pointer; }
.tool-check input[type="checkbox"] { accent-color: var(--violet); }

.primary-btn {
  width: 100%; padding: 11px; border-radius: var(--radius-md);
  background: var(--grad-primary); color: white;
  font-size: 0.88rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(167,139,250,0.3);
}
.primary-btn svg { width: 16px; height: 16px; }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(167,139,250,0.4); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.agent-log-card { display: flex; flex-direction: column; height: 100%; min-height: 500px; }
.agent-log-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.agent-log-header h3 { margin-bottom: 0; }
.agent-log { flex: 1; overflow-y: auto; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; line-height: 1.6; }
.agent-log-empty { color: var(--text-muted); text-align: center; padding: 40px 0; font-family: 'Inter', sans-serif; }
.agent-log-entry { padding: 6px 0; border-bottom: 1px solid var(--border); }
.agent-log-entry:last-child { border-bottom: none; }
.log-thought { color: var(--violet); }
.log-action { color: var(--cyan); }
.log-result { color: var(--emerald); }
.log-error { color: var(--rose); }
.log-final { color: var(--gold); font-weight: 600; }

.agent-input-row { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.agent-input-row .form-input { flex: 1; }

/* ─── Settings Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  width: 480px; max-width: 90vw;
  transform: scale(0.95) translateY(10px);
  transition: var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 700; }
.modal-body { display: flex; flex-direction: column; gap: 20px; }
.setting-group label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.theme-options { display: flex; gap: 8px; }
.theme-btn {
  padding: 7px 16px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 0.82rem; transition: var(--transition);
}
.theme-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.theme-btn.active { background: rgba(167,139,250,0.1); color: var(--violet); border-color: rgba(167,139,250,0.3); }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  display: flex; align-items: center; gap: 8px;
  max-width: 320px;
}
.toast.success { border-color: rgba(16,185,129,0.3); }
.toast.success::before { content: '✓'; color: var(--emerald); font-weight: 700; }
.toast.error { border-color: rgba(244,63,94,0.3); }
.toast.error::before { content: '✕'; color: var(--rose); font-weight: 700; }
.toast.info { border-color: rgba(167,139,250,0.3); }
.toast.info::before { content: 'ℹ'; color: var(--violet); }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ─── Utility ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .chat-sidebar { position: absolute; z-index: 50; height: 100%; }
  .chat-sidebar.collapsed { transform: translateX(-100%); width: var(--sidebar-w); }
  .topbar-nav .nav-btn span { display: none; }
  .agents-layout { grid-template-columns: 1fr; }
  .models-grid { grid-template-columns: 1fr; }
  .keys-grid { grid-template-columns: 1fr; }
  .view-inner { padding: 20px; }
  .input-options { gap: 10px; }
  .temp-control, .max-tokens-control { display: none; }
}

/* ─── 3D Slide-in animation for views ───────────────────────────────────── */
.view { animation: none; }
.view.slide-in {
  animation: slideIn3D 0.4s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes slideIn3D {
  from { opacity: 0; transform: perspective(1000px) rotateY(-5deg) translateX(30px); }
  to { opacity: 1; transform: perspective(1000px) rotateY(0deg) translateX(0); }
}

/* ─── Scrollbar for messages ─────────────────────────────────────────────── */
.messages-container::-webkit-scrollbar { width: 3px; }
.messages-container::-webkit-scrollbar-thumb { background: rgba(167,139,250,0.2); }