/* Reset and base styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --accent: #e94560;
  --accent-hover: #ff6b6b;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #ef4444;
  --border: #2a2a4a;
  --shadow: rgba(0, 0, 0, 0.3);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
}

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

/* Buttons */
button {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

/* Form elements */
input, textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  width: 100%;
  transition: border-color 0.2s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder, textarea::placeholder {
  color: var(--text-secondary);
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Login page styles */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 20px var(--shadow);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

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

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

#login-form button {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
}

/* Status indicators */
.status {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status.connected {
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
}

.status.connected::before {
  background: var(--success);
}

.status.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.status.disconnected::before {
  background: var(--error);
}

.status.connecting {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
}

.status.connecting::before {
  background: var(--warning);
  animation: pulse 1s infinite;
}

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

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 10px 40px var(--shadow);
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  color: var(--accent);
}

.modal-body {
  padding: 1.5rem;
  max-height: 50vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Code/pre styling */
pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

code {
  font-family: 'Fira Code', 'Consolas', monospace;
  background: var(--bg-primary);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.9em;
}

pre code {
  background: none;
  padding: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-tertiary);
}

/* MCP Setup Modal */
.mcp-setup-content {
  max-width: 450px;
}

.mcp-setup-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mcp-setup-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mcp-setup-field label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.mcp-setup-field input {
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.mcp-setup-field input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.mcp-setup-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.mcp-setup-error.hidden {
  display: none;
}

/* MCP Setup Required Banner */
.mcp-setup-banner {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid var(--warning);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem;
  text-align: center;
}

.mcp-setup-banner h3 {
  color: var(--warning);
  margin-bottom: 0.5rem;
}

.mcp-setup-banner p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.mcp-setup-banner button {
  margin-top: 0.5rem;
}
