:root {
  --bg-dark: #171717;
  --sidebar-dark: #212121;
  --surface-dark: #2f2f2f;
  --text-main: #ececec;
  --text-muted: #b4b4b4;
  --accent-color: #2563eb;
  --border-color: #383838;
}

[data-theme="light"] {
  --bg-dark: #ffffff;
  --sidebar-dark: #f9f9f9;
  --surface-dark: #f0f0f0;
  --text-main: #0d0d0d;
  --text-muted: #666666;
  --accent-color: #2563eb;
  --border-color: #e5e5e5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.layout-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-dark);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
}

.btn-new-chat {
  width: 100%;
  padding: 0.6rem 1rem;
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 0.5rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.btn-new-chat:hover {
  background-color: var(--surface-dark);
}

.history-section {
  margin-top: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

.history-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: bold;
  padding: 0 0.5rem;
}

.chat-history-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-item {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item:hover {
  background-color: var(--surface-dark);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.brand {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sparkle { color: var(--accent-color); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.auth-group { display: flex; gap: 0.5rem; }

.btn {
  padding: 0.4rem 0.8rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
}

.btn-primary { background: var(--accent-color); color: white; }
.btn-secondary { background: var(--surface-dark); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-icon { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; }

/* Chat Window */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  overflow: hidden;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-right: 0.5rem;
}

.welcome-card {
  text-align: center;
  margin: auto 0;
  color: var(--text-muted);
}

.welcome-card h2 {
  color: var(--text-main);
  margin-top: 0.5rem;
  font-weight: 500;
}

/* Chat Input Bar - Image 2 Style */
.input-area-wrapper {
  margin-top: 1rem;
}

.file-preview {
  background: var(--surface-dark);
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
}

.btn-remove {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
}

.chat-input-box {
  display: flex;
  align-items: center;
  background-color: var(--surface-dark);
  border: 1px solid var(--border-color);
  border-radius: 1.75rem;
  padding: 0.4rem 0.75rem;
  gap: 0.5rem;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.95rem;
  padding: 0.4rem;
}

.btn-circle-send {
  background-color: var(--accent-color);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-note {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Messages */
.message { display: flex; gap: 0.75rem; }
.message-user { flex-direction: row-reverse; }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
}
.avatar-ai { background: var(--accent-color); color: white; }
.avatar-user { background: var(--surface-dark); color: var(--text-main); }
.bubble {
  background: var(--surface-dark);
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  max-width: 80%;
  line-height: 1.5;
  font-size: 0.95rem;
  white-space: pre-wrap;
}