/* Link assistant. Uses the design tokens and shared components of .aipcf-wrap (settings.css):
   buttons, text links, eyebrow, empty states, segmented control, counts, meter, tags and the
   frosted tool panels are defined there. */

/* == 1. Pick a post ========================================================== */
.aipcf-tool-picker { position: relative; z-index: 20; } /* its dropdown must cover the cards below (backdrop-filter makes each a stacking context) */
.aipcf-picker-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.aipcf-picker-main { flex: 1 1 360px; min-width: 0; }
.aipcf-combo { position: relative; }
.aipcf-combo > .dashicons { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--aipcf-muted); pointer-events: none; }
.aipcf-combo input[type="search"] {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  border: 1px solid #c9ccd1;
  border-radius: 12px;
  font-size: 15px;
  background: #fff;
  box-shadow: none;
}
.aipcf-combo input[type="search"]:focus { border-color: var(--aipcf-accent); box-shadow: var(--aipcf-ring); outline: 2px solid transparent; }
.aipcf-combo-list {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--aipcf-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
}
.aipcf-combo-list [role="option"] { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.aipcf-combo-list [role="option"][aria-selected="true"],
.aipcf-combo-list [role="option"]:hover { background: #fff4e8; }
.aipcf-combo-title { font-weight: 600; color: var(--aipcf-ink); }
.aipcf-combo-meta, .aipcf-combo-empty { color: var(--aipcf-muted); font-size: 12.5px; white-space: nowrap; }
.aipcf-combo-empty { padding: 9px 12px; white-space: normal; }

/* == Layout ================================================================== */
.aipcf-tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }

/* Loading and error states */
.aipcf-pad { padding: 12px 4px; }
.aipcf-skeleton { padding: 18px 20px; margin: 0 0 12px; }
.aipcf-sk { display: block; height: 12px; margin: 10px 0; border-radius: 6px; background: linear-gradient(90deg, #eef0f3 25%, #f7f8fa 50%, #eef0f3 75%); background-size: 200% 100%; animation: aipcf-shimmer 1.2s infinite linear; }
.aipcf-sk-title { width: 55%; height: 16px; }
.aipcf-sk-short { width: 35%; }
@keyframes aipcf-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .aipcf-sk { animation: none; } }

/* == Plan header ============================================================= */
.aipcf-plan-head { margin: 0 0 14px; }
.aipcf-panel > .aipcf-plan-title { margin: 0 0 6px; font-size: 20px; line-height: 1.3; }
.aipcf-plan-meta { margin: 0; color: var(--aipcf-muted); }
.aipcf-plan-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.aipcf-mentioned { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: #fff4e8; color: var(--aipcf-ink); }

/* == Suggestion cards ======================================================== */
.aipcf-links-cards { margin: 0; padding: 0; list-style: none; }
.aipcf-links-card { margin: 0 0 12px; }
.aipcf-card-top { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.aipcf-card-title { min-width: 0; }
.aipcf-card-title h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.aipcf-card-title a { color: var(--aipcf-ink); text-decoration: none; }
.aipcf-card-title a:hover { color: #2271b1; text-decoration: underline; }
.aipcf-card-sub { margin: 4px 0 0; color: var(--aipcf-muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.aipcf-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 0; }
@media (max-width: 782px) { .aipcf-card-grid { grid-template-columns: 1fr; } .aipcf-meter { flex-basis: 90px; } }
.aipcf-suggestion { padding: 12px 14px; border-radius: 10px; background: var(--aipcf-soft); border: 1px solid var(--aipcf-line); }
.aipcf-suggestion.is-done { background: #f3faf6; border-color: #cdebd9; }
.aipcf-suggestion-head { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--aipcf-muted); }
.aipcf-suggestion-head .dashicons { font-size: 16px; width: 16px; height: 16px; color: var(--aipcf-accent-ink); }
.aipcf-quote { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--aipcf-ink); }
.aipcf-quote::before { content: "\201C"; }
.aipcf-quote::after { content: "\201D"; }
.aipcf-quote mark { background: #ffe3bf; color: #1d2327; padding: 1px 3px; border-radius: 4px; font-weight: 600; }
.aipcf-suggestion-note { margin: 0; color: var(--aipcf-muted); font-size: 13px; }
.aipcf-suggestion-note.is-ok { color: var(--aipcf-ok-ink); font-weight: 600; }
.aipcf-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.aipcf-copy-fallback { margin: 10px 0 0; }
.aipcf-copy-fail { margin: 0 0 6px; color: var(--aipcf-bad-ink); font-size: 12.5px; }
.aipcf-orphan { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; margin: 0 0 10px; }
.aipcf-orphan a { font-weight: 600; color: var(--aipcf-ink); text-decoration: none; }
.aipcf-orphan a:hover { color: #2271b1; text-decoration: underline; }

/* == 2. Ask about these suggestions ========================================== */
.aipcf-links-chat { position: sticky; top: 46px; display: flex; flex-direction: column; max-height: calc(100vh - 70px); }
.aipcf-links-chat > h2 { margin: 0 0 12px; }
.aipcf-links-log { list-style: none; margin: 0 0 10px; padding: 0; overflow-y: auto; min-height: 60px; flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; }
.aipcf-bubble { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.aipcf-bubble-user { align-self: flex-end; background: #fff1e0; border-bottom-right-radius: 4px; }
.aipcf-bubble-assistant { align-self: flex-start; background: var(--aipcf-soft); border: 1px solid var(--aipcf-line); border-bottom-left-radius: 4px; }
.aipcf-bubble.is-error { background: #fcf0f1; border-color: #f0c5c6; color: #8a2424; }
.aipcf-typing { display: inline-block; width: 26px; height: 8px; background: radial-gradient(circle, #8c8f94 45%, transparent 50%) 0 0 / 9px 8px repeat-x; animation: aipcf-typing 1s infinite steps(3); }
@keyframes aipcf-typing { from { width: 8px; } to { width: 26px; } }
@media (prefers-reduced-motion: reduce) { .aipcf-typing { animation: none; } }
.aipcf-chat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.aipcf-chat-chip { border: 1px solid var(--aipcf-line); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 12px; color: var(--aipcf-ink); cursor: pointer; }
.aipcf-chat-chip:hover { border-color: var(--aipcf-accent); background: #fff8f0; }
.aipcf-chat-chip:focus-visible,
.aipcf-send:focus-visible { outline: 2px solid transparent; box-shadow: var(--aipcf-ring); }
.aipcf-links-ask { position: relative; margin: 0; }
.aipcf-links-ask textarea { width: 100%; min-height: 64px; padding: 10px 52px 10px 12px; border: 1px solid #c9ccd1; border-radius: 12px; resize: vertical; font-size: 13.5px; box-shadow: none; }
.aipcf-links-ask textarea:focus { border-color: var(--aipcf-accent); box-shadow: var(--aipcf-ring); outline: 2px solid transparent; }
.aipcf-send { position: absolute; right: 8px; bottom: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; background: linear-gradient(135deg, var(--aipcf-accent), var(--aipcf-accent-2)); color: #1d2327; cursor: pointer; }
.aipcf-send:disabled { opacity: .5; cursor: default; }
.aipcf-chat-note { margin: 8px 0 0; font-size: 12px; color: var(--aipcf-muted); }

/* Panels here end with a field or buttons, not a form table: a little more room below. The
   shared padding applies unchanged on small screens. */
@media (min-width: 783px) {
  .aipcf-tool-picker, .aipcf-plan-head { padding-bottom: 20px; }
  .aipcf-links-chat { padding-bottom: 14px; }
}

/* Narrow screens: one column; links.js moves the chat right after the plan header. */
@media (max-width: 1100px) {
  .aipcf-tool-grid { grid-template-columns: 1fr; }
  .aipcf-links-chat { position: static; max-height: none; margin: 0 0 14px; }
  .aipcf-links-log { max-height: 50vh; }
}
