/* ============================================================================
   Sales Co-Pilot v2 — floating companion widget (Document Picture-in-Picture)
   Light theme adapted from the "Sales Co-Pilot v2" Claude Design rail.
   Everything is namespaced under .cp so it can render inline inside the dark
   live.html host page without clashing, or inside its own PiP document.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@300;400;500;600;700;800&display=swap');

.cp {
  --cp-accent: #4F6BF6;
  --cp-ink: #19223A;
  --cp-ink-2: #3A4762;
  --cp-muted: #8A93A8;
  --cp-faint: #9AA3B5;
  --cp-card: #F6F8FC;
  --cp-card-border: #EAEEF5;
  --cp-line: #EEF1F6;
  --cp-ok: #1FB87A;
  --cp-ok-ink: #2AA275;
  --cp-warn: #E8962A;
  --cp-warn-ink: #B9772A;
  --cp-danger: #E0413B;

  direction: rtl;
  font-family: 'Assistant', system-ui, Arial, sans-serif;
  color: var(--cp-ink);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: radial-gradient(900px 600px at 18% 12%, #FFFFFF, transparent 60%),
              radial-gradient(800px 700px at 92% 100%, rgba(79,107,246,.07), transparent 55%),
              linear-gradient(140deg, #EEF1F8 0%, #E6EBF4 100%);
  overflow: hidden;
}
.cp *, .cp *::before, .cp *::after { box-sizing: border-box; }

/* keyframes */
@keyframes cpRing  { 0% { transform: scale(.9); opacity: .5; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes cpShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes cpIn    { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: none; } }

/* ---- tab bar (scaffold: one active tab now, room for more) ---- */
.cp-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  padding: 12px 16px 0;
}
.cp-tab {
  font: 600 13px 'Assistant', sans-serif;
  color: var(--cp-muted);
  background: transparent;
  border: 0;
  border-radius: 10px 10px 0 0;
  padding: 9px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.cp-tab.active { color: var(--cp-accent); background: #fff; box-shadow: 0 -2px 10px -6px rgba(24,34,64,.25); }
.cp-tab[disabled] { opacity: .4; cursor: default; }

/* ---- scroll body ---- */
.cp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.cp-body::-webkit-scrollbar { width: 8px; }
.cp-body::-webkit-scrollbar-thumb { background: #d7dce6; border-radius: 999px; }

/* ---- header: name + mood + timer ---- */
.cp-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 14px;
}
.cp-name { font-size: 21px; font-weight: 800; letter-spacing: -.01em; color: var(--cp-ink); line-height: 1.1; }
.cp-mood {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 8px;
  padding: 4px 12px 4px 9px; border-radius: 999px;
  background: rgba(31,184,122,.12); border: 1px solid rgba(31,184,122,.3);
  font-size: 13px; font-weight: 700; color: var(--cp-ok-ink);
}
.cp-mood.warn { background: rgba(232,150,42,.12); border-color: rgba(232,150,42,.3); color: var(--cp-warn-ink); }
.cp-mood.bad  { background: rgba(224,65,59,.12); border-color: rgba(224,65,59,.3); color: var(--cp-danger); }
.cp-mood .cp-pulse { position: relative; width: 7px; height: 7px; }
.cp-mood .cp-pulse i { position: absolute; inset: 0; border-radius: 50%; background: currentColor; }
.cp-mood .cp-pulse i.ring { animation: cpRing 1.9s ease-out infinite; }
.cp-mood .cp-emoji { font-size: 15px; line-height: 1; }
.cp-mood .cp-live { font-size: 11px; font-weight: 600; opacity: .8; }

.cp-timer {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  background: #F3F5F9; padding: 7px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--cp-muted);
  font-variant-numeric: tabular-nums;
}

/* ---- slim stats ---- */
.cp-stats { flex: 0 0 auto; display: flex; gap: 10px; padding: 0 18px 14px; }
.cp-stat { flex: 1; background: var(--cp-card); border: 1px solid var(--cp-card-border); border-radius: 13px; padding: 11px 13px; }
.cp-stat .cp-stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.cp-stat .cp-stat-label { font-size: 12px; font-weight: 600; color: var(--cp-muted); }
.cp-stat .cp-stat-val { font-size: 14px; font-weight: 800; color: var(--cp-ink); }
.cp-bar { height: 5px; border-radius: 999px; background: #E6EAF2; overflow: hidden; }
.cp-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--cp-ok); width: 0; transition: width .4s ease; }
.cp-bar.warn > i { background: var(--cp-warn); }
.cp-stat .cp-stat-hint { font-size: 10.5px; font-weight: 600; color: var(--cp-ok-ink); margin-top: 5px; }
.cp-stat .cp-stat-hint.warn { color: var(--cp-warn-ink); }

.cp-divider { height: 1px; background: var(--cp-line); margin: 0 18px; }

/* ---- call-flow stepper ---- */
.cp-stepper { flex: 0 0 auto; padding: 14px 18px 6px; }
.cp-stepper .cp-section-title { font-size: 12px; font-weight: 700; color: var(--cp-faint); letter-spacing: .02em; margin-bottom: 10px; }
.cp-steps { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12px; font-weight: 700; }
.cp-step { color: var(--cp-faint); display: inline-flex; align-items: center; gap: 4px; }
.cp-step.done { color: var(--cp-ok-ink); }
.cp-step.cur  { color: var(--cp-accent); background: rgba(79,107,246,.12); padding: 3px 10px; border-radius: 999px; }
.cp-step.cur.obj { color: var(--cp-warn-ink); background: rgba(232,150,42,.14); }
.cp-step-arrow { color: #CBD1DD; }
.cp-nextmove { margin-top: 9px; font-size: 13px; font-weight: 600; color: var(--cp-ink-2); }

/* ---- previous-call summary ---- */
.cp-prev { flex: 0 0 auto; padding: 14px 18px 0; }
.cp-prev[hidden] { display: none; }
.cp-prev .cp-prev-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cp-prev .cp-prev-title { font-size: 13px; font-weight: 700; color: #6B7488; }
.cp-prev .cp-prev-body { margin: 0; font-size: 14px; line-height: 1.6; color: #5A6479; font-weight: 500; }

/* ---- suggestion stack ---- */
.cp-stack { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 18px; }
.cp-stack:empty::before {
  content: 'המלצות יופיעו כאן ברגעי מפתח בשיחה';
  color: var(--cp-faint); font-size: 13px; font-style: italic; padding: 8px 2px;
}

/* the focal (newest) card */
.cp-say {
  background: linear-gradient(180deg, #FBFBFF, #F4F5FF);
  border: 1px solid rgba(79,107,246,.28);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 18px 44px -22px rgba(79,107,246,.5);
  animation: cpIn .25s ease;
}
.cp-say .cp-say-rail { height: 4px; background: linear-gradient(90deg, var(--cp-accent), #8B6FF0); background-size: 200% 100%; animation: cpShimmer 3s linear infinite; }
.cp-say .cp-say-in { padding: 14px 16px 15px; }
.cp-say .cp-say-tagrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.cp-say .cp-say-tag {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(79,107,246,.1); color: var(--cp-accent);
  font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px;
}
.cp-say .cp-say-tag.insight { background: rgba(139,111,240,.12); color: #6E54E8; }
.cp-say .cp-say-when { font-size: 11.5px; font-weight: 600; color: var(--cp-faint); }
.cp-say .cp-say-text { margin: 0; font-size: 18px; line-height: 1.45; font-weight: 700; color: var(--cp-ink); }
.cp-say .cp-say-why { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--cp-muted); }

/* older cards in the stack — dimmer, smaller */
.cp-say.cp-prev-say {
  background: #fff; border-color: var(--cp-card-border);
  box-shadow: 0 6px 18px -14px rgba(24,34,64,.3);
  opacity: .72;
}
.cp-say.cp-prev-say .cp-say-rail { display: none; }
.cp-say.cp-prev-say .cp-say-in { padding: 11px 14px 12px; }
.cp-say.cp-prev-say .cp-say-text { font-size: 14.5px; font-weight: 600; color: var(--cp-ink-2); }
.cp-say.cp-prev-say .cp-say-tag { background: #EEF1F6; color: var(--cp-muted); }
.cp-say.cp-prev-say .cp-say-why { display: none; }

/* ---- footer / open-PiP affordance (host page only) ---- */
.cp-fallback-note {
  margin: 10px 18px 16px; padding: 10px 13px; border-radius: 12px;
  background: rgba(232,150,42,.1); border: 1px solid rgba(232,150,42,.3);
  font-size: 12.5px; font-weight: 600; color: var(--cp-warn-ink); line-height: 1.5;
}
.cp-fallback-note[hidden] { display: none; }
