/* ============================================================
   Enhancements — prospect close-o-meter, auto speaker detection,
   settings switches, and smoother live-call motion. Loads last so it
   augments the base panels without editing them.
   ============================================================ */

/* ---- smoother live motion ---- */
.dim-fill { transition: width var(--dur-2) var(--ease), background var(--dur-2) var(--ease); }
.ring { transition: stroke-dashoffset var(--dur-2) var(--ease); }

/* coaching cards fade/slide in only when their content actually changes */
.coach-card.enter { animation: cc-in var(--dur-2) var(--ease) both; }
@keyframes cc-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Prospect close-o-meter ---- */
.close-meter {
  margin-top: var(--s-2);
  padding: var(--s-2) var(--s-3) calc(var(--s-2) + 2px);
  border-radius: var(--r-md);
  background: var(--fill-subtle);
  border: 1px solid var(--hairline);
  box-shadow: 0 1px 0 var(--highlight) inset;
}
.cm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.cm-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em; color: var(--text-2); text-transform: uppercase; }
.cm-temp { font-size: var(--text-xs); font-weight: 800; font-variant-numeric: tabular-nums; }
.cm-track {
  position: relative;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
  box-shadow: 0 1px 2px oklch(0% 0 0 / .08) inset;
}
.cm-fill {
  height: 100%;
  width: 50%;
  border-radius: var(--r-pill);
  background: var(--accent);
  box-shadow: 0 0 14px -2px currentColor;
  transition: width var(--dur-3) var(--ease), background var(--dur-2) linear;
}
.cm-score {
  position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text); text-shadow: 0 1px 2px oklch(100% 0 0 / .55);
}
:root[data-theme="dark"] .cm-score { text-shadow: 0 1px 3px oklch(0% 0 0 / .65); }
.cm-read { margin-top: 7px; font-size: var(--text-xs); color: var(--text-3); line-height: 1.35; }

/* ---- Auto speaker detection ---- */
.spk-auto { position: relative; }
.spk-detected::after {
  content: ""; position: absolute; inset: -2px; border-radius: inherit;
  box-shadow: 0 0 0 2px var(--accent);
  animation: spk-pulse 1.1s var(--ease) infinite;
  pointer-events: none;
}
@keyframes spk-pulse { 0%, 100% { opacity: .3; } 50% { opacity: .95; } }

/* ---- Settings: switches + voice enrollment ---- */
.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--text-sm); color: var(--text-2); padding: 4px 0; }
.switch-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 42px; height: 25px; border-radius: var(--r-pill); flex: none;
  background: var(--surface-2); border: 1px solid var(--hairline);
  position: relative; cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
.switch-row input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px;
  border-radius: 50%; background: #fff; box-shadow: var(--sh-1);
  transition: transform var(--dur-2) var(--spring);
}
.switch-row input[type="checkbox"]:checked { background: var(--accent); border-color: transparent; }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(17px); }
.enroll-row { display: flex; gap: var(--s-2); margin-top: 8px; }
.enroll-status { margin: 4px 0 0; font-size: var(--text-xs); }
.enroll-status.recording { color: var(--danger); font-weight: 600; }

/* ---- Scorecard prospect section ---- */
.sc-close-head { display: flex; align-items: center; justify-content: space-between; }
.sc-close-temp { font-weight: 800; font-size: var(--text-sm); }
.sc-close { display: flex; align-items: center; gap: var(--s-3); margin-top: 8px; }
.sc-close-num { font-family: var(--font-display); font-weight: 700; font-size: var(--text-2xl); line-height: 1; font-variant-numeric: tabular-nums; }
.sc-close-body { flex: 1; min-width: 0; }
.sc-close-bar { height: 12px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; box-shadow: 0 1px 2px oklch(0% 0 0 / .08) inset; }
.sc-close-fill { height: 100%; border-radius: var(--r-pill); transition: width var(--dur-3) var(--ease); }
.sc-close-read { margin-top: 7px; font-size: var(--text-sm); color: var(--text-2); }

/* ---- Tailor the coach: button, slider, demographic chips ---- */
.ch-actions { display: inline-flex; align-items: center; gap: 10px; }
.tailor-btn {
  font: inherit; font-size: var(--text-xs); font-weight: 700; cursor: pointer;
  padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--fill-subtle); color: var(--text-2); border: 1px solid var(--hairline);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.tailor-btn:hover { background: var(--fill); color: var(--text); transform: translateY(-1px); }

.slider { width: 100%; height: 26px; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: 8px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--blue), var(--warn) 55%, var(--accent)); }
.slider::-moz-range-track { height: 8px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--blue), var(--warn) 55%, var(--accent)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; background: var(--card-solid); border: 2px solid var(--accent); box-shadow: var(--sh-2); transition: transform var(--dur-1) var(--spring); }
.slider::-webkit-slider-thumb:active { transform: scale(1.15); }
.slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--card-solid); border: 2px solid var(--accent); box-shadow: var(--sh-2); }
.slider-ends { display: flex; justify-content: space-between; font-size: var(--text-2xs); color: var(--text-3); margin-top: 2px; }
.tailor-note { margin: 6px 0 0; font-size: var(--text-xs); min-height: 1.15em; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-chip {
  font: inherit; font-size: var(--text-sm); cursor: pointer;
  padding: 7px 13px; border-radius: var(--r-pill);
  background: var(--fill-subtle); color: var(--text-2); border: 1px solid var(--hairline);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.demo-chip:hover { background: var(--fill); color: var(--text); }
.demo-chip.selected { background: color-mix(in oklab, var(--accent) 18%, transparent); color: var(--text); border-color: color-mix(in oklab, var(--accent) 45%, transparent); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .dim-fill, .ring, .cm-fill, .sc-close-fill { transition: none; }
  .coach-card.enter { animation: none; }
  .spk-detected::after { animation: none; }
  .switch-row input[type="checkbox"]::after { transition: none; }
}
