:root {
  --chat-bg: rgba(28, 25, 46, 0.85); --header-bg: rgba(18, 15, 35, 0.9);
  --input-bg: rgba(38, 35, 64, 0.85); --text-color: #f8f9fa;
  --bot-msg-bg: rgba(47, 45, 85, 0.85); --bot-text: #f0f0f0;
  --user-msg-bg: rgba(90, 103, 216, 0.9); --user-text: #ffffff;
  --timestamp-color: rgba(200, 200, 220, 0.7); --shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  --border-radius: 16px; --accent-color: #667eea;
}

body.light-theme {
  --chat-bg: rgba(255, 255, 255, 0.88); --header-bg: rgba(249, 250, 251, 0.9);
  --input-bg: rgba(243, 244, 246, 0.85); --text-color: #1f2937;
  --bot-msg-bg: rgba(229, 231, 235, 0.85); --bot-text: #374151;
  --user-msg-bg: rgba(79, 70, 229, 0.9); --timestamp-color: rgba(107, 114, 128, 0.7);
  --accent-color: #6366f1;
}

* { 
  box-sizing: border-box; 
  margin: 0; padding: 0; 
  font-family: 'Inter', sans-serif; 
}

body {
  background: url('https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&w=1650&q=80') no-repeat center center fixed;
  background-size: cover; color: var(--text-color); display: flex; align-items: center;
  justify-content: center; height: 100vh; padding: 20px; transition: all 0.4s ease;
}

.chat-container {
  background-color: var(--chat-bg); width: 100%; max-width: 500px; height: 90vh;
  border-radius: var(--border-radius); overflow: hidden; display: flex; flex-direction: column;
  backdrop-filter: blur(12px); box-shadow: var(--shadow); border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-header {
  background-color: var(--header-bg); padding: 18px 60px 18px 24px; font-size: 18px;
  font-weight: 600; border-bottom: 1px solid rgba(255, 255, 255, 0.05); text-align: center;
  position: relative; backdrop-filter: blur(5px);
}

.header-buttons {
  position: absolute; 
  top: 50%; 
  right: 20px; 
  transform: translateY(-50%);
  display: flex; 
  gap: 12px;
}

.header-buttons button {
  background: rgba(255, 255, 255, 0.1); border: none; color: var(--timestamp-color);
  cursor: pointer; font-size: 18px; transition: all 0.2s ease; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
}

.header-buttons button:hover { color: var(--text-color); background: rgba(255, 255, 255, 0.2); }

.chat-box {
  flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px;
}

.message {
  max-width: 85%; padding: 14px 18px; border-radius: 18px; line-height: 1.6;
  white-space: pre-wrap; position: relative; word-wrap: break-word; font-size: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); backdrop-filter: blur(5px);
}

.user {
  align-self: flex-end; background-color: var(--user-msg-bg); color: var(--user-text);
  border-bottom-right-radius: 4px; animation: fadeInUp 0.3s ease;
}

.bot {
  align-self: flex-start; background-color: var(--bot-msg-bg); color: var(--bot-text);
  border-bottom-left-radius: 4px; animation: fadeInUp 0.3s ease 0.1s both;
}

.timestamp {
  font-size: 11px; color: var(--timestamp-color); text-align: right; margin-top: 6px;
}

.input-area {
  display: flex; padding: 16px 20px; border-top: 1px solid rgba(255, 255, 255, 0.05);
  background-color: var(--header-bg); align-items: center; backdrop-filter: blur(5px);
}

.input-area input {
  flex: 1; padding: 14px 16px; border: none; border-radius: 12px; background-color: var(--input-bg);
  color: var(--text-color); font-size: 15px; outline: none; transition: all 0.3s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input-area input:focus { box-shadow: 0 0 0 2px var(--accent-color); }

.input-area button {
  margin-left: 12px; background-color: var(--accent-color); border: none; color: white;
  padding: 14px 18px; font-size: 15px; border-radius: 12px; cursor: pointer;
  transition: all 0.2s ease; font-weight: 500; min-width: 80px;
}

.input-area button:hover { background-color: var(--user-msg-bg); transform: translateY(-1px); }

.chat-box::-webkit-scrollbar { width: 6px; }
.chat-box::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); }
.chat-box::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); }
.chat-box::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

.typing-indicator {
  display: flex; padding: 12px 16px; background-color: var(--bot-msg-bg);
  border-radius: 18px; align-self: flex-start; margin-bottom: 16px;
}

.typing-indicator span {
  height: 8px; width: 8px; background-color: var(--timestamp-color); border-radius: 50%;
  margin: 0 2px; animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
