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

:root {
  --primary-color: #0066cc;
  --secondary-color: #f0f2f5;
  --danger-color: #dc3545;
  --success-color: #28a745;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --border-color: #e1e8ed;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background-color: var(--secondary-color);
  color: var(--text-primary);
}

.chat-container {
  display: flex;
  height: 100vh;
  background: white;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #0052a3 100%);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  box-shadow: var(--shadow);
  overflow-y: auto;
}

.sidebar .logo {
  margin-bottom: 32px;
}

.sidebar .logo h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.sidebar .logo p {
  font-size: 13px;
  opacity: 0.9;
  font-weight: 500;
}

.clear-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-bottom: 24px;
}

.clear-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.clear-btn:active {
  transform: scale(0.98);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.status-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  margin-bottom: 8px;
  font-weight: 600;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 13px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffc107;
  animation: pulse 2s infinite;
}

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

.status-dot.disconnected {
  background: #dc3545;
  animation: none;
}

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

#statusText {
  font-weight: 500;
}

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

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.messages-container::-webkit-scrollbar {
  width: 8px;
}

.messages-container::-webkit-scrollbar-track {
  background: transparent;
}

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

.messages-container::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

.welcome-message {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
}

.welcome-message h2 {
  font-size: 32px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.welcome-message p {
  font-size: 16px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.example-prompts {
  margin-top: 32px;
}

.example-prompts p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 600;
}

.prompt-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.prompt-item {
  padding: 16px;
  background: var(--secondary-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

.prompt-item:hover {
  background: #e6eef7;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Message Styling */
.message {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  animation: slideIn 0.3s ease;
}

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

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

.message-content {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 15px;
}

.message.user .message-content {
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  background: var(--secondary-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.message.error .message-content {
  background: #ffe6e6;
  color: var(--danger-color);
  border: 1px solid #ffcccc;
}

.message.system .message-content {
  background: #e8f4f8;
  color: #0066cc;
  border: 1px solid #b3d9e8;
  margin: 8px auto;
  max-width: 90%;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}

/* Loading animation */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: typing 1.4s infinite;
}

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

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

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

/* Input Area */
.input-area {
  padding: 16px 24px 24px;
  background: white;
  border-top: 1px solid var(--border-color);
}

.chat-form {
  width: 100%;
}

.input-wrapper {
  display: flex;
  gap: 12px;
}

#messageInput {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 15px;
  resize: none;
  font-family: inherit;
  transition: all 0.2s ease;
  max-height: 120px;
}

#messageInput:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.send-btn {
  padding: 10px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.send-btn:hover:not(:disabled) {
  background: #0052a3;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.send-btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.send-icon {
  font-weight: 700;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    padding: 16px;
    margin-bottom: 0;
  }

  .sidebar .logo {
    margin-bottom: 16px;
  }

  .sidebar .logo h1 {
    font-size: 20px;
  }

  .sidebar-footer {
    display: none;
  }

  .messages-container {
    padding: 16px;
  }

  .message-content {
    max-width: 90%;
  }

  .prompt-list {
    grid-template-columns: 1fr;
  }

  .input-area {
    padding: 12px 16px 16px;
  }

  .send-btn span:first-child {
    display: none;
  }

  .send-btn {
    padding: 10px 16px;
  }
}

@media (max-width: 480px) {
  .welcome-message {
    padding: 16px;
  }

  .welcome-message h2 {
    font-size: 24px;
  }

  .message-content {
    max-width: 95%;
  }
}
