/* ============================================================================
   Futurebridge Agents — interactive demo console (/demo)
   Loads after styles.css; reuses brand tokens.
   ========================================================================== */

.demo-page {
  padding: 56px 0 96px;
}

.demo-page__head {
  max-width: 720px;
  margin-bottom: 36px;
}
.demo-page__head h1 {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin: 0 0 14px;
}
.demo-page__sub {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
  margin: 0 0 16px;
}
.demo-page__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--pill);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  margin: 0;
}
.pulse--amber {
  background: #febc2e;
  box-shadow: 0 0 0 0 rgba(254, 188, 46, 0.5);
}

/* ── Agent tabs ────────────────────────────────────────────────────────────── */
.agent-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.agent-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.agent-tab:hover { background: rgba(12, 12, 13, 0.04); }
.agent-tab__tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.agent-tab__name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.agent-tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
}
.agent-tab.is-active .agent-tab__name { color: var(--cream); }
.agent-tab.is-active .agent-tab__tag { color: var(--accent-2); }

/* ── Console shell ─────────────────────────────────────────────────────────── */
.console {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.console__main {
  background: var(--dark);
  border: 1px solid rgba(247, 244, 236, 0.1);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(12, 12, 13, 0.25);
}

.console__head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(247, 244, 236, 0.1);
}
.console__title {
  margin-left: 8px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12.5px;
  color: rgba(247, 244, 236, 0.85);
}
.console__env {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #febc2e;
  border: 1px solid rgba(254, 188, 46, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
}
.console__live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(247, 244, 236, 0.7);
}

.thread {
  flex: 1;
  min-height: 380px;
  max-height: 520px;
  overflow-y: auto;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

/* Messages */
.t-msg { display: flex; gap: 10px; }
.t-msg--user { justify-content: flex-end; }
.t-msg__avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.t-msg__bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.55;
  color: rgba(247, 244, 236, 0.92);
  background: rgba(247, 244, 236, 0.07);
  border: 1px solid rgba(247, 244, 236, 0.08);
}
.t-msg--user .t-msg__bubble {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 500;
}
.t-msg__bubble b { color: var(--accent-2); font-weight: 600; }
.t-msg--user .t-msg__bubble b { color: inherit; }

/* Thoughts */
.t-thought {
  font-size: 12.5px;
  font-style: italic;
  color: rgba(247, 244, 236, 0.45);
  padding-left: 38px;
}

/* Tool calls */
.t-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 38px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(247, 244, 236, 0.04);
  border: 1px solid rgba(247, 244, 236, 0.08);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  color: rgba(247, 244, 236, 0.78);
}
.t-tool__sys {
  flex: none;
  font-weight: 700;
  color: var(--accent-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.t-tool__action { flex: 1; min-width: 0; }
.t-tool__status { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.t-tool__ok { color: #28c840; font-weight: 700; }
.t-tool__result { color: rgba(247, 244, 236, 0.6); }
.t-tool.is-done { border-color: rgba(40, 200, 64, 0.25); }

.spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(247, 244, 236, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Artifacts */
.t-artifact {
  margin-left: 38px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(247, 244, 236, 0.14);
  background: var(--cream);
}
.t-artifact__kind {
  padding: 8px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.t-artifact__body {
  margin: 0;
  padding: 14px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-wrap;
}

/* Composer */
.composer {
  border-top: 1px solid rgba(247, 244, 236, 0.1);
  padding: 14px 16px 16px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  transition: opacity 0.2s ease;
}
.chips.is-disabled { opacity: 0.35; pointer-events: none; }
.chip-btn {
  border: 1px solid rgba(247, 244, 236, 0.18);
  background: transparent;
  color: rgba(247, 244, 236, 0.85);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip-btn:hover {
  background: rgba(247, 244, 236, 0.08);
  border-color: rgba(247, 244, 236, 0.35);
}
.chip-btn--accent {
  border-color: var(--accent);
  color: var(--accent-2);
}
.chip-btn--accent:hover { background: rgba(255, 106, 61, 0.12); }

#composer-form {
  display: flex;
  gap: 8px;
  background: rgba(247, 244, 236, 0.06);
  border: 1px solid rgba(247, 244, 236, 0.14);
  border-radius: 999px;
  padding: 5px;
}
#composer-form input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--cream);
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
}
#composer-form input::placeholder { color: rgba(247, 244, 236, 0.4); }
#composer-form .btn--primary { background: var(--accent); color: var(--ink); }
#composer-form .btn--primary:hover { background: #ff7a52; }
#composer-form .btn:disabled { opacity: 0.5; cursor: default; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.console__side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side__block {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.side__block--grow { flex: 1; min-height: 0; }
.side__block h2 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 12px;
}

.systems {
  list-style: none;
  margin: 0;
  padding: 0;
}
.systems li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  font-size: 14px;
  font-weight: 500;
  border-top: 1px solid var(--line);
}
.systems li:first-child { border-top: 0; }
.sys-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #28c840;
  flex: none;
}
.sys-state {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.log li {
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.log li:first-child { border-top: 0; }
.log__time {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: var(--muted);
  margin-right: 6px;
}
.log__sys {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
}
.log b { font-weight: 600; }
.log:empty::after {
  content: "Tool calls will appear here as the agent works.";
  color: var(--muted);
  font-style: italic;
}

.impact__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.impact__num {
  display: block;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.impact__label {
  font-size: 12px;
  color: var(--muted);
}

/* ── Conversion band ───────────────────────────────────────────────────────── */
.demo-cta {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: var(--dark);
  color: var(--cream);
  border-radius: var(--radius-lg);
  padding: 34px 38px;
}
.demo-cta h2 {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 0 0 8px;
}
.demo-cta p {
  margin: 0;
  color: rgba(247, 244, 236, 0.7);
  font-size: 15px;
  max-width: 520px;
}
.demo-cta .btn--primary { background: var(--accent); color: var(--ink); flex: none; }
.demo-cta .btn--primary:hover { background: #ff7a52; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .console { grid-template-columns: 1fr; }
  .console__side { flex-direction: row; flex-wrap: wrap; }
  .console__side .side__block { flex: 1 1 240px; }
  .demo-cta { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 620px) {
  .demo-page { padding: 36px 0 64px; }
  .thread { min-height: 300px; max-height: 60vh; padding: 16px 12px; }
  .t-msg__bubble { max-width: 90%; }
  .t-tool { margin-left: 0; flex-wrap: wrap; }
  .t-thought, .t-artifact { margin-left: 0; }
  #composer-form .btn { padding: 9px 14px; }
}
