/* Docs page styles - mssgs-native design */

/* Hero - matches the fancy-v2 cream shell (no dark block under the glass nav) */
.docs-hero {
  padding: 150px 24px 56px;
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
}

.docs-hero-content {
  max-width: var(--container-max);
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}

.docs-hero .docs-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(51, 117, 77, 0.1);
  border: 1px solid rgba(51, 117, 77, 0.25);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green-600, #265f3e);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

.docs-hero h1 {
  font-family: var(--font-display, inherit);
  font-size: 44px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.docs-hero-content > p {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 28px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.docs-quick-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.docs-quick-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--bg-card, rgba(255, 255, 255, 0.55));
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.docs-quick-links a:hover {
  color: var(--brand-contrast, #f7f3e8);
  background: var(--brand, #33754d);
  border-color: var(--brand, #33754d);
  box-shadow: var(--shadow-glow);
}

/* Layout */
.docs-content {
  padding: 0;
}

.docs-container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
}

/* Sidebar */
.docs-sidebar {
  width: 240px;
  min-width: 240px;
  padding: 32px 20px;
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-nav-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--w-mut);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 20px 12px 6px;
  margin: 0;
}

.docs-nav-label:first-child {
  padding-top: 0;
}

.docs-nav a {
  padding: 8px 12px;
  color: var(--w-ink2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: var(--transition);
  line-height: 1.4;
}

.docs-nav a:hover {
  color: var(--w-ink);
  background: rgba(51, 117, 77, 0.1);
}

.docs-nav a.active {
  color: #ffffff;
  background: var(--green-600);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-weight: 600;
}

.docs-nav a.sub {
  padding-left: 24px;
  font-size: 12px;
  font-weight: 400;
  color: var(--w-mut);
}

.docs-nav a.sub:hover {
  color: var(--w-ink);
}

.docs-nav a.sub.active {
  color: #ffffff;
}

.docs-nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 12px 12px;
}

/* Main content */
.docs-main {
  flex: 1;
  padding: 40px 48px;
  min-width: 0;
}

/* Sections */
.docs-section {
  margin-bottom: 56px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border-color);
}

.docs-section:last-child {
  border-bottom: none;
}

.docs-section h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.docs-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 10px;
}

.docs-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--gray-600);
}

.docs-section > p {
  font-size: 15px;
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 16px;
}

/* Links */
.docs-main a {
  color: #5a8c69;
  text-decoration: none;
}

.docs-main a:hover {
  text-decoration: underline;
}

.docs-info-box a {
  color: #5a8c69;
}

.docs-table a {
  color: #5a8c69;
}

/* Steps */
.docs-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
}

.docs-step {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.docs-step .step-number {
  width: 28px;
  height: 28px;
  background: #4a7c59;
  color: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin: 0;
}

.docs-step h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px 0;
  color: var(--gray-700);
}

.docs-step p {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
  line-height: 1.5;
}

/* Code blocks */
.code-block {
  background: #1d1f21;
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.code-header {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-header span {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.code-block pre {
  padding: 16px 20px;
  margin: 0;
  overflow-x: auto;
}

.code-block code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  color: #e6edf3;
}

/* JSON syntax highlighting (json-highlight.js) */
.code-block .json-key { color: #7aa2f7; }
.code-block .json-str { color: #9ece6a; }
.code-block .json-num { color: #ff9e64; }
.code-block .json-bool { color: #bb9af7; }
.code-block .json-null { color: #bb9af7; }
.code-block .json-punct { color: #8b95b3; }

/* Info boxes - mssgs alert style */
.docs-info-box {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(74, 124, 89, 0.08);
  border-radius: 8px;
  margin: 20px 0;
  border: 1px solid rgba(74, 124, 89, 0.2);
}

.docs-info-box > i {
  font-size: 15px;
  color: #5a8c69;
  margin-top: 2px;
  flex-shrink: 0;
}

.docs-info-box h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--gray-700);
}

.docs-info-box p {
  font-size: 13px;
  color: var(--gray-600);
  margin: 0;
  line-height: 1.6;
}

.docs-info-box code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--gray-100);
  padding: 2px 5px;
  border-radius: 4px;
}

.docs-info-box.tip {
  background: rgba(88, 101, 242, 0.08);
  border-color: rgba(88, 101, 242, 0.2);
}

.docs-info-box.tip > i {
  color: #5865f2;
}

.docs-info-box.warning {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

.docs-info-box.warning > i {
  color: #ef4444;
}

.docs-info-box.success {
  background: rgba(74, 124, 89, 0.08);
  border-color: rgba(74, 124, 89, 0.2);
}

.docs-info-box.success > i {
  color: #5a8c69;
}

.docs-info-box ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

.docs-info-box li {
  font-size: 13px;
  color: var(--gray-600);
  padding: 2px 0;
}

/* Tables - mssgs manage panel style */
.docs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

/* Long tokens in code cells must not force the table past the viewport. */
.docs-table code {
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .docs-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.docs-table th,
.docs-table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.docs-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-secondary);
}

.docs-table td {
  font-size: 13px;
  color: var(--gray-600);
  vertical-align: top;
  background: var(--bg-card);
}

.docs-table tr:last-child td {
  border-bottom: none;
}

.docs-table code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gray-700);
}

.docs-table .required-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #5a8c69;
  background: rgba(74, 124, 89, 0.15);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.docs-table .type-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 2px 7px;
  border-radius: 4px;
}

/* Endpoint blocks */
.endpoint-block {
  padding: 14px 18px;
  background: var(--bg-card);
  border-radius: 8px;
  margin: 16px 0;
  border: 1px solid var(--border-color);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.endpoint-header code {
  overflow-wrap: anywhere;
}

.method {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-family: 'JetBrains Mono', monospace;
}

.method.get {
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
}

.method.post {
  background: rgba(74, 124, 89, 0.2);
  color: #5a8c69;
}

.method.delete {
  background: rgba(218, 55, 60, 0.15);
  color: #da373c;
}

.method.put {
  background: rgba(250, 166, 26, 0.15);
  color: #faa61a;
}

.endpoint-header code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--gray-700);
}

.endpoint-block > p {
  font-size: 13px;
  color: var(--gray-500);
  margin: 8px 0 0;
}

/* Lists */
.docs-list {
  list-style: none;
  margin: 12px 0;
  padding: 0;
}

.docs-list li {
  font-size: 13px;
  color: var(--gray-600);
  padding: 4px 0 4px 18px;
  position: relative;
  line-height: 1.6;
}

.docs-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gray-300);
}

.docs-list code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
}

.docs-list-numbered {
  margin: 12px 0;
  padding-left: 20px;
}

.docs-list-numbered li {
  font-size: 13px;
  color: var(--gray-600);
  padding: 4px 0;
  line-height: 1.6;
}

/* Doc cards grid */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.docs-card {
  padding: 18px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.docs-card:hover {
  background: rgba(51, 117, 77, 0.06);
  border-color: rgba(51, 117, 77, 0.3);
  box-shadow: var(--shadow-md);
}

.docs-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--gray-700);
}

.docs-card p {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
  line-height: 1.5;
}

.docs-card i {
  font-size: 20px;
  margin-bottom: 10px;
  color: #5a8c69;
}

.docs-card.orange i {
  color: #faa61a;
}

.docs-card.green i {
  color: #5a8c69;
}

/* Support section */
.docs-support {
  text-align: center;
  padding: 40px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.docs-support h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.docs-support p {
  margin-bottom: 16px;
  font-size: 14px;
}

/* Dark mode overrides */
[data-theme="dark"] .docs-section > p,
[data-theme="dark"] .docs-step p,
[data-theme="dark"] .docs-info-box p,
[data-theme="dark"] .docs-info-box li,
[data-theme="dark"] .docs-list li,
[data-theme="dark"] .docs-list-numbered li,
[data-theme="dark"] .endpoint-block > p,
[data-theme="dark"] .docs-table td,
[data-theme="dark"] .docs-card p {
  color: var(--text-secondary);
}

[data-theme="dark"] .docs-section h2,
[data-theme="dark"] .docs-section h3 {
  color: var(--text-primary);
}

[data-theme="dark"] .docs-section h4,
[data-theme="dark"] .docs-step h4,
[data-theme="dark"] .docs-info-box h4,
[data-theme="dark"] .docs-card h4 {
  color: var(--text-primary);
}

[data-theme="dark"] .docs-nav a {
  color: var(--text-muted);
}

[data-theme="dark"] .docs-nav a:hover {
  color: var(--text-secondary);
}

[data-theme="dark"] .docs-nav a.sub {
  color: var(--text-light);
}

[data-theme="dark"] .docs-nav a.sub:hover {
  color: var(--text-secondary);
}

[data-theme="dark"] .docs-nav-label {
  color: var(--text-light);
}

[data-theme="dark"] .docs-nav a.active {
  color: #ffffff;
}

[data-theme="dark"] .docs-main a {
  color: #60a5fa;
}

[data-theme="dark"] .docs-info-box a {
  color: #60a5fa;
}

[data-theme="dark"] .docs-table a {
  color: #60a5fa;
}

[data-theme="dark"] .docs-table th {
  color: var(--text-muted);
}

[data-theme="dark"] .docs-table code {
  color: var(--text-primary);
}

[data-theme="dark"] .endpoint-header code {
  color: var(--text-primary);
}

/* ============================================================
   Rendered bot-message previews - the dark app chat surface that
   holds the real client markup (.action-message-*, styled in
   web-static/style/action-message.css), so JSON examples show
   exactly what they render as in the client.
   ============================================================ */

.bot-preview {
  margin: -8px 0 28px;
}

.bot-preview-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.bot-preview-label i { font-size: 11px; }

.bot-preview-stage {
  background: var(--app-chat, #323338);
  border: 1px solid var(--app-border, #393a3f);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-md);
}

/* The embed / system card is the real app markup (.action-message-*).
   Those styles live in web-static/style/action-message.css. Only the
   flow-demo tap affordance for the ported action buttons stays here. */
.bfd-cards .action-button.pressed { transform: scale(0.94); filter: brightness(1.25); }

/* ============================================================
   Animated webhook flow demo (.bfd-*)
   ============================================================ */

.bot-flow-demo {
  display: grid;
  grid-template-columns: minmax(240px, 5fr) 7fr;
  gap: 24px;
  margin: 24px 0 8px;
  padding: 24px;
  background: var(--bg-card, #fdfaf1);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.bfd-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bfd-step {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  opacity: 0.45;
  transition: opacity 300ms ease, background 300ms ease;
}

.bfd-step.active {
  opacity: 1;
  background: rgba(51, 117, 77, 0.07);
}

.bfd-step.done { opacity: 0.8; }

.bfd-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-tertiary, #e7e0cd);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
  transition: var(--transition);
}

.bfd-step.active .bfd-dot,
.bfd-step.done .bfd-dot {
  background: var(--brand, #33754d);
  color: var(--brand-contrast, #f7f3e8);
}

.bfd-step-body h5 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0 2px;
}

.bfd-step-body p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.bfd-net {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(51, 117, 77, 0.1);
  color: var(--green-700, #1f4f34);
  border: 1px solid rgba(51, 117, 77, 0.18);
}

.bfd-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--app-chat, #323338);
  border: 1px solid var(--app-border, #393a3f);
  border-radius: 14px;
  padding: 0 20px 16px;
  min-height: 300px;
  overflow: hidden;
}

.bfd-chathead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  margin: 0 -20px 16px;
  padding-left: 20px;
  border-bottom: 1px solid var(--app-border, #393a3f);
  color: var(--text-hi, #dfe0e2);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans, sans-serif);
}

.bfd-hash { color: var(--text-faint, #72767d); font-weight: 700; }

.bfd-usermsg {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  font-family: var(--font-sans, sans-serif);
  font-size: 13px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.bfd-usermsg.visible { opacity: 1; transform: translateY(0); }

.bfd-usermsg-name { font-weight: 700; color: #d99a5c; }
.bfd-usermsg-time { font-size: 10.5px; color: var(--text-faint, #72767d); }

.bfd-usermsg-text {
  font-family: var(--font-mono, monospace);
  font-size: 12.5px;
  color: var(--text-hi, #dfe0e2);
  background: rgba(92, 159, 212, 0.14);
  border-radius: 5px;
  padding: 1px 7px;
}

.bfd-cards { position: relative; flex: 1; }

.bfd-cards .bfd-card {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 350ms ease, transform 350ms ease;
  pointer-events: none;
}

.bfd-cards .bfd-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fake cursor that taps the button */
.bfd-cursor {
  position: absolute;
  z-index: 3;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.4);
  opacity: 0;
  left: 60px;
  top: 220px;
  transition: opacity 250ms ease, left 600ms cubic-bezier(0.4, 0, 0.2, 1), top 600ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms ease;
  pointer-events: none;
}

.bfd-cursor.show { opacity: 1; }
.bfd-cursor.tap { transform: scale(0.7); }

.bfd-replay {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-mid, #b5bac1);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
}

.bfd-replay.show { opacity: 1; pointer-events: auto; }
.bfd-replay:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

@media (prefers-reduced-motion: reduce) {
  .bfd-cards .bfd-card { transition: none; }
  .bfd-cursor { display: none; }
}

/* Responsive */
@media (max-width: 1024px) {
  .docs-sidebar { display: none; }
  .docs-main { padding: 24px 16px; }
  .docs-hero h1 { font-size: 32px; }
  .docs-hero-content > p { font-size: 16px; }
  .docs-quick-links { gap: 6px; }
  .docs-quick-links a { font-size: 12px; padding: 6px 12px; }
  .docs-cards { grid-template-columns: 1fr; }
  .bot-flow-demo { grid-template-columns: 1fr; padding: 16px; }
  .bfd-stage { min-height: 260px; }
}
