/* Vega Mini App — Dark-mode Telegram Mini App UI */
:root {
  --bg: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --fg: #e0e0e0;
  --fg2: #a0a0b0;
  --accent: #4ade80;
  --accent2: #60a5fa;
  --danger: #f87171;
  --warning: #fbbf24;
  --border: #2a2a4a;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

#headerStatus {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
  display: inline-block;
}
.dot.green { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot.red   { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

#sepccLabel { font-weight: 600; }
#branchBadge { font-size: 12px; color: var(--fg2); }
#userBadge { font-size: 12px; color: var(--accent2); }
#versionBadge { font-size: 10px; color: var(--fg2); background: var(--bg3); padding: 1px 5px; border-radius: 8px; margin-right: 4px; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
#tabs {
  display: flex;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  flex: 1;
  padding: 10px 6px;
  background: none;
  border: none;
  color: var(--fg2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Tab content ──────────────────────────────────────────────────────────── */
.tab-content { display: none; padding: 12px; }
.tab-content.active { display: block; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--accent2); border-color: var(--accent2); color: #000; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #000; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.active-stream { background: var(--accent); border-color: var(--accent); color: #000; }

.btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.quick-prompts {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.quick-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg2);
  color: var(--accent2);
  font-size: 11px;
  cursor: pointer;
}

/* ── Inputs ───────────────────────────────────────────────────────────────── */
.input, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  margin: 6px 0;
  resize: vertical;
}
textarea { font-family: var(--mono); }

select.input { appearance: none; }

/* ── Console ──────────────────────────────────────────────────────────────── */
.console {
  background: #0a0a1a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  color: #c0c0c0;
}
.console.mini { max-height: 150px; }

.filter-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg2);
  color: var(--fg2);
  font-size: 11px;
  cursor: pointer;
}
.filter-btn.active { background: var(--accent2); color: #000; border-color: var(--accent2); }

.console-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--fg2);
}

/* ── Git sections ─────────────────────────────────────────────────────────── */
.git-section {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.git-section h3 {
  font-size: 13px;
  color: var(--accent2);
  margin-bottom: 4px;
}

/* ── Control sections ─────────────────────────────────────────────────────── */
.control-section {
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.control-section h3 { font-size: 13px; color: var(--accent2); margin-bottom: 6px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 320px;
  width: 90%;
  text-align: center;
}

#confirmMessage { margin-bottom: 14px; font-size: 14px; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--accent);
  color: var(--fg);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 200;
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* ── Status box ───────────────────────────────────────────────────────────── */
.status-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--fg2);
}
.status-box.hidden { display: none; }

/* ── Custom check ─────────────────────────────────────────────────────────── */
.custom-check { margin: 10px 0; }
.custom-check h4 { font-size: 13px; color: var(--fg2); margin-bottom: 4px; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Prompt output area ──────────────────────────────────────────────────── */
.prompt-output {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.prompt-output.hidden { display: none; }

.output-info {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.output-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--bg3);
  color: var(--fg2);
  white-space: nowrap;
}

.output-console {
  max-height: 500px;
  min-height: 60px;
  font-size: 11px;
}

/* ── Active stream button ─────────────────────────────────────────────────── */
.active-stream { background: var(--accent); border-color: var(--accent); color: #000; }
