* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 800px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 90vh;
  max-height: 900px;
}

.chat-header {
  background: #2c3e50;
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #34495e;
}

.chat-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc3545;
  animation: pulse 2s infinite;
}

.status-indicator.connected {
  background: #28a745;
}

.status-indicator.connecting {
  background: #ffc107;
}

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

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
}

.welcome-message {
  text-align: center;
  color: #6c757d;
  padding: 40px 20px;
}

.welcome-message p {
  margin: 10px 0;
  font-size: 1.1rem;
}

.message {
  margin-bottom: 16px;
  display: flex;
  animation: slideIn 0.3s ease-out;
}

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

.message.user {
  justify-content: flex-end;
}

.message.agent {
  justify-content: flex-start;
}

.message.system {
  justify-content: center;
}

.message-content {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
}

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

.message.agent .message-content {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message.system .message-content {
  background: #e9ecef;
  color: #6c757d;
  font-size: 0.85rem;
  font-style: italic;
  max-width: 90%;
  text-align: center;
}

.message-label {
  font-size: 0.75rem;
  color: #6c757d;
  margin-bottom: 4px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-timestamp {
  font-size: 0.7rem;
  color: #999;
  font-weight: normal;
}

.prompt-editor {
  padding: 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  border-bottom: 1px solid #e9ecef;
}

.prompt-editor h3 {
  margin: 0 0 12px 0;
  color: #495057;
  font-size: 1rem;
  font-weight: 600;
}

.prompt-hint {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  color: #6c757d;
  line-height: 1.5;
}

.prompt-hint code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
  color: #2c3e50;
  border: 1px solid #e9ecef;
}

#customPrompt {
  width: 100%;
  padding: 14px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
  font-size: 0.9rem;
  resize: vertical;
  transition: all 0.3s;
  line-height: 1.6;
  background: #fff;
  box-sizing: border-box;
  min-height: 120px;
}

#customPrompt:focus {
  outline: none;
  border-color: #2c3e50;
  box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

#customPrompt::placeholder {
  color: #adb5bd;
}

.input-container {
  padding: 20px;
  background: white;
  border-top: 1px solid #e9ecef;
}

.connect-btn,
.disconnect-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.connect-btn {
  background: #2c3e50;
  color: white;
}

.connect-btn:hover {
  background: #34495e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.connect-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.disconnect-btn {
  background: #dc3545;
  color: white;
}

.disconnect-btn:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.message-input-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

#messageInput {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

#messageInput:focus {
  outline: none;
  border-color: #2c3e50;
}

#messageInput:disabled {
  background: #f8f9fa;
  cursor: not-allowed;
}

.send-btn {
  padding: 12px 24px;
  background: #2c3e50;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.send-btn:hover:not(:disabled) {
  background: #34495e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.info-panel {
  background: #f8f9fa;
  padding: 20px;
  border-top: 1px solid #e9ecef;
  font-size: 0.9rem;
}

.info-panel h3 {
  margin-bottom: 10px;
  color: #495057;
}

.info-panel p {
  color: #6c757d;
  margin-bottom: 10px;
  line-height: 1.5;
}

.info-panel ul {
  margin-left: 20px;
  color: #6c757d;
}

.info-panel li {
  margin: 6px 0;
  line-height: 1.5;
}

.info-panel code {
  background: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: #2c3e50;
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar {
  width: 8px;
}

.chat-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-container::-webkit-scrollbar-thumb {
  background: #2c3e50;
  border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
  background: #34495e;
}
