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

:root {
  --primary: #00e5a0;
  --primary-dark: #00c98b;
  --secondary: #00b4d8;
  --accent: #7b61ff;
  --bg-dark: #080b10;
  --bg-sidebar: #0d1117;
  --bg-chat: #111820;
  --bg-input: #1c2333;
  --bg-hover: #161d2a;
  --text-primary: #e6edf3;
  --text-secondary: #7d8590;
  --text-muted: #545d68;
  --border-color: rgba(48, 54, 61, 0.8);
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", monospace;
}

html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 16px;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  stroke: var(--primary);
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.sidebar-content::-webkit-scrollbar { width: 3px; }
.sidebar-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.history-label {
  display: block;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.87rem;
}

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

.history-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 12px;
  background: var(--bg-hover);
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: var(--bg-dark);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
}

.user-info span { font-size: 0.87rem; }

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-links a {
  display: block;
  padding: 8px 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.sidebar-links a:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  color: var(--text-primary);
  cursor: pointer;
}

/* Main Chat */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  position: relative;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* Empty State */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.empty-logo {
  margin-bottom: 24px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.chat-empty h1 {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.dev-notice {
  color: var(--text-secondary);
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.notice-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(240, 180, 41, 0.12);
  color: #f0b429;
  border: 1px solid rgba(240, 180, 41, 0.2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
}

.suggestion-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 600px;
  width: 100%;
}

.suggestion-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.suggestion-card:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(0, 229, 160, 0.1);
  border: 1px solid rgba(0, 229, 160, 0.15);
  border-radius: 8px;
  flex-shrink: 0;
}

.card-icon svg { stroke: var(--primary); }

.card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-text strong {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.card-text span {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Messages */
.messages-container {
  display: none;
  flex-direction: column;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.messages-container.active { display: flex; }

.message-row {
  display: flex;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border-color);
  animation: msgFade 0.3s ease;
}

@keyframes msgFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row:last-child { border-bottom: none; }

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-row.user .message-avatar { background: var(--primary); color: var(--bg-dark); }
.message-row.bot .message-avatar { background: var(--secondary); }

.message-content { flex: 1; min-width: 0; }

.message-sender {
  font-family: var(--font-mono);
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.message-text {
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-text a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}

.message-text a:hover {
  color: #33ffbd;
}

.message-text pre {
  background: var(--bg-sidebar);
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin: 10px 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.message-text code {
  background: var(--bg-sidebar);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary);
}

/* Typing */
.typing-row {
  display: flex;
  gap: 16px;
  padding: 22px 0;
}

.typing-dots {
  display: flex;
  gap: 5px;
  padding: 10px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-6px); opacity: 1; }
}

/* Input Area */
.input-area {
  padding: 20px;
  background: var(--bg-chat);
}

.input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 229, 160, 0.08);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  max-height: 200px;
  line-height: 1.5;
}

.input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 38px;
  height: 38px;
  background: var(--text-muted);
  border: none;
  border-radius: 6px;
  color: var(--bg-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.send-btn:hover { background: var(--text-primary); }
.send-btn.active { background: var(--primary); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.input-disclaimer {
  max-width: 800px;
  margin: 10px auto 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    z-index: 200;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .suggestion-cards { grid-template-columns: 1fr; }
  .chat-empty h1 { font-size: 1.4rem; }
}

@media (max-width: 640px) {
  .sidebar { width: 100%; }
  .chat-empty { padding: 20px; }
  .empty-logo svg { width: 48px; height: 48px; }
  .chat-empty h1 { font-size: 1.2rem; }
  .suggestion-card { padding: 14px; }
  .messages-container { padding: 12px; }
  .input-area { padding: 10px; }
}

@media (max-width: 380px) {
  .chat-empty h1 { font-size: 1rem; }
  .suggestion-card { padding: 12px; }
  .card-icon { width: 34px; height: 34px; }
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }
