/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  background: #0f0f23;
  color: #cccccc;
  li.server-command {
    font-size: 0.8rem;
    color: #9ca3af;
    font-family: 'Inter', sans-serif;
    margin-top: 4px;
    padding: 2px 6px;
    background: rgba(156, 163, 175, 0.1);
    border-radius: 4px;
    display: inline-block;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    line-height: 1.6;
    overflow: hidden;
  }
  /* 
body { */
}

/* App Layout */
.app {
  display: grid;
  grid-template-areas:
    'header header'
    'sidebar main';
  grid-template-rows: 60px 1fr;
  grid-template-columns: 320px 1fr;
  height: 100vh;
  transition: grid-template-columns 0.3s ease;
}

.app.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

/* Header */
.header {
  grid-area: header;
  background: #1a1a2e;
  border-bottom: 1px solid #16213e;
  padding: 0 20px;
  display: flex;
  align-items: center;
}

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

.logo {
  display: flex;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
}

.logo-icon {
  margin-right: 8px;
  font-size: 1.5rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  transition: background-color 0.3s ease;
}

.status-dot.connected {
  background: #10b981;
}

.status-dot.connecting {
  background: #f59e0b;
  animation: pulse 1.5s infinite;
}

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

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  background: #16213e;
  border-right: 1px solid #1f2937;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #1f2937;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  color: #ffffff;
  font-weight: 600;
}

.collapse-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.collapse-btn:hover {
  color: #ffffff;
}

.config-section {
  padding: 20px;
  border-bottom: 1px solid #1f2937;
}

.config-section h4 {
  color: #ffffff;
  font-weight: 500;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.875rem;
  color: #9ca3af;
}

.form-group select,
.form-group input {
  width: 100%;
  padding: 8px 12px;
  background: #0f0f23;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #ffffff;
  font-size: 0.875rem;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  width: 100%;
  margin-bottom: 8px;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
}

.btn-secondary {
  background: #374151;
  color: #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
  background: #4b5563;
}

.btn-warning {
  background: #f59e0b;
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background: #d97706;
}

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

/* Server List */
.server-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #1e1e2e;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid #313244;
  cursor: pointer;
  transition: all 0.2s ease;
}

.server-item:hover {
  background: #262626;
  transform: translateX(2px);
  border-color: #404040;
}

.server-info {
  flex: 1;
}

.server-name {
  font-weight: 500;
  color: #ffffff;
  font-size: 0.875rem;
}

.server-command {
  font-size: 0.75rem;
  color: #9ca3af;
  font-family: 'Monaco', 'Menlo', monospace;
}

.server-status {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.server-status.connected {
  background: #10b98120;
  color: #10b981;
}

.server-status.disconnected {
  background: #ef444420;
  color: #ef4444;
}

.server-status.connecting {
  background: #f59e0b20;
  color: #f59e0b;
  animation: pulse 2s infinite;
}

.server-status.disconnecting {
  background: #f97316;
  color: #fff;
  animation: pulse 1s infinite;
}

/* Server Connection States */
.server-tools {
  font-size: 0.75rem;
  color: #10b981;
  margin-top: 2px;
}

.server-summary {
  margin-top: 12px;
  padding: 8px;
  background: #1e1e2e;
  border-radius: 6px;
  border: 1px solid #313244;
}

.connection-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

.summary-icon {
  font-size: 1rem;
}

/* Tools List */
.tools-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
}

.tool-item {
  padding: 6px 8px;
  margin-bottom: 4px;
  background: #0f0f23;
  border-radius: 4px;
  font-size: 0.8rem;
}

.tool-name {
  color: #3b82f6;
  font-weight: 500;
}

.tool-description {
  color: #9ca3af;
  margin-top: 2px;
}

/* Main Content */
.main-content {
  grid-area: main;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.welcome-message {
  text-align: center;
  padding: 40px 20px;
  max-width: 600px;
  margin: 0 auto;
}

.welcome-message h2 {
  color: #ffffff;
  margin-bottom: 12px;
  font-weight: 600;
}

.welcome-message p {
  color: #9ca3af;
  margin-bottom: 24px;
}

.features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #1a1a2e;
  border-radius: 8px;
}

.feature-icon {
  font-size: 1.2rem;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 800px;
  margin-bottom: 16px;
}

.message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: #3b82f6;
}

.message.assistant .message-avatar {
  background: #10b981;
}

.message-content {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
}

.message.user .message-content {
  background: #3b82f6;
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  background: #1a1a2e;
  color: #e5e7eb;
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  color: #9ca3af;
}

.typing-dots {
  display: flex;
  gap: 2px;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Input Container */
.input-container {
  padding: 20px;
  border-top: 1px solid #1f2937;
  background: #16213e;
}

.input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  max-width: 800px;
  margin: 0 auto;
}

#messageInput {
  flex: 1;
  padding: 12px 16px;
  background: #0f0f23;
  border: 1px solid #374151;
  border-radius: 12px;
  color: #ffffff;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-family: inherit;
  line-height: 1.5;
}

#messageInput:focus {
  outline: none;
  border-color: #3b82f6;
}

#messageInput::placeholder {
  color: #6b7280;
}

.send-btn {
  width: 44px;
  height: 44px;
  background: #3b82f6;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: #2563eb;
}

.send-btn:disabled {
  background: #374151;
  cursor: not-allowed;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #1a1a2e;
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  max-height: 80%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #374151;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  color: #ffffff;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: #ffffff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app {
    grid-template-areas:
      'header'
      'main';
    grid-template-rows: 60px 1fr;
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 320px;
    height: calc(100vh - 60px);
    z-index: 100;
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    grid-area: main;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Server Actions */
.server-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.server-hint {
  font-size: 0.7rem;
  color: #6b7280;
  font-style: italic;
}

/* Demo Context Styles */
.demo-context {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  font-size: 0.875rem;
}

.demo-label {
  color: #93c5fd;
  font-weight: 500;
}

.demo-name {
  color: #ffffff;
  font-weight: 600;
}

.demo-clear-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 1rem;
  transition: background-color 0.2s;
}

.demo-clear-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Demo Name Modal Styles */
#demoNameModal .modal-content {
  padding: 24px;
}

#demoNameModal h2 {
  margin-bottom: 12px;
  color: #ffffff;
}

#demoNameModal p {
  margin-bottom: 20px;
  color: #9ca3af;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #ffffff;
  font-size: 1rem;
  margin-bottom: 20px;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
