:root {
  --primary-color: #4a90e2;
  --bg-color: #eef2f5;
  --text-color: #333;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
}

.chat-container {
  width: 100%;
  max-width: 450px;
  height: 85vh;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: var(--primary-color);
  color: white;
  padding: 20px;
  text-align: center;
}

.chat-header h2 { margin: 0; font-size: 1.2rem; }
.chat-header p { margin: 5px 0 0; font-size: 0.85rem; opacity: 0.9; }

#chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f9fbfc;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.msg-wrapper { display: flex; width: 100%; }
.msg-wrapper.user { justify-content: flex-end; }
.msg-wrapper.ai { justify-content: flex-start; }

.msg-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.user .msg-bubble {
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai .msg-bubble {
  background: white;
  color: var(--text-color);
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 4px;
}

#loading {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
  padding: 5px;
  font-style: italic;
}

.hidden { display: none; }

.input-area {
  display: flex;
  padding: 15px;
  background: white;
  border-top: 1px solid #eee;
}

#user-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 25px;
  outline: none;
  font-size: 0.95rem;
  transition: border 0.3s;
}

#user-input:focus { border-color: var(--primary-color); }

#send-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0 20px;
  margin-left: 10px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

#send-btn:hover { background: #357abd; }
#send-btn:disabled { background: #ccc; cursor: not-allowed; }