/* ============================================================
   RentalAnalytics — Agent / MCP UI components
   Shared styling for copyable code blocks, agent handoff blocks,
   workflow cards, and prompt recipes. Vanilla, token-driven.
   ============================================================ */

/* ---- Copyable code block ---- */
.codeblock {
  position: relative;
  background: var(--ink);
  color: #dcebe6;
  border-radius: var(--r-md);
  border: 1px solid var(--border-2);
  overflow: hidden;
  margin: var(--s-3) 0 var(--s-5);
}
.codeblock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.codeblock-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: #9fc6ba;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.codeblock pre {
  margin: 0;
  padding: var(--s-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.55;
  background: transparent;
  color: inherit;
}
.codeblock pre code { background: transparent; padding: 0; color: inherit; }

.copy-btn {
  appearance: none;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #e7f3ef;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.3); }
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy-btn.copied { background: var(--positive); border-color: var(--positive); color: #fff; }

/* light copy button used over light surfaces */
.copy-btn-light {
  border-color: var(--border-2);
  background: var(--surface);
  color: var(--ink);
}
.copy-btn-light:hover { background: var(--surface-2); }
.copy-btn-light.copied { background: var(--positive); border-color: var(--positive); color: #fff; }

/* ---- Agent value section (homepage) ---- */
.agent-band {
  background: var(--ink);
  color: #e8f2ee;
  padding: var(--s-8) 0;
}
.agent-band .section-eyebrow { color: var(--accent); }
.agent-band h2 { color: #fff; }
.agent-band .lede { color: #b9d2c9; }

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-top: var(--s-6);
}
@media (max-width: 920px) { .workflow-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .workflow-grid { grid-template-columns: 1fr; } }

.workflow-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.workflow-card .wf-icon {
  width: 36px; height: 36px;
  color: var(--accent);
  margin-bottom: var(--s-3);
}
.workflow-card .wf-icon svg { width: 100%; height: 100%; }
.workflow-card h3 { color: #fff; font-size: var(--text-md); margin: 0 0 6px; }
.workflow-card p { color: #aecabf; font-size: var(--text-sm); line-height: 1.55; margin: 0 0 12px; }
.workflow-card .wf-tool {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: #d8ece5;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: var(--r-sm);
}

/* ---- Agent handoff block (tool pages) ---- */
.agent-handoff {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  padding: var(--s-5);
  margin-top: var(--s-5);
}
.agent-handoff > h3 { margin: 0 0 4px; font-size: var(--text-md); }
.agent-handoff .ah-sub { margin: 0 0 var(--s-4); color: var(--ink-2); font-size: var(--text-sm); }
.agent-handoff .ah-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s-3); }
.ah-tab {
  appearance: none; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  transition: all 0.15s ease;
}
.ah-tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.ah-panel[hidden] { display: none; }

/* ---- Prompt recipe card ---- */
.recipe {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-5);
  background: var(--surface);
}
.recipe h3 { margin-top: 0; font-size: var(--text-md); }
.recipe .recipe-meta {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--s-3);
}
.recipe .pill {
  font-family: var(--font-mono); font-size: var(--text-xs);
  background: var(--accent-soft); color: var(--accent-hover);
  padding: 3px 9px; border-radius: 999px;
}

/* ---- Playbook step chain ---- */
.chain { list-style: none; padding: 0; margin: var(--s-4) 0; counter-reset: step; }
.chain li {
  position: relative;
  padding: 0 0 var(--s-4) var(--s-7);
  counter-increment: step;
  color: var(--ink-2);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.chain li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--ink); color: #fff;
  border-radius: 50%;
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700;
}
.chain li:not(:last-child)::after {
  content: ""; position: absolute; left: 13px; top: 30px; bottom: 4px;
  width: 2px; background: var(--border-2);
}
.chain li code { font-family: var(--font-mono); font-size: 0.9em; }

/* ---- Inline endpoint tool tag for catalog ---- */
.tool-detail { border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); margin-bottom: var(--s-4); }
.tool-detail summary { cursor: pointer; font-weight: 600; font-size: var(--text-md); }
.tool-detail summary .method { background: var(--positive); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; font-family: var(--font-mono); margin-right: 8px; }
.tool-detail[open] summary { margin-bottom: var(--s-3); }
.tool-detail table { width: 100%; font-size: var(--text-xs); border-collapse: collapse; margin: var(--s-2) 0; }
.tool-detail th, .tool-detail td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tool-detail th { color: var(--ink-muted); font-weight: 600; }
.tool-detail code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

/* ---- confidence legend ---- */
.conf-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); margin: var(--s-4) 0; }
@media (max-width: 640px) { .conf-legend { grid-template-columns: 1fr; } }
.conf-legend .c { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); }
.conf-legend .c .n { font-family: var(--font-mono); font-weight: 700; font-size: var(--text-md); }
.conf-legend .c.hi .n { color: var(--positive); }
.conf-legend .c.mid .n { color: var(--warning); }
.conf-legend .c.lo .n { color: var(--negative); }
.conf-legend .c p { margin: 4px 0 0; font-size: var(--text-xs); color: var(--ink-2); }
