/* ============================================================
   AUTOMOST — ИИ-помощник «Мостик»
   Floating animated mascot + agent panel + live tool-call cards.
   Original character (geometric, brand-coral) — not a paperclip.
   ============================================================ */

/* ---------- z-index layer map ----------
   launcher 70 · bubble 71 · panel 88 (above expert drawer 81,
   below flow modals 95 so the assistant can open them on top) */

/* ============================================================
   Floating launcher + mascot character
   ============================================================ */
.cp-launcher {
  position: fixed; right: 26px; bottom: 26px; z-index: 70;
  display: flex; align-items: flex-end; flex-direction: column; gap: 12px;
  transition: transform .42s var(--ease);
}
.cp-launcher.lifted { transform: translateY(-84px); } /* clears the compare tray */

.cp-orb {
  position: relative; width: 56px; height: 56px; flex: none;
  border: none; padding: 0; border-radius: 18px;
  background: transparent;
  transition: transform .35s var(--ease);
}
.cp-orb:hover { transform: translateY(-2px); }
.cp-orb:active { transform: translateY(0) scale(0.97); }
.cp-orb:hover .cp-halo { opacity: 0.16; }

/* ---- line-art helper character (light & airy) ---- */
.cp-bot2 {
  display: block; overflow: visible;
  filter: drop-shadow(0 6px 14px oklch(0.45 0.03 283 / 0.12)) drop-shadow(0 1px 2px oklch(0.45 0.03 283 / 0.08));
  animation: cpFloat 4.6s var(--ease) infinite;
}
.cp-halo { fill: var(--accent); opacity: 0.07; filter: blur(3px); transition: opacity .35s var(--ease); }
.cp-head2 { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; }
.cp-antenna2 { stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.cp-spark { fill: var(--trust); transform-box: fill-box; transform-origin: center; animation: cpSparkPulse 2.6s var(--ease) infinite; }
.cp-eye2 { fill: var(--ink); }
.cp-eyes2 { transform-box: fill-box; transform-origin: center; animation: cpBlink2 5.4s var(--ease) infinite; }
.cp-smile { stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; fill: none; opacity: 0.65; }

/* ---- moods (kept subtle — a calm assistant, never loud) ---- */
.cp-bot2.thinking { animation-duration: 2.8s; }
.cp-bot2.thinking .cp-eyes2 { animation: cpLook2 1.6s var(--ease) infinite; }
.cp-bot2.thinking .cp-spark { fill: var(--gold); animation-duration: 0.95s; }
.cp-bot2.working .cp-spark { fill: var(--accent); animation-duration: 0.6s; }
.cp-bot2.happy .cp-eyes2 { animation: none; transform: scaleY(0.42); }
.cp-bot2.happy .cp-smile { opacity: 1; stroke-width: 1.7; }

/* speech-bubble teaser */
.cp-bubble {
  position: relative; max-width: 230px; padding: 12px 15px 13px; border-radius: 16px 16px 4px 16px;
  background: var(--surface); color: var(--ink); box-shadow: var(--sh-3);
  border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; line-height: 1.4;
  animation: cpBubbleIn .5s var(--ease) both; transform-origin: bottom right;
}
.cp-bubble-close {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-1);
}
.cp-bubble-q { margin-top: 9px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.cp-bubble-q button {
  text-align: left; font-size: 12.5px; font-weight: 700; color: var(--accent-ink);
  background: var(--accent-softer); border-radius: 8px; padding: 8px 10px; line-height: 1.25;
  transition: background .16s var(--ease);
}
.cp-bubble-q button:hover { background: var(--accent-soft); }

/* ============================================================
   Panel
   ============================================================ */
.cp-panel {
  position: fixed; right: 26px; bottom: 26px; z-index: 88;
  width: min(420px, calc(100vw - 32px)); height: min(680px, calc(100vh - 52px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); border-radius: 20px; border: 1px solid var(--line);
  box-shadow: 0 32px 70px oklch(0.28 0.04 283 / 0.34), 0 4px 12px oklch(0.3 0.03 283 / 0.16);
  animation: cpPanelIn .42s var(--ease) both; transform-origin: bottom right;
}
@media (max-width: 480px) {
  .cp-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
}

.cp-head {
  position: relative; flex: none; padding: 15px 16px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--ink); overflow: hidden;
}
.cp-head-row { position: relative; display: flex; align-items: center; gap: 11px; }
.cp-head-av { width: 40px; height: 40px; flex: none; position: relative; }
.cp-head h4 { margin: 0; font-size: 15.5px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink-0); }
.cp-head .cp-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.cp-online-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--trust); box-shadow: 0 0 5px var(--trust); }

.cp-msgs { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.cp-msgs::-webkit-scrollbar { width: 8px; }

/* message rows */
.cp-row { display: flex; gap: 9px; align-items: flex-end; animation: cpFadeUp .34s var(--ease) both; }
.cp-row.me { flex-direction: row-reverse; }
.cp-av { width: 28px; height: 28px; border-radius: 9px; flex: none; position: relative; align-self: flex-end; }
.cp-bubble-msg {
  max-width: 78%; padding: 11px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5;
}
.cp-row.ai .cp-bubble-msg { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.cp-row.me .cp-bubble-msg { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; box-shadow: var(--sh-accent); font-weight: 600; }

/* full-width assistant block (cards / tools / verdicts) */
.cp-block { align-self: stretch; margin-left: 37px; animation: cpFadeUp .34s var(--ease) both; }

/* typing dots */
.cp-typing { display: inline-flex; gap: 4px; padding: 13px 15px; }
.cp-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); animation: cpDot 1.1s var(--ease) infinite; }
.cp-typing span:nth-child(2) { animation-delay: .15s; } .cp-typing span:nth-child(3) { animation-delay: .3s; }

/* ============================================================
   Tool-call card — the visible "agent dragging a DB/code tool"
   ============================================================ */
.cp-tool {
  border-radius: 12px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--sh-1);
}
.cp-tool + .cp-tool { margin-top: 8px; }
.cp-tool-head {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 12px; position: relative;
}
.cp-tool-ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.cp-tool.done .cp-tool-ico { background: var(--trust-soft); color: var(--trust-ink); box-shadow: inset 0 0 0 1px transparent; }
.cp-tool-name { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.cp-tool-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.cp-tool-stat { margin-left: auto; flex: none; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.cp-spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: cpSpin .7s linear infinite; }
.cp-chev { color: var(--ink-4); transition: transform .25s var(--ease); }
.cp-tool.open .cp-chev { transform: rotate(180deg); }

/* running progress bar */
.cp-tool-bar { height: 3px; background: var(--surface-2); overflow: hidden; }
.cp-tool-bar i { display: block; height: 100%; width: 40%; border-radius: 5px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: cpScanBar 1s var(--ease) infinite; }
.cp-tool.done .cp-tool-bar { background: var(--trust-soft); }
.cp-tool.done .cp-tool-bar i { width: 100%; background: var(--trust); animation: none; transition: none; }

/* expandable args / result */
.cp-tool-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 9px; }
.cp-kv { font-family: var(--font-mono); font-size: 11.5px; background: var(--surface-2); border-radius: 8px; padding: 9px 11px; line-height: 1.6; color: var(--ink-2); }
.cp-kv .k { color: var(--accent-ink); }
.cp-kv .v { color: var(--ink-0); font-weight: 600; }
.cp-tool-out { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--trust-ink); }

/* ============================================================
   Result cards (mini listings)
   ============================================================ */
.cp-cards { display: flex; flex-direction: column; gap: 8px; }
.cp-lc {
  display: flex; gap: 11px; align-items: center; padding: 8px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1);
  text-align: left; width: 100%; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
  animation: cpFadeUp .4s var(--ease) both;
}
.cp-lc:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--ink-4); }
.cp-lc-ph { width: 76px; height: 56px; border-radius: 8px; flex: none; object-fit: cover; background: var(--surface-2); }
.cp-lc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cp-lc-title { font-size: 13.5px; font-weight: 700; color: var(--ink-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-lc-price { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink-0); }
.cp-lc-meta { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-lc-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; height: 19px; padding: 0 7px; border-radius: 6px; }

/* verdict / consultation block */
.cp-verdict { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.cp-verdict-head { padding: 13px 15px; display: flex; align-items: center; gap: 11px;
  background: linear-gradient(120deg, var(--trust-soft), var(--surface)); }
.cp-verdict-score { width: 44px; height: 44px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--trust); color: #fff; font-weight: 800; font-size: 18px; }
.cp-verdict-list { padding: 6px 15px 13px; display: flex; flex-direction: column; }
.cp-vrow { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line-2); font-size: 13px; line-height: 1.4; }
.cp-vrow:first-child { border-top: none; }
.cp-vrow-ico { width: 20px; height: 20px; border-radius: 6px; flex: none; display: flex; align-items: center; justify-content: center; margin-top: 1px; }

/* drafted seller message */
.cp-draft { border-radius: 12px; border: 1px dashed var(--accent); background: var(--accent-softer); padding: 12px 14px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.cp-draft-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 6px; display: block; }

/* action buttons under a result */
.cp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-act {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 9px;
  font-size: 13px; font-weight: 700; transition: all .18s var(--ease); white-space: nowrap;
}
.cp-act.primary { background: var(--ink); color: #fff; }
.cp-act.primary:hover { background: oklch(0.3 0.07 280); transform: translateY(-1px); }
.cp-act.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.cp-act.ghost:hover { box-shadow: inset 0 0 0 1px var(--ink-4); }
.cp-act svg { width: 15px; height: 15px; }

/* ============================================================
   Suggestion chips + composer
   ============================================================ */
.cp-suggs { flex: none; padding: 6px 14px 10px; display: flex; flex-wrap: wrap; gap: 7px; }
.cp-sugg {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  transition: all .16s var(--ease); text-align: left; line-height: 1.2;
}
.cp-sugg:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-softer); transform: translateY(-1px); }
.cp-sugg svg { width: 14px; height: 14px; color: var(--accent); flex: none; }

.cp-composer { flex: none; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); display: flex; gap: 8px; align-items: flex-end; }
.cp-input {
  flex: 1; resize: none; max-height: 96px; min-height: 44px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); font-size: 14px; color: var(--ink); line-height: 1.4;
  transition: border-color .18s var(--ease);
}
.cp-input:focus { outline: none; border-color: var(--accent); }
.cp-send {
  width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--sh-accent);
  transition: transform .18s var(--ease), background .18s var(--ease);
}
.cp-send:hover { background: var(--accent-press); transform: translateY(-1px); }
.cp-send:disabled { background: var(--line); box-shadow: none; color: var(--ink-4); cursor: default; transform: none; }

.cp-foot-note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: var(--ink-4); padding: 0 0 9px; }

/* ============================================================
   Keyframes
   ============================================================ */
@keyframes cpBob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-4px) rotate(-1.5deg); } }
@keyframes cpFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes cpBlink2 { 0%, 92%, 100% { transform: scaleY(1); } 95%, 97.5% { transform: scaleY(0.12); } }
@keyframes cpSparkPulse { 0%, 100% { opacity: 0.5; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes cpLook2 { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-1.5px); } 70% { transform: translateX(1.5px); } }
@keyframes cpHop { 0% { transform: translateY(0); } 30% { transform: translateY(-9px) scale(1.05); } 60% { transform: translateY(2px) scale(0.97); } 100% { transform: translateY(0); } }
@keyframes cpBlink { 0%, 92%, 100% { height: 15px; } 95%, 97% { height: 2px; } }
@keyframes cpLook { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-2px); } 70% { transform: translateX(2px); } }
@keyframes cpScan { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-10%, -50%); } }
@keyframes cpPulse { 0% { box-shadow: 0 0 0 0 oklch(0.62 0.14 158 / 0.55); } 70% { box-shadow: 0 0 0 9px oklch(0.62 0.14 158 / 0); } 100% { box-shadow: 0 0 0 0 oklch(0.62 0.14 158 / 0); } }
@keyframes cpSpin { to { transform: rotate(360deg); } }
@keyframes cpScanBar { 0% { transform: translateX(-120%); } 100% { transform: translateX(360%); } }
@keyframes cpDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes cpFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cpPanelIn { from { opacity: 0; transform: translateY(24px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes cpBubbleIn { from { opacity: 0; transform: translateY(8px) scale(0.9); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .cp-bot2, .cp-eyes2, .cp-spark, .cp-bot2.thinking .cp-eyes2 { animation: none !important; }
}
