/* CapraSEO — "Ask CapraSEO AI to create content" card on /content/
   ─────────────────────────────────────────────────────────────
   The base .ai-prompt-card / .aip-* rules live in css/links.css, which
   the /content/ page does not load. The base rules below are copied
   verbatim from there so the card frame (avatar + body + model picker +
   status) matches the Ask-AI cards on the data pages. The .cc-* rules
   are new: this card LEADS with one-click content plays instead of a
   single free-text "Find answer" box, because the goal here is to
   PRODUCE content, not interrogate data.
   ───────────────────────────────────────────────────────────── */

/* ── Base frame (copied from css/links.css) ──────────────────── */
.ai-prompt-card {
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  /* .card defaults to overflow:hidden which clips the model picker's
     absolutely-positioned .menu inside this card. */
  overflow: visible;
}
.aip-avatar {
  /* Definite width + stretch height (NOT a height-driven square). The old
     rule sized the avatar as a square whose width tracked its stretched
     height (aspect-ratio 1/1). That is circular — avatar width feeds the
     body's width, which sets the body's height, which the avatar stretches
     to — and the browser resolves the flex line to a too-short cross-size,
     so a tall body (the /content/ plays grid, or any narrow content column)
     overflows the card and, under overflow:visible, spills onto the card
     below. A definite width breaks the loop: the avatar is a fixed-width
     strip that cover-fills whatever height the body needs. See css/links.css. */
  flex: 0 0 clamp(150px, 26%, 280px);
  align-self: stretch;
  height: auto;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  border-radius: 14px 0 0 14px;
  border-right: 1px solid rgba(var(--wash-rgb), 0.08);
}
.aip-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px 20px;
}
@media (max-width: 560px) {
  /* Compact mobile header — a small round avatar beside the title reads
     premium; a full-width hero banner of the mascot does not. The absolute
     avatar also breaks the percent flex-basis loop that collapsed the card
     height and spilled the input outside the card. */
  .ai-prompt-card { flex-direction: column; align-items: stretch; position: relative; }
  .aip-avatar {
    flex: 0 0 auto;
    position: absolute;
    top: 18px;
    left: 18px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(var(--wash-rgb), 0.14);
    box-shadow: 0 1px 0 var(--edge-hi) inset;
  }
  .aip-body { padding: 18px; }
  .aip-head { padding-left: 60px; min-height: 46px; justify-content: center; }
  /* Two-up picker row + full-width CTA — no ragged left-aligned chips.
     (.ai-prompt-card prefix outranks the later base .aip-controls rules.) */
  .ai-prompt-card .aip-controls .dropdown { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .ai-prompt-card .aip-controls .dropdown .chip { width: 100%; justify-content: space-between; }
  .ai-prompt-card .aip-find-btn { flex: 1 1 100%; justify-content: center; }
}
.aip-head { display: flex; flex-direction: column; gap: 4px; }
.aip-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-1);
  letter-spacing: -0.005em;
}
.aip-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}
.aip-ask { display: flex; }
/* Compact one-row variant: model picker · text field · Start button. */
.aip-ask-row {
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.aip-ask-row .dropdown { flex: 0 0 auto; }
.aip-ask-row .aip-question { flex: 1 1 200px; min-width: 0; }
.aip-ask-row .aip-find-btn { flex: 0 0 auto; }
.aip-question {
  flex: 1;
  appearance: none;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(var(--wash-rgb), 0.10);
  border-radius: 10px;
  background: rgba(var(--wash-rgb), 0.03);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.aip-question::placeholder { color: var(--grey-2); }
.aip-question:focus {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(var(--wash-rgb), 0.05);
}
/* Size the model chip to match the text field beside it (the faint 26px
   composer chip reads as tiny next to a 40px input) and give it a solid,
   legible fill. */
.aip-ask-row .dropdown .chip {
  height: 40px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
  background: rgba(var(--glass-hi-rgb), 0.9);
  border-color: rgba(var(--wash-rgb), 0.12);
  color: var(--text);
}
.aip-ask-row .dropdown .chip .chip-label { color: var(--text); }
.aip-ask-row .dropdown .chip:hover:not(.open),
.aip-ask-row .dropdown .chip.open {
  background: rgba(var(--dk8-rgb), 0.95);
  border-color: rgba(var(--wash-rgb), 0.18);
}
.aip-status {
  font-size: 12.5px;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(var(--wash-rgb), 0.04);
  color: var(--muted);
}
.aip-status[data-kind="error"] {
  background: rgba(226, 75, 74, 0.12);
  color: var(--red-4);
}

/* The custom-box send button reuses the green primary CTA look from the
   data pages' "Find answer" button. */
.aip-find-btn {
  appearance: none;
  border: 1px solid rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.18);
  color: var(--mint-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  transition: background 0.15s ease, filter 0.15s ease;
}
.aip-find-btn:hover:not([disabled]) {
  background: rgba(99, 102, 241, 0.28);
  filter: brightness(1.05);
}

/* ── Dropdown / chip / menu base (copied from css/chat.css) ──────
   The model picker is built by chat-models.js and styled by these
   component rules, which live in css/chat.css — a file the /content/
   page doesn't load. Copied here (not the whole chat.css) so the picker
   renders identically to the data pages. The .aip-controls .dropdown
   .chip overrides above sit on top of these. */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.dropdown { position: relative; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  background: rgba(var(--dk1-rgb),0.22);
  border: 1px solid rgba(var(--wash-rgb), 0.03);
  border-radius: 8px;
  color: rgba(var(--grey-rgb),0.42);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
  backdrop-filter: blur(6px);
}
.chip:hover,
.chip.open {
  background: rgba(var(--dk1-rgb),0.55);
  border-color: rgba(var(--wash-rgb), 0.1);
  color: var(--text);
}
.chip:hover:not(.open) { transform: translateY(-1px); }
.chip .chip-icon { opacity: 0.7; display: inline-flex; width: 12px; height: 12px; }
.chip .chip-icon svg { width: 12px; height: 12px; }
.chip .chip-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: inherit;
}
.chip .chev {
  opacity: 0.45;
  display: inline-flex;
  transition: transform 0.2s ease;
  margin-left: 1px;
}
.chip .chev svg { width: 10px; height: 10px; }
.chip.open .chev { transform: rotate(180deg); }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  padding: 6px;
  background: linear-gradient(180deg, rgba(var(--glass-hi-rgb),0.95), rgba(var(--glass-lo-rgb),0.95));
  border: 1px solid rgba(var(--wash-rgb), 0.08);
  border-radius: 12px;
  box-shadow:
    0 20px 40px -12px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(var(--wash-rgb), 0.04);
  backdrop-filter: blur(14px);
  z-index: 10;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-4);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.menu-item:hover { background: rgba(var(--wash-rgb), 0.05); color: var(--text); }
.menu-item .mi-icon { opacity: 0.7; display: inline-flex; flex-shrink: 0; }
.menu-item .mi-label { flex: 1; }
.menu-item .mi-check { opacity: 0; color: var(--accent); display: inline-flex; }
.menu-item.selected .mi-check { opacity: 1; }

/* Model dropdown opens upward and scrolls — the provider list is long
   enough that anchoring it below the chip pushes options off-screen. */
.dropdown[data-dropdown="model"] .menu {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateY(4px);
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--wash-rgb), 0.18) transparent;
}
.dropdown[data-dropdown="model"] .menu::-webkit-scrollbar { width: 4px; }
.dropdown[data-dropdown="model"] .menu::-webkit-scrollbar-track { background: transparent; }
.dropdown[data-dropdown="model"] .menu::-webkit-scrollbar-thumb {
  background: rgba(var(--wash-rgb), 0.18);
  border-radius: 4px;
}
.dropdown[data-dropdown="model"] .menu::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--wash-rgb), 0.28);
}
.dropdown[data-dropdown="model"] .menu.open { transform: translateY(0); }
.dropdown[data-dropdown="model"] .menu-item {
  padding: 6px 9px;
  font-size: 11.5px;
  gap: 8px;
}
.dropdown[data-dropdown="model"] .menu-item .mi-icon svg,
.dropdown[data-dropdown="model"] .menu-item .mi-check svg {
  width: 12px;
  height: 12px;
}

/* Price tooltip on each model row (js/chip-tooltip.js). */
.chip-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  min-width: 140px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(var(--glass-hi-rgb),0.98), rgba(var(--glass-lo-rgb),0.98));
  border: 1px solid rgba(var(--wash-rgb), 0.1);
  border-radius: 8px;
  box-shadow:
    0 12px 28px -10px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(var(--wash-rgb), 0.04);
  backdrop-filter: blur(10px);
  color: var(--text-9);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s ease;
}
.chip-tooltip.visible { opacity: 1; }
.chip-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.chip-tooltip .tt-k { color: var(--grey-1); }
.chip-tooltip .tt-v {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.chip-tooltip .tt-foot {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(var(--wash-rgb), 0.06);
  color: #6f6f78;
  font-size: 10px;
  text-align: center;
}
.chip-tooltip .tt-empty { color: var(--grey-1); }

/* ── One-click content plays (new) ───────────────────────────── */
/* Responsive grid: 2-up on a roomy card, 1-up when narrow. */
.cc-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 720px) {
  .cc-options { grid-template-columns: 1fr; }
}

/* A play is a full-width, left-aligned button: icon chip · label · chevron.
   Reads as "pick this and we'll do it" — the chevron signals it goes
   somewhere (a chat opens). */
.cc-option {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid rgba(var(--wash-rgb), 0.10);
  border-radius: 10px;
  background: rgba(var(--wash-rgb), 0.03);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.cc-option:hover {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.08);
}
.cc-option:focus-visible {
  outline: none;
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* Emoji/icon chip on the left. */
.cc-option-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  border-radius: 8px;
  background: rgba(var(--wash-rgb), 0.05);
}

.cc-option-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cc-option-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-1);
}
.cc-option-sub {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}

/* Small per-option note shown when the data a play needs is missing or
   stale. Sits under the subtitle, inside the option's text column. */
.cc-option-note {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #d9b489; /* amber-ish: advisory, not an error */
}
.cc-option-note a {
  color: var(--mint-2);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
}
.cc-option-note a:hover { text-decoration: underline; }

/* Missing data → the play can't produce content yet: dim it and swap the
   accent hover for a neutral "go fetch it" feel. The whole option routes to
   the fetch page (handled in JS). */
.cc-option[data-state="missing"] { opacity: 0.82; }
.cc-option[data-state="missing"]:hover {
  border-color: rgba(217, 180, 137, 0.45);
  background: rgba(217, 180, 137, 0.06);
}
.cc-option[data-state="missing"] .cc-option-note { color: #e0b483; }
/* Stale data still works — keep the normal accent, just show the note. */

/* Trailing chevron, nudges right on hover. */
.cc-option-chev {
  flex: 0 0 auto;
  color: var(--muted);
  display: inline-flex;
  transition: transform 0.15s ease, color 0.15s ease;
}
.cc-option:hover .cc-option-chev {
  color: var(--mint-2);
  transform: translateX(2px);
}

/* Busy: a content play was clicked. The clicked control swaps its label to
   "Starting content creation…" (in place — same size, so nothing reflows) and
   the rest of the card dims + stops responding while we open the chat. */
.content-create-card.cc-busy .cc-option { pointer-events: none; }
.content-create-card.cc-busy .cc-option:not(.is-starting),
.content-create-card.cc-busy [data-role="cc-custom"] {
  opacity: 0.5;
  transition: opacity 0.15s ease;
}
.cc-option.is-starting {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.08);
}
.cc-option.is-starting .cc-option-label { color: var(--cyan-1); }
.aip-find-btn:disabled { opacity: 0.9; cursor: default; }

/* Quiet divider label above the custom box — "or describe your own". */
.cc-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.cc-divider::before,
.cc-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: rgba(var(--wash-rgb), 0.08);
}

/* ── Autopilot strip (one click → /agents/) ─────────────────────────
   Sits under the create card on /content/. The WHOLE card is a single
   link — exactly one click target, no competing buttons — so the choice
   is just "automate this, or don't". The strategy / count / pace are
   chosen on /agents/, not here. */
.content-autopilot-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(124, 226, 159, 0.22);
  background:
    linear-gradient(180deg, rgba(99, 102, 241, 0.05), rgba(99, 102, 241, 0.02));
  transition: border-color 0.15s ease, background 0.15s ease;
}
.content-autopilot-card:hover {
  border-color: rgba(124, 226, 159, 0.5);
  background:
    linear-gradient(180deg, rgba(99, 102, 241, 0.09), rgba(99, 102, 241, 0.04));
}
.content-autopilot-card .cap-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--cyan-1);
  background: rgba(99, 102, 241, 0.12);
}
.content-autopilot-card .cap-text { flex: 1 1 auto; min-width: 0; }
.content-autopilot-card .cap-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
}
.content-autopilot-card .cap-sub {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}
.content-autopilot-card .cap-go {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan-1);
}
@media (max-width: 640px) {
  .content-autopilot-card { flex-wrap: wrap; }
  .content-autopilot-card .cap-go { margin-left: 52px; }
}

/* ── "Keywords worth writing about" highlight ─────────────────────
   Shown only for a confirmed keyword-thin in-focus domain (see
   content-ai-card.js renderKeywordNudge). Leads the page and reuses
   the house accent so it reads as a helpful next step, not a paywall. */
.need-keywords-card[hidden] { display: none; }
.need-keywords-card {
  padding: 20px 22px;
  margin-bottom: 14px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background:
    linear-gradient(180deg, rgba(99, 102, 241, 0.07), rgba(99, 102, 241, 0.02));
}
.nk-inner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.nk-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.10);
  border: 1px solid rgba(99, 102, 241, 0.28);
}
.nk-body { flex: 1 1 auto; min-width: 0; }
.nk-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.nk-sub {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.nk-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.nk-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.nk-btn-primary {
  background: var(--accent);
  color: var(--mint-bg2);
}
.nk-btn-primary:hover { filter: brightness(1.06); }
.nk-btn-ghost {
  background: transparent;
  color: var(--text-1);
  border-color: var(--line);
}
.nk-btn-ghost:hover { border-color: rgba(99, 102, 241, 0.45); }
.nk-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted-2);
}
@media (max-width: 560px) {
  .nk-inner { flex-direction: column; gap: 10px; }
}

/* ── "Ideas for your site" starter content plan ───────────────────
   The new-user on-ramp: plain-language article ideas + one-click
   "Write it". Reuses the accent card frame + .nk-icon/.nk-title/
   .nk-sub/.nk-btn from the block above. */
.content-plan-card[hidden] { display: none; }
.content-plan-card {
  padding: 20px 22px 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background:
    linear-gradient(180deg, rgba(99, 102, 241, 0.07), rgba(99, 102, 241, 0.02));
}
.cp-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.cp-head > div { min-width: 0; }
.cp-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cp-idea {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}
.cp-idea-body { flex: 1 1 auto; min-width: 0; }
.cp-idea-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}
.cp-idea-reason {
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.cp-write { flex: 0 0 auto; }
.cp-levelup {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.cp-levelup a, .cp-autopilot a { color: var(--accent); text-decoration: none; }
.cp-levelup a:hover, .cp-autopilot a:hover { text-decoration: underline; }
.cp-autopilot {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
}
.cp-status {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.cp-status[data-kind="error"] { color: var(--gold, #e0b483); }
@media (max-width: 560px) {
  .cp-head { flex-direction: column; gap: 10px; }
  .cp-idea { flex-direction: column; align-items: stretch; }
  .cp-write { align-self: flex-start; }
}
