/* ═══════════════════════════════════════════════════════════════
   ai2agi — Main Stylesheet
   Ai70000, Ltd. | POC v2.0
   Aesthetic: Dark industrial terminal — precise, technical, intentional
═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:           #0a0c0f;
  --bg-panel:     #0f1217;
  --bg-card:      #141820;
  --bg-input:     #0d1015;
  --border:       #1e2530;
  --border-light: #2a3545;

  --text:         #d4dde8;
  --text-dim:     #5a6a7e;
  --text-bright:  #eef2f7;

  --accent:       #00d4a8;        /* teal — AGI signal color */
  --accent-dim:   rgba(0,212,168,0.12);
  --accent-glow:  rgba(0,212,168,0.30);

  --amber:        #f5a623;
  --amber-dim:    rgba(245,166,35,0.12);

  --red:          #e05c5c;
  --green:        #4cde80;

  --font-mono:    'JetBrains Mono', monospace;
  --font-display: 'Syne', sans-serif;

  --radius:       4px;
  --radius-lg:    8px;

  --chat-w:       640px;
  --dev-w:        360px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* ═══════════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════════ */
.site-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  font-size: 20px;
  color: var(--accent);
  line-height: 1;
  animation: pulse-mark 3s ease-in-out infinite;
}

@keyframes pulse-mark {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  color: var(--text-bright);
  letter-spacing: 0.03em;
}

.brand-sub {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.header-formula {
  flex: 1;
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.header-formula sub {
  font-size: 8px;
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  transition: background 0.3s, box-shadow 0.3s;
}

.dot.processing {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  animation: blink 0.6s ease-in-out infinite;
}

.dot.error {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.status-text {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  font-weight: 500;
  transition: color 0.3s;
}

.btn-reset {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.btn-reset:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════════════ */
.main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ═══════════════════════════════════════════════════════════════
   CHAT PANEL
═══════════════════════════════════════════════════════════════ */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 0;
}

/* ── Chat window ──────────────────────────────────────────────────────── */
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Message blocks ───────────────────────────────────────────────────── */
.msg-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fade-up 0.25s ease-out;
}

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

.msg-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  font-weight: 600;
  color: var(--text-dim);
}

.user-block .msg-label  { color: var(--amber); }
.system-block .msg-label { color: var(--accent); }
.agi-block .msg-label    { color: var(--accent); }
.error-block .msg-label  { color: var(--red); }

.msg-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  line-height: 1.7;
  color: var(--text);
  position: relative;
}

.user-block .msg-content {
  border-color: var(--amber-dim);
  background: rgba(245,166,35,0.04);
}

.agi-block .msg-content {
  border-color: var(--accent-dim);
  background: rgba(0,212,168,0.03);
}

.error-block .msg-content {
  border-color: rgba(224,92,92,0.2);
  color: var(--red);
}

.msg-content p { margin-bottom: 8px; }
.msg-content p:last-child { margin-bottom: 0; }

/* AGI response formatting */
.agi-response {
  white-space: pre-wrap;
  word-break: break-word;
}

.agi-trace {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.agi-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.agi-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agi-meta-key {
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.agi-meta-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
}

.agi-meta-val.high   { color: var(--green); }
.agi-meta-val.medium { color: var(--amber); }
.agi-meta-val.low    { color: var(--red); }

/* Welcome */
.welcome-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.component-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.pill {
  background: var(--bg);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 2px;
}

.pill-accent {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: var(--accent-dim);
}

.pill-dominant {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-dim);
}

/* Processing indicator */
.processing-block .msg-content {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}

.processing-dots {
  display: flex;
  gap: 5px;
}

.processing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

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

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1.0); opacity: 1.0; }
}

.processing-text {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.05em;
  animation: processing-fade 1.5s ease-in-out infinite;
}

@keyframes processing-fade {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1.0; }
}

/* ── Input bar ────────────────────────────────────────────────────────── */
.input-bar {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.task-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 14px;
  resize: none;
  min-height: 42px;
  max-height: 160px;
  line-height: 1.5;
  transition: border-color 0.2s;
  outline: none;
}

.task-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.task-input::placeholder { color: var(--text-dim); }

.btn-submit {
  flex-shrink: 0;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #000;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 0 18px;
  height: 42px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-submit:hover:not(:disabled) {
  background: #00ffe8;
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-arrow { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   DEV PANEL
═══════════════════════════════════════════════════════════════ */
.dev-panel {
  width: var(--dev-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease;
}

.dev-panel.collapsed {
  width: 36px;
}

.dev-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: 52px;
  border-bottom: 1px solid var(--border);
}

.dev-title {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.dev-toggle {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.dev-toggle:hover { color: var(--accent); }

.dev-section {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  overflow: hidden;
}

.dev-section-grow {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dev-section-label {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Session metrics */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}

.metric-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
}

/* Pipeline schematic */
.schematic {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sch-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
  border: 1px solid transparent;
}

.sch-step.active {
  background: var(--accent-dim);
  border-color: rgba(0,212,168,0.2);
}

.sch-step-agi.active {
  background: rgba(0,212,168,0.08);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
}

.sch-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: all 0.2s;
}

.sch-step.active .sch-num {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 700;
}

.sch-info { flex: 1; min-width: 0; }

.sch-name {
  font-size: 10px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sch-step.active .sch-name { color: var(--text-bright); }

.sch-detail {
  font-size: 8.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.sch-status {
  font-size: 11px;
  color: var(--border-light);
  flex-shrink: 0;
  transition: color 0.3s;
}

.sch-step.active .sch-status { color: var(--accent); }

.sch-connector {
  text-align: center;
  color: var(--border-light);
  font-size: 11px;
  line-height: 1;
  margin: 1px 0;
}

/* Score bars */
.score-bars { display: flex; flex-direction: column; gap: 8px; }

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-label {
  font-size: 9px;
  color: var(--text-dim);
  width: 110px;
  flex-shrink: 0;
  white-space: nowrap;
}

.score-bar-wrap {
  flex: 1;
  background: var(--bg);
  border-radius: 2px;
  height: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.score-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-bar-mq { background: var(--amber); }
.score-row-mq .score-label { color: var(--amber); }

.score-val {
  font-size: 10px;
  color: var(--text-bright);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* Pipeline log */
.pipeline-log {
  flex: 1;
  overflow-y: auto;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.8;
  padding: 4px 0;
}

.log-idle { color: var(--text-dim); font-style: italic; }

.log-line { margin-bottom: 1px; }
.log-line.log-ok    { color: var(--green); }
.log-line.log-step  { color: var(--text); }
.log-line.log-meta  { color: var(--text-dim); padding-left: 8px; }
.log-line.log-agi   { color: var(--accent); font-weight: 600; }
.log-line.log-err   { color: var(--red); }

/* ═══════════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════════ */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.site-footer sub { font-size: 7px; color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .dev-panel { display: none; }
  .chat-panel { border-right: none; }
  .header-formula { display: none; }
}
