/* Base styles */
body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s, color 0.2s;
  font-size: 15px; /* reduced from default */
}
:root {
  --bg: #181a20;
  --text: #f7f7fa;
  --primary: #4f8cff;
  --sidebar-bg: #23262f;
  --sidebar-border: #23262f;
  --bubble-user: #2563eb;
  --bubble-ai: #23262f;
  --footer-bg: #23262f;
  --bubble-user-text: #f7f7fa;
  --bubble-ai-text: #f7f7fa;
  --bubble-user-radius: 14px 14px 3px 14px;
  --bubble-ai-radius: 14px 14px 14px 3px;
  --selected-bg: #35384a;
  --chat-item-hover: #2d2f3a;
  --input-bg: #23262f;
  --input-border: #35384a;
  --icon: #8fa2c7;
  --icon-hover: #4f8cff;
}
body.dark {
  /* Already dark by default */
}
.app-container {
  display: flex;
  height: 100vh;
  font-size: 0.95rem;
}
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 0;
  font-size: 0.97rem;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #b6c3e1;
  padding: 0.8rem 0.8rem 0.3rem 0.8rem;
  letter-spacing: 1px;
}
.logo-icon {
  font-size: 1rem;
  color: var(--primary);
}
.sidebar-header {
  padding: 0 0.8rem 0.7rem 0.8rem;
}
.new-chat-btn {
  width: 100%;
  padding: 0.5rem 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.3rem;
  box-shadow: 0 2px 8px 0 #0002;
  transition: background 0.2s;
}
.new-chat-btn:hover {
  background: #2563eb;
}
.chat-history-section {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.3rem;
}
.chat-history-header {
  color: #8fa2c7;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.8rem 0 0.2rem 0.5rem;
}
.chat-history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.chat-history-item {
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  color: #e0e6f5;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.15rem;
  transition: background 0.15s;
}
.chat-history-item.selected {
  background: var(--selected-bg);
  color: #fff;
}
.chat-history-item:hover {
  background: var(--chat-item-hover);
}
.chat-item-actions {
  margin-left: 0.5rem;
  color: #8fa2c7;
  font-size: 1rem;
}
.sidebar-footer {
  padding: 0.8rem 0.8rem 0.5rem 0.8rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.get-app-btn {
  width: 100%;
  padding: 0.6rem 0;
  background: #23262f;
  color: #b6c3e1;
  border: 1px solid #35384a;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  justify-content: center;
  margin-bottom: 0.5rem;
  position: relative;
}
.get-app-btn .new-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.5rem;
}
.profile-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
}
.profile-pic {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #4f8cff;
}
.profile-name {
  color: #b6c3e1;
  font-size: 0.95rem;
  font-weight: 500;
}
.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
  font-size: 0.97rem;
}
.header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.8rem 0.7rem 0.8rem 0.7rem;
  border-bottom: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}
.chat-title {
  text-align: center;
  width: 100%;
}
.conversation-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0 1rem 0;
  overflow-y: auto;
  background: var(--bg);
}
.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 0 0.3rem;
}
.message-row {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  position: relative;
}
.message-row.user {
  flex-direction: row-reverse;
  justify-content: flex-end;
}
.message-bubble {
  max-width: 55%;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  font-size: 0.97rem;
  word-break: break-word;
  position: relative;
  box-shadow: 0 2px 8px 0 #0001;
  margin-bottom: 0.1rem;
}
.message-bubble.user {
  align-self: flex-end;
  background: var(--bubble-user);
  color: var(--bubble-user-text);
  border-radius: var(--bubble-user-radius);
  margin-left: auto;
}
.message-bubble.ai {
  align-self: flex-start;
  background: #232b3e;
  color: #f7f7fa;
  border-radius: 20px;
  margin-right: auto;
  font-family: 'Poppins', 'Segoe UI', 'Roboto', Arial, sans-serif;
  font-size: 1.08rem;
  line-height: 1.8;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 18px 0 #0003;
  border: 1.5px solid #2d3750;
  padding: 1.2rem 1.4rem 1.1rem 1.4rem;
  margin-bottom: 0.7rem;
  transition: box-shadow 0.2s, border 0.2s;
  position: relative;
}
.message-bubble.ai strong {
  display: block;
  font-size: 1.22rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: #4f8cff;
  letter-spacing: 0.01em;
  border-bottom: 2px solid #314e89;
  padding-bottom: 0.25rem;
  background: linear-gradient(90deg, #4f8cff 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
}
.message-bubble.ai ul, .message-bubble.ai ol {
  margin: 0.5rem 0 0.5rem 1.2rem;
  padding: 0;
}
.message-bubble.ai br {
  line-height: 2.2;
}
.message-bubble.ai .message-actions {
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 2;
  background: transparent;
  box-shadow: none;
  display: flex;
  gap: 0.4rem;
  padding: 0;
}
.message-bubble.ai {
  padding-top: 2.2rem;
}
.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #232e4a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 0.3rem;
}
.message-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.1rem;
  margin-left: auto;
  color: var(--icon);
  font-size: 1rem;
}
.message-actions i {
  cursor: pointer;
  transition: color 0.2s;
}
.message-actions i:hover {
  color: var(--icon-hover);
}
.message-meta {
  font-size: 0.7rem;
  color: #888;
  margin-top: 0.2rem;
}
.system-indicators {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: #8fa2c7;
  padding-left: 1rem;
}
.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.thinking-indicator .dot {
  width: 8px;
  height: 8px;
  background: #8fa2c7;
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.2s infinite both;
}
.thinking-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}
.thinking-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}
.input-area {
  display: flex;
  align-items: center;
  padding: 0.7rem 1rem;
  background: var(--footer-bg);
  border-top: 1px solid var(--sidebar-border);
  gap: 0.4rem;
  border-radius: 14px 14px 0 0;
  margin: 0 1rem 0.7rem 1rem;
  box-shadow: 0 2px 8px 0 #0002;
}
.attach-btn, .send-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--icon);
  transition: color 0.2s;
}
.attach-btn:hover, .send-btn:hover {
  color: var(--icon-hover);
}
.chat-input {
  flex: 1;
  min-height: 1.7rem;
  max-height: 6rem;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  padding: 0.6rem 0.8rem;
  font-size: 0.97rem;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  margin: 0 0.4rem;
}
.token-counter {
  font-size: 0.8rem;
  color: #888;
  margin-left: 0.3rem;
}
.footer-info {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  background: var(--footer-bg);
  border-top: 1px solid var(--sidebar-border);
  color: #8fa2c7;
}
.footer-info a {
  color: var(--primary);
  text-decoration: none;
}
.footer-info a:hover {
  text-decoration: underline;
}
.connect-section {
  width: 100%;
  background: #23262f;
  border: 1px solid #35384a;
  border-radius: 8px;
  padding: 0.5rem 0.7rem 0.5rem 0.7rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.connect-title {
  color: #b6c3e1;
  font-size: 0.98rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
}
.connect-options {
  display: flex;
  gap: 0.7rem;
}
.connect-link {
  color: #8fa2c7;
  font-size: 0.95rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.2s;
}
.connect-link:hover {
  color: #4f8cff;
  text-decoration: underline;
}
@media (max-width: 900px) {
  .sidebar {
    width: 48px;
    min-width: 48px;
  }
  .sidebar-header, .sidebar-footer, .chat-search, .sidebar-logo, .chat-history-header, .profile-section, .get-app-btn {
    display: none;
  }
  .main-panel {
    padding-left: 0;
  }
  .input-area {
    margin: 0;
    border-radius: 0;
  }
} 