/* Base layout */
:root {
  --bg: #0b0c10;
  --panel: #0f1115;
  --text: #c5c6c7;
  --muted: #8f9499;
  --accent: #39d353; /* green prompt */
  --danger: #ff6b6b;
  --border: #1a1d22;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 16px;
}

.header {
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #e6edf3;
  margin-bottom: 12px;
}

.terminal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 14px 4px;
  height: calc(100vh - 295px);
  overflow-y: auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.line { white-space: pre-wrap; word-wrap: break-word; }
.hint { color: var(--muted); }

.line.user { color: #d1e7dd; padding: 8px 0 4px; }
.line.user .caret { color: var(--accent); }
.line.assistant { color: #e6edf3; }
.line.error { color: var(--danger); }

.line .md strong { font-weight: 700; }
.line .md em { font-style: italic; }

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

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

.input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
}

.footer {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
  text-align: center;
  display: grid;
  gap: 4px;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Loading indicator (terminal-style dots) */
@keyframes loaderBlink {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}

.line.loading { color: var(--muted); }
.loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.loader .dot {
  width: 6px;
  height: 6px;
  background: var(--muted);
  border-radius: 50%;
  display: inline-block;
  animation: loaderBlink 1s infinite ease-in-out;
}
.loader .dot:nth-child(2) { animation-delay: 0.2s; }
.loader .dot:nth-child(3) { animation-delay: 0.4s; }

.commands {
  margin-top: 8px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 12px;
}
.commands .label { color: #9aa1a8; }
.commands code {
  background: #0a0c11;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
  color: #cfd6dd;
}
.commands .example { opacity: 0.8; }

/* Scrollbar (WebKit) */
.terminal::-webkit-scrollbar { width: 10px; }
.terminal::-webkit-scrollbar-track { background: transparent; }
.terminal::-webkit-scrollbar-thumb { background-color: #2a2f36; border-radius: 8px; }

/* Slash command popover */
.slash-popover {
  position: absolute;
  transform: translateY(-8px);
  bottom: 100%;
  left: 34px; /* prompt width + gap */
  right: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.03) inset;
  padding: 6px;
  display: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 5;
}

.input-row { position: relative; }

.slash-popover .item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.slash-popover .item .cmd {
  color: #e6edf3;
}

.slash-popover .item .desc {
  color: var(--muted);
}

.slash-popover .item.active,
.slash-popover .item:hover {
  background: #0a0c11;
}
