/* =========================================================
   ScholarReady AI — Enterprise Design System & Styling
   Colors: Deep Indigo (#4F46E5), Vibrant Cyan (#06B6D4)
   ========================================================= */

:root {
  --primary-indigo: #4F46E5;
  --primary-indigo-light: #6366F1;
  --primary-indigo-dark: #3730A3;
  --primary-cyan: #06B6D4;
  --primary-cyan-hover: #22D3EE;
  --primary-cyan-light: rgba(6, 182, 212, 0.15);

  --bg-dark: #0b0f17;
  --bg-dark-secondary: #111827;
  --bg-dark-card: #162032;
  --bg-dark-surface: #1e293b;
  --border-dark: #273549;
  --border-light: rgba(255, 255, 255, 0.08);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  --text-bright: #ffffff;

  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 22px rgba(79, 70, 229, 0.4);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
body.light-theme {
  --bg-dark: #f8fafc;
  --bg-dark-secondary: #ffffff;
  --bg-dark-card: #ffffff;
  --bg-dark-surface: #f1f5f9;
  --border-dark: #e2e8f0;
  --border-light: rgba(0, 0, 0, 0.06);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-sub: #94a3b8;
  --text-bright: #000000;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 290px;
  min-width: 290px;
  background-color: var(--bg-dark-secondary);
  border-right: 1px solid var(--border-dark);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
  z-index: 50;
  position: relative;
}

.sidebar.collapsed {
  width: 78px;
  min-width: 78px;
}

.sidebar.collapsed .brand-info,
.sidebar.collapsed .brand-badge,
.sidebar.collapsed .new-chat-btn span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .badge-pill,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-role-section,
.sidebar.collapsed .status-text,
.sidebar.collapsed .engine-badge {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 1.25rem 0.5rem;
}

.sidebar.collapsed .sidebar-action {
  padding: 0.75rem 0.5rem;
}

.sidebar.collapsed .new-chat-btn {
  padding: 0.75rem;
  justify-content: center;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.85rem;
}

.sidebar.collapsed .toggle-sidebar-btn i {
  transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-footer {
  justify-content: center;
  padding: 1rem 0.5rem;
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary-indigo), var(--primary-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.brand-name .highlight {
  color: var(--primary-cyan);
}

.brand-indigo {
  color: var(--primary-indigo-light);
}

.brand-cyan {
  color: var(--primary-cyan);
}

.brand-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sidebar Actions */
.sidebar-action {
  padding: 1rem 1.25rem;
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-indigo), var(--primary-indigo-dark));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.new-chat-btn:hover {
  background: linear-gradient(135deg, var(--primary-indigo-light), var(--primary-indigo));
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

/* Navigation Menu */
.nav-menu {
  flex: 1;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-sub);
  letter-spacing: 0.06em;
  padding: 0.5rem 0.75rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  color: var(--text-sub);
  transition: var(--transition);
}

.nav-item:hover {
  background-color: var(--bg-dark-surface);
  color: var(--text-bright);
}

.nav-item:hover i {
  color: var(--primary-cyan);
}

.nav-item.active {
  background-color: rgba(79, 70, 229, 0.15);
  color: var(--primary-cyan);
  font-weight: 600;
}

.nav-item.active i {
  color: var(--primary-indigo-light);
}

.badge-pill {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-dark-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.badge-pill.live {
  background-color: rgba(6, 182, 212, 0.15);
  color: var(--primary-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

/* User Role & ID Persona Section */
.user-role-section {
  padding: 1rem 1.25rem;
  background-color: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.role-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.role-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.role-active-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.role-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background-color: var(--bg-dark-card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.role-select:focus {
  border-color: var(--primary-indigo-light);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.role-desc {
  margin-top: 0.5rem;
  font-size: 0.74rem;
  color: var(--text-sub);
  line-height: 1.35;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-light);
}

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.offline {
  background-color: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

.engine-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-dark-surface);
  color: var(--primary-indigo-light);
  border: 1px solid var(--border-light);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  border-bottom: 1px solid var(--border-dark);
  background-color: var(--bg-dark-secondary);
  z-index: 10;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
}

.view-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-bright);
}

.view-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.streaming-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--bg-dark-card);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-dark);
}

.toggle-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.text-warning {
  color: var(--accent-orange);
}

.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(--bg-dark-surface);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--primary-indigo);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background-color: var(--bg-dark-surface);
  color: var(--text-bright);
}

/* Tab Panes */
.tab-pane {
  display: none;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 65px);
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
}

/* Chat Layout */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
}

.messages-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Welcome Card */
.welcome-card {
  text-align: center;
  max-width: 760px;
  margin: 2.5rem auto 1rem;
  padding: 2.5rem 2rem;
  background: radial-gradient(circle at 50% 0%, rgba(79, 70, 229, 0.12), transparent 70%), var(--bg-dark-card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.welcome-avatar {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary-indigo), var(--primary-cyan));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  margin: 0 auto 1.25rem;
  box-shadow: 0 0 25px rgba(79, 70, 229, 0.4);
}

.welcome-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  color: var(--text-bright);
}

.welcome-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Quick Prompts Grid */
.quick-prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  text-align: left;
}

.prompt-chip {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background-color: var(--bg-dark-surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.prompt-chip:hover {
  background-color: rgba(79, 70, 229, 0.12);
  border-color: var(--primary-indigo-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.chip-icon {
  font-size: 1.4rem;
}

.chip-content {
  display: flex;
  flex-direction: column;
}

.chip-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-bright);
}

.chip-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Chat Input Area */
.chat-input-area {
  padding: 0 1.75rem 1.25rem;
}

.input-container-box {
  display: flex;
  align-items: flex-end;
  background-color: var(--bg-dark-secondary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-lg);
  padding: 0.6rem 0.75rem 0.6rem 1.25rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.input-container-box:focus-within {
  border-color: var(--primary-indigo-light);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-bright);
  font-family: var(--font-main);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  max-height: 160px;
  outline: none;
}

.chat-textarea::placeholder {
  color: var(--text-sub);
}

.send-btn {
  background: linear-gradient(135deg, var(--primary-indigo), var(--primary-cyan));
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-hints {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-sub);
  text-align: center;
}

.input-hints kbd {
  background-color: var(--bg-dark-surface);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border-dark);
  font-family: var(--font-mono);
}

/* Messages */
.message-row {
  display: flex;
  gap: 1rem;
  max-width: 90%;
  animation: fadeIn 0.25s ease-out;
}

.user-row {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.assistant-row {
  align-self: flex-start;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--bg-dark-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  border: 1px solid var(--border-dark);
}

.user-row .msg-avatar {
  background: linear-gradient(135deg, var(--primary-indigo), var(--primary-indigo-dark));
}

.assistant-row .msg-avatar {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: var(--primary-cyan);
}

.msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 100%;
}

.msg-body {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-lg);
  font-size: 0.93rem;
  line-height: 1.6;
  word-break: break-word;
}

.user-row .msg-body {
  background: linear-gradient(135deg, var(--primary-indigo), var(--primary-indigo-dark));
  color: #ffffff;
  border-bottom-right-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.assistant-row .msg-body {
  background-color: var(--bg-dark-card);
  border: 1px solid var(--border-dark);
  color: var(--text-main);
  border-bottom-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.assistant-row .msg-body p {
  margin-bottom: 0.6rem;
}
.assistant-row .msg-body p:last-child {
  margin-bottom: 0;
}

.assistant-row .msg-body ul, .assistant-row .msg-body ol {
  margin-left: 1.4rem;
  margin-bottom: 0.6rem;
}

.assistant-row .msg-body h1, .assistant-row .msg-body h2, .assistant-row .msg-body h3 {
  color: var(--text-bright);
  margin-top: 0.8rem;
  margin-bottom: 0.4rem;
}

.assistant-row .msg-body strong {
  color: var(--text-bright);
}

.typing-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background-color: var(--primary-cyan);
  vertical-align: middle;
  margin-left: 3px;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background-color: rgba(6, 182, 212, 0.12);
  color: var(--primary-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
  margin-bottom: 0.4rem;
}

/* Structured Data Cards */
.data-card {
  background-color: var(--bg-dark-surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.6rem;
}

.data-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.data-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.data-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}

.card-item {
  background-color: var(--bg-dark-card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-item-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-bright);
}

.card-item-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-badge {
  align-self: flex-start;
  margin-top: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background-color: rgba(79, 70, 229, 0.15);
  color: var(--primary-indigo-light);
}

.status-badge {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.access-denied-card {
  border-color: rgba(239, 68, 68, 0.3);
  background-color: rgba(239, 68, 68, 0.06);
}

.access-denied-text {
  font-size: 0.85rem;
  color: #fca5a5;
  line-height: 1.5;
}

.rag-sources-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rag-source-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.78rem;
  background-color: var(--bg-dark-card);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.source-num {
  font-weight: 700;
  color: var(--primary-cyan);
}

.source-title {
  font-weight: 600;
  color: var(--text-bright);
}

.source-type {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.error-msg {
  color: #f87171;
  background-color: rgba(239, 68, 68, 0.1);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* MCP Explorer Tab */
.mcp-explorer-container, .rag-explorer-container, .health-container {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  height: 100%;
}

.mcp-header, .rag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-dark);
}

.mcp-header h2, .rag-header h2, .health-container h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-bright);
}

.mcp-header p, .rag-header p, .health-container p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mcp-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  height: calc(100% - 80px);
}

.mcp-tools-sidebar {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-dark-secondary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.mcp-search-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-dark);
  background-color: var(--bg-dark-surface);
}

.mcp-search-box input {
  background: transparent;
  border: none;
  color: var(--text-bright);
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.mcp-tool-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mcp-tool-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background-color: transparent;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.mcp-tool-item:hover {
  background-color: var(--bg-dark-surface);
}

.mcp-tool-item.active {
  background-color: rgba(79, 70, 229, 0.15);
  border-color: var(--primary-indigo-light);
}

.mcp-tool-item-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-bright);
}

.mcp-tool-item-sp {
  font-size: 0.7rem;
  color: var(--text-sub);
}

.mcp-executor-pane {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tool-meta-card {
  background-color: var(--bg-dark-secondary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.tool-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.tool-meta-header h3 {
  font-size: 1.1rem;
  color: var(--text-bright);
}

.tool-meta-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.tool-permissions {
  display: flex;
  gap: 0.5rem;
}

.role-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background-color: var(--bg-dark-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-dark);
}

.tool-params-section, .tool-output-section {
  background-color: var(--bg-dark-secondary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-params-section h4, .output-header h4 {
  font-size: 0.9rem;
  color: var(--text-bright);
}

.code-textarea {
  width: 100%;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.75rem;
  outline: none;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-block {
  background-color: var(--bg-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #a5f3fc;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-indigo), var(--primary-cyan));
  color: #ffffff;
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-dark-surface);
  color: var(--text-main);
  border: 1px solid var(--border-dark);
}

.btn-secondary:hover {
  background-color: var(--bg-dark-card);
  color: var(--text-bright);
}

/* RAG Grid */
.rag-quick-stats {
  display: flex;
  gap: 0.75rem;
}

.stat-badge {
  background-color: var(--bg-dark-secondary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-cyan);
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-sub);
  text-transform: uppercase;
}

.rag-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.rag-card {
  background-color: var(--bg-dark-secondary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.rag-card h3 {
  font-size: 1.1rem;
  color: var(--text-bright);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rag-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-size: 0.88rem;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary-indigo-light);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-group.half {
  flex: 1;
}

.rag-results-box {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 240px;
  overflow-y: auto;
}

.rag-result-item {
  background-color: var(--bg-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.rag-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-size: 0.84rem;
}

.score-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-cyan);
  background-color: rgba(6, 182, 212, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.rag-result-content {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.rag-result-footer {
  font-size: 0.68rem;
  color: var(--text-sub);
}

.crawl-input-group {
  display: flex;
  gap: 0.5rem;
}

.rag-ask-output {
  margin-top: 1rem;
}

.rag-answer-box {
  background-color: var(--bg-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Health Cards Grid */
.health-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.health-card {
  background-color: var(--bg-dark-secondary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.health-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
}

.bg-green { background-color: var(--accent-green); }
.bg-blue { background-color: var(--primary-indigo); }
.bg-purple { background-color: var(--accent-purple); }
.bg-orange { background-color: var(--accent-orange); }

.health-data {
  display: flex;
  flex-direction: column;
}

.health-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-bright);
}

.health-label {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.health-details-card {
  background-color: var(--bg-dark-secondary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.health-details-card h3 {
  font-size: 1.05rem;
  color: var(--text-bright);
  margin-bottom: 1rem;
}

.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.health-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border-dark);
}

.health-table td:first-child {
  width: 260px;
  color: var(--text-muted);
}

.health-table td code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background-color: var(--bg-dark-surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -290px;
    height: 100vh;
  }
  .sidebar.mobile-open {
    left: 0;
  }
  .mobile-menu-btn {
    display: flex;
  }
  .mcp-layout {
    grid-template-columns: 1fr;
  }
  .rag-grid {
    grid-template-columns: 1fr;
  }
  .health-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .quick-prompts-grid {
    grid-template-columns: 1fr;
  }
}
