:root {
  --bg-color: #f8f9fa;
  --bg-color-dark: #2d3748;
  --card-bg: #ffffff;
  --card-bg-dark: #4a5568;
  --primary-color: #3182ce;
  --primary-hover: #2c5aa0;
  --text-color: #2d3748;
  --text-color-dark: #edf2f7;
  --muted-color: #718096;
  --success-color: #38a169;
  --warning-color: #d69e2e;
  --error-color: #e53e3e;
  --border-color: #e2e8f0;
  --border-color-dark: #4a5568;
}

[data-theme="dark"] {
  --bg-color: #2d3748;
  --bg-color-dark: #1a202c;
  --card-bg: #4a5568;
  --card-bg-dark: #2d3748;
  --text-color: #edf2f7;
  --muted-color: #a0aec0;
  --border-color: #4a5568;
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  transition: all 0.3s ease;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo svg {
  width: 32px;
  height: 32px;
}

.logo span {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
}

.header-actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
}

.btn-secondary:hover {
  background: var(--card-bg);
}

/* Chat Area */
.chat-area {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  min-height: 400px;
  margin-bottom: 20px;
  position: relative;
}

.messages {
  height: 100%;
  overflow-y: auto;
  padding-right: 8px;
}

.message {
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.message.user .message-avatar {
  background: var(--primary-color);
  color: white;
}

.message.bot .message-avatar {
  background: var(--muted-color);
  color: var(--text-color);
}

.message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
}

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

.message.bot .message-content {
  background: var(--card-bg-dark);
  border: 1px solid var(--border-color);
}

.message-time {
  font-size: 0.6875rem;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

.message.user .message-time {
  text-align: right;
}

/* Input Area */
.input-area {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
}

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

#userInput {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  background: var(--card-bg);
  color: var(--text-color);
  transition: border-color 0.2s ease;
}

#userInput:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

#userInput::placeholder {
  color: var(--muted-color);
}

#userInput:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Send Button */
#sendBtn {
  padding: 0 20px;
}

#sendBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Welcome State */
.welcome-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-color);
}

.welcome-state h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--text-color);
}

.welcome-state p {
  font-size: 0.875rem;
}

/* Entry Form (hidden by default) */
.entry-form {
  margin-top: 20px;
  padding: 16px;
  background: var(--card-bg-dark);
  border-radius: 8px;
  display: none;
}

.entry-form.visible {
  display: block;
}

.entry-form.hidden {
  display: none;
}

.entry-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.entry-form input,
.entry-form textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  background: var(--bg-color);
  color: var(--text-color);
}

.entry-form button {
  width: 100%;
  padding: 10px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.entry-form button:hover {
  background: var(--primary-hover);
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat {
  background: var(--card-bg);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted-color);
  margin-top: 4px;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--primary-color);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}