/*
 * Set-up picker and instruction modal grafted onto Redoc's MCP panel.
 *
 * Same rule as docs-ai-actions.css: every colour comes from a --wa-* token the
 * page declares inline, so both themes follow the rest of the chrome and no
 * value here has to be maintained twice.
 */

.docs-mcp-host {
  margin-top: 12px;
}

/* ------------------------------------------------------------- call to action */
.docs-mcp-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--wa-border);
  border-radius: 8px;
  background: var(--wa-bg);
  color: var(--wa-fg);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.docs-mcp-cta:hover {
  background: var(--wa-bg-hover);
  border-color: var(--wa-fg-subtle);
}

.docs-mcp-cta__label {
  flex: 1;
}

.docs-mcp-cta svg {
  display: block;
  width: 14px;
  height: 14px;
}

.docs-mcp-cta__chevron {
  color: var(--wa-fg-subtle);
}

.docs-mcp-cta.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ------------------------------------------------------------------- picker */
/* Fixed and portalled to <body>: see the note in docs-mcp-setup.js. Position,
   width and max-height are set inline from the trigger's rect. */
.docs-mcp-picker {
  position: fixed;
  z-index: 190;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--wa-border);
  border-radius: 10px;
  background: var(--wa-bg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.docs-mcp-picker__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--wa-border-soft);
  color: var(--wa-fg-subtle);
}

.docs-mcp-picker__search svg {
  display: block;
  width: 14px;
  height: 14px;
}

.docs-mcp-picker__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--wa-fg);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.docs-mcp-picker__search input::-webkit-search-cancel-button {
  display: none;
}

.docs-mcp-picker__list {
  flex: 1;
  min-height: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}

.docs-mcp-picker__group {
  padding: 8px 8px 4px;
  color: var(--wa-fg-subtle);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.docs-mcp-picker__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--wa-fg);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.docs-mcp-picker__item:hover,
.docs-mcp-picker__item:focus-visible {
  background: var(--wa-bg-hover);
  outline: none;
}

.docs-mcp-picker__text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.docs-mcp-picker__name {
  font-weight: 500;
}

.docs-mcp-picker__hint {
  color: var(--wa-fg-subtle);
  font-size: 11.5px;
  line-height: 1.35;
}

/* Marks the clients that can be set up in one click rather than by hand. */
.docs-mcp-picker__badge {
  flex: none;
  color: var(--wa-accent);
}

.docs-mcp-picker__badge svg {
  display: block;
  width: 13px;
  height: 13px;
}

/* -------------------------------------------------------------------- modal */
.docs-mcp-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.docs-mcp-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.docs-mcp-modal__box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: 100%;
  overflow: hidden;
  border: 1px solid var(--wa-border);
  border-radius: 14px;
  background: var(--wa-bg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  animation: docs-mcp-rise 0.16s ease-out;
}

@keyframes docs-mcp-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-mcp-modal__box { animation: none; }
  .docs-mcp-cta { transition: none; }
}

.docs-mcp-modal__head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--wa-border-soft);
}

.docs-mcp-modal__heading {
  flex: 1;
  min-width: 0;
}

.docs-mcp-modal__title {
  margin: 0;
  color: var(--wa-fg);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.docs-mcp-modal__summary {
  margin: 4px 0 0;
  color: var(--wa-fg-muted);
  font-size: 13px;
  line-height: 1.45;
}

.docs-mcp-modal__close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--wa-fg-subtle);
  cursor: pointer;
}

.docs-mcp-modal__close:hover {
  background: var(--wa-bg-hover);
  color: var(--wa-fg);
}

.docs-mcp-modal__close svg {
  display: block;
  width: 16px;
  height: 16px;
}

.docs-mcp-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--wa-border-soft);
  background: var(--wa-bg-subtle);
}

.docs-mcp-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--wa-border);
  border-radius: 7px;
  background: var(--wa-bg);
  color: var(--wa-fg);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.docs-mcp-btn:hover {
  background: var(--wa-bg-hover);
  border-color: var(--wa-fg-subtle);
  color: var(--wa-fg);
}

.docs-mcp-btn svg {
  display: block;
  width: 14px;
  height: 14px;
}

.docs-mcp-btn--primary {
  border-color: transparent;
  background: var(--wa-accent);
  color: var(--wa-on-accent);
}

.docs-mcp-btn--primary:hover {
  background: var(--wa-accent-hover);
  border-color: transparent;
  color: var(--wa-on-accent);
}

.docs-mcp-btn--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--wa-fg-muted);
}

.docs-mcp-btn.is-done {
  border-color: var(--wa-accent);
  color: var(--wa-accent);
}

.docs-mcp-btn.is-failed {
  border-color: var(--wa-warn-accent);
  color: var(--wa-warn-accent);
}

/* --------------------------------------------------------------- modal body */
.docs-mcp-modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 20px 24px;
  color: var(--wa-fg);
  font-size: 14px;
  line-height: 1.6;
}

.docs-mcp-modal__body h2,
.docs-mcp-modal__body h3,
.docs-mcp-modal__body h4 {
  margin: 22px 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--wa-fg-muted);
}

.docs-mcp-modal__body p {
  margin: 0 0 12px;
  color: var(--wa-fg-muted);
}

.docs-mcp-modal__body ol,
.docs-mcp-modal__body ul {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--wa-fg-muted);
}

.docs-mcp-modal__body li {
  margin-bottom: 5px;
}

.docs-mcp-modal__body a {
  color: var(--wa-accent);
}

.docs-mcp-modal__body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--wa-code-bg);
  color: var(--wa-code-fg);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.87em;
}

.docs-mcp-code {
  position: relative;
  margin: 0 0 14px;
}

.docs-mcp-modal__body pre {
  margin: 0;
  padding: 12px 44px 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--wa-border-soft);
  border-radius: 8px;
  background: var(--wa-code-bg);
  color: var(--wa-code-fg);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
}

.docs-mcp-modal__body pre code {
  padding: 0;
  background: transparent;
  font-size: inherit;
}

.docs-mcp-code__copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--wa-border);
  border-radius: 6px;
  background: var(--wa-bg);
  color: var(--wa-fg-subtle);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.docs-mcp-code:hover .docs-mcp-code__copy,
.docs-mcp-code__copy:focus-visible {
  opacity: 1;
}

.docs-mcp-code__copy:hover {
  color: var(--wa-fg);
}

.docs-mcp-code__copy.is-done {
  opacity: 1;
  border-color: var(--wa-accent);
  color: var(--wa-accent);
}

.docs-mcp-code__copy svg {
  display: block;
  width: 13px;
  height: 13px;
}

/* Touch devices never hover, so the per-block copy would be unreachable. */
@media (hover: none) {
  .docs-mcp-code__copy { opacity: 1; }
}

@media (max-width: 620px) {
  .docs-mcp-modal { padding: 0; }
  .docs-mcp-modal__box { max-height: 100%; border-radius: 0; border: 0; }
}
