@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,500;1,400&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg-main: #fdfcfb;
  --bg-sidebar: #f7f5f2;
  --text-main: #2b2b2b;
  --text-muted: #737373;
  --border-color: #e5e5e5;
  --input-bg: #ffffff;
  --hover-bg: #eceae6;
  --accent-color: #d97757;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background-color: var(--bg-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  box-sizing: border-box;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 0 8px;
}

.brand {
  font-family: 'Spectral', serif;
  font-size: 1.25rem;
  font-weight: 500;
}

.icons {
  display: flex;
  gap: 12px;
  color: var(--text-muted);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
  margin-bottom: 4px;
}

.nav-btn:hover {
  background-color: var(--hover-bg);
}

.nav-btn i {
  color: var(--text-muted);
  width: 16px;
  text-align: center;
}

.recents-section {
  flex: 1;
  margin-top: 24px;
  overflow-y: auto;
}

.recents-header {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-item {
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.history-item:hover, .history-item.active {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  cursor: pointer;
  border-radius: 8px;
}

.user-profile:hover {
  background-color: var(--hover-bg);
}

.avatar {
  width: 32px;
  height: 32px;
  background-color: #3b3b3b;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 500;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.user-plan {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  min-height: 0;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  padding: 16px 24px;
  align-items: center;
}

.plan-badge {
  font-size: 0.8rem;
  background-color: #f0ede8;
  padding: 4px 12px;
  border-radius: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 auto;
}

.user-avatar-small {
  color: var(--text-muted);
  position: absolute;
  right: 24px;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 0 20px 40px 20px;
  position: relative;
  min-height: 0;
}

.greeting-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.greeting-area h1 {
  font-family: 'Spectral', serif;
  font-weight: 400;
  font-size: 2.2rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.message-row {
  display: flex;
  gap: 16px;
  max-width: 100%;
}

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

.message-bubble {
  max-width: 85%;
  line-height: 1.6;
  font-size: 0.95rem;
}

.message-row.user .message-bubble {
  background-color: #f3f1eb;
  padding: 12px 16px;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
}

.message-row.assistant .message-bubble {
  padding: 4px 0;
  color: var(--text-main);
}

/* Loading Animation */
.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '.';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Markdown Styles */
.message-bubble p {
  margin: 0 0 12px 0;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}
.message-bubble ul, .message-bubble ol {
  margin: 0 0 12px 0;
  padding-left: 24px;
}
.message-bubble li {
  margin-bottom: 6px;
}
.message-bubble code {
  background-color: var(--hover-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: monospace;
}
.message-bubble pre {
  background-color: var(--bg-sidebar);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  margin: 0 0 12px 0;
}
.message-bubble pre code {
  background: transparent;
  padding: 0;
}

/* Input Area */
.input-container {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-wrapper {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.2s;
}

.input-wrapper:focus-within {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: #d4d4d4;
}

#user-input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  outline: none;
  resize: none;
}

#user-input::placeholder {
  color: #a3a3a3;
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.left-actions, .right-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-main);
}

.icon-btn.send {
  background-color: var(--text-main);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
}

.icon-btn.send:disabled {
  background-color: #e5e5e5;
  color: #a3a3a3;
  cursor: not-allowed;
}

.model-select {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  padding-right: 4px;
}

.suggestions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.suggestions button {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  transition: background 0.2s;
}

.suggestions button:hover {
  background-color: var(--hover-bg);
}
