:root {
  /* Black theme variables (adjusted for improved contrast) */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --panel-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-strong: rgba(255, 255, 255, 0.18);
  --divider: rgba(255, 255, 255, 0.12);
  --accent-blue: #5b21b6;
  --accent-purple: #9b5cf6;
  --text-primary: #f3f7fb;
  --text-secondary: #b9c6d1;
  --sidebar-width: 244px;
  --header-height: 64px;
  --footer-height: 48px;
  --page-vertical-padding: 0px;
  /* remove extra vertical page padding */
}

/* Reset & base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at top left, #020204, #07060a);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 0;
  /* removed outer page padding per user request */
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: none;
  /* allow main area to fill available width */
  z-index: 10;
  margin-top: var(--header-height);
  /* space for fixed header */
  margin-bottom: var(--footer-height);
  /* space for fixed footer */
  margin-left: var(--sidebar-width);
  /* space for fixed left sidebar */
  padding: 0;
  /* removed container padding */
}

/* Glass Card */
.glass-panel {
  background: linear-gradient(180deg, var(--panel-bg), rgba(255, 255, 255, 0.02));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: none;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.45s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.site-header {
  position: fixed;
  /* keep header fixed at top */
  z-index: 80;
  --page-vertical-padding: 0px;
  /* no extra page padding */
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.92), rgba(12, 12, 18, 0.92));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--glass-border-strong);
}

.site-header .header-inner {
  width: 100%;
  display: flex;
}

/* content area aligned with main container */
.site-header .header-content {
  width: 100%;
  max-width: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-left: 0;
  padding: 0 12px;
  gap: 12px;
}

.site-header .header-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.model-name-top {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.site-header .header-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.model-name-top {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Left logo area (fixed at viewport left) */
.header-left-logo {
  position: relative;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding-left: 6px;
  pointer-events: auto;
}

.header-left-logo .logo-mark {
  font-weight: 700;
  font-size: 0.95rem;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Footer */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.94), rgba(10, 10, 14, 0.94));
  border-top: 1px solid var(--glass-border-strong);
  z-index: 60;
}

.site-footer .footer-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  padding-left: 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Layout with left sidebar */
.layout {
  display: flex;
  gap: 0;
  align-items: flex-start;
  width: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-secondary);
  position: fixed;
  left: 0;
  top: 64px;
  height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  border-right: 1px solid var(--divider);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0;
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.nav-item.small {
  padding: 6px 8px;
  font-size: 0.85rem;
}

.sidebar-top {}

.sidebar-bottom {
  margin-top: auto;
  padding: 0;
}

/* Sidebar panel wrapper inside the fixed sidebar (no outer padding on .sidebar) */
.sidebar-panel {
  margin: 0;
  /* flush to sidebar edges */
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: none;
  border-radius: 12px;
  padding: 8px 0;
  /* keep vertical padding but remove horizontal gap */
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* Resizer handle on the right edge of the fixed sidebar */
.sidebar-resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  z-index: 70;
}

.sidebar-resizer:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-panel .sidebar-bottom {
  margin-top: auto;
  padding: 8px 0 0 0;
}

/* Accordion */
.accordion {
  border-radius: 6px;
  overflow: hidden;
  margin: 0;
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.accordion-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.accordion-toggle {
  font-size: 0.9rem;
  opacity: 0.8;
}

.accordion-content {
  margin-top: 0;
  padding: 6px 0;
  border-radius: 6px;
  background: transparent;
  border: none;
}

.version {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.main-content {
  flex: 1;
  padding-left: 0;
  /* remove inner padding so panel sits flush */
  height: calc(100vh - var(--header-height) - var(--footer-height) - var(--page-vertical-padding));
  /* consider header/footer and body padding */
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-panel {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.main-panel>.glass-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 14px;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel>header {
  flex: 0 0 auto;
}

.panel .panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding-right: 8px;
}

.panel .results-panel {
  flex: 1 1 auto;
  overflow: auto;
}

.container {
  margin-left: var(--sidebar-width);
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex: none;
    border-radius: 12px;
    position: static;
    height: auto;
  }

  .container {
    margin-top: 90px;
    margin-left: 0;
  }

  .site-header .header-inner {
    margin-left: 0;
    width: 100%;
    padding-right: 20px;
  }

  .header-left-logo {
    display: none;
  }
}

/* Brand / Header inside main panel */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
}

.brand h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.stats {
  display: flex;
  gap: 12px;
}

.status-badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
}

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

.status-dot.idle {
  background: #94a3b8;
}

.status-dot.running {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.status-dot.stopped {
  background: #ef4444;
}

/* Search */
.search-container {
  position: relative;
  margin-bottom: 30px;
}

.search-input {
  width: 100%;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 18px 24px;
  padding-right: 120px;
  color: var(--text-primary);
  font-size: 1.1rem;
  transition: all 0.18s;
  outline: none;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 6px rgba(155, 92, 246, 0.10);
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  bottom: 8px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  border: none;
  padding: 0 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Results */
.results-panel {
  min-height: 200px;
}

.result-card {
  background: var(--panel-bg);
  border: none;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
  transition: background 0.18s, transform 0.12s;
}

.result-card:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.result-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.result-content {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Modal */
#mcp-json-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 600px;
  background: #0b0b0c;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 28px;
  z-index: 100;
  display: none;
  box-shadow: 0 22px 48px -10px rgba(0, 0, 0, 0.7);
}

#mcp-json-modal.open {
  display: block;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: none;
}

.modal-overlay.open {
  display: block;
}

pre {
  background: #070709;
  padding: 15px;
  border-radius: 10px;
  font-family: monospace;
  font-size: 0.85rem;
  max-height: 400px;
  overflow: auto;
  color: #9aa4b2;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.secondary-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.warning-btn:hover {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.error-state {
  color: #ef4444;
}

.hidden {
  display: none !important;
}

.accent-purple {
  color: var(--accent-purple);
}

.modal-title {
  margin-bottom: 15px;
}

/* Activity Log */
.activity-log {
  margin-top: 30px;
  background: var(--panel-bg);
  border: none;
  border-radius: 14px;
  padding: 14px;
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
}

.activity-log-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.log-item {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 6px;
  border-left: 3px solid var(--accent-purple);
  animation: slideIn 0.28s ease-out;
  display: flex;
  justify-content: space-between;
}

.log-time {
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 0.75rem;
}

.log-method {
  font-weight: 600;
  color: #a5b4fc;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 10px;
}