/* Soch Automation Diagnostic — embedded widget styles.
 *
 * Every selector is scoped under #soch-voice-widget so styles cannot leak
 * into the host page (Webflow templates, withsoch.com, etc.). Visibility
 * uses the standard [hidden] attribute rather than a custom class.
 */

#soch-voice-widget,
#soch-voice-widget * {
  box-sizing: border-box;
  font-family: 'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* !important: `#soch-voice-widget .soch-cta { display: flex }` and friends
 * have the same specificity and come later, so they'd otherwise win. */
#soch-voice-widget [hidden] { display: none !important; }

#soch-voice-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  color: #ffffff;
  line-height: 1.4;
}

/* ---------- Collapsed pill ---------- */
#soch-voice-widget .soch-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ea6a47;
  color: #ffffff;
  border: none;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(234, 106, 71, 0.35);
  animation: soch-pulse 2s ease-in-out infinite;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#soch-voice-widget .soch-pill:hover {
  box-shadow: 0 12px 40px rgba(234, 106, 71, 0.55);
}
@keyframes soch-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  #soch-voice-widget .soch-pill { animation: none; }
}

/* ---------- Expanded panel ---------- */
#soch-voice-widget .soch-panel {
  width: 380px;
  height: 580px;
  background: #1a1a1a;
  border: 1px solid #ea6a47;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.8);
  opacity: 0;
  transform-origin: bottom right;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}
#soch-voice-widget .soch-panel.open {
  transform: scale(1);
  opacity: 1;
}
/* Score + email confirmation + booking can be taller than the panel: the
 * middle scrolls while the header and the START/END controls stay put. */
#soch-voice-widget .soch-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
  /* So scrollIntoView clears the sticky header and controls. */
  scroll-padding: 76px 0 104px;
}
#soch-voice-widget .soch-panel > * { flex-shrink: 0; }
#soch-voice-widget .soch-header,
#soch-voice-widget .soch-bottom {
  position: sticky;
  z-index: 1;
  background: #1a1a1a;
}
#soch-voice-widget .soch-header { top: 0; }
#soch-voice-widget .soch-bottom { bottom: 0; }

/* Header */
#soch-voice-widget .soch-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #2a2a2a;
}
#soch-voice-widget .soch-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: #ffffff;
}
#soch-voice-widget .soch-subtitle {
  font-size: 12px;
  color: #ea6a47;
  margin: 2px 0 0;
}
#soch-voice-widget .soch-close {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
#soch-voice-widget .soch-close:hover { color: #fff; }

/* Phase progress */
#soch-voice-widget .soch-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 16px 6px;
}
#soch-voice-widget .soch-dots {
  display: flex;
  gap: 8px;
}
#soch-voice-widget .soch-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #333;
  transition: background 0.3s ease, transform 0.3s ease;
}
#soch-voice-widget .soch-dot.active {
  background: #ea6a47;
  transform: scale(1.2);
}
#soch-voice-widget .soch-phase-label {
  font-size: 11px;
  color: #aaa;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 14px;
}

/* Visualization */
#soch-voice-widget .soch-viz-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px 10px;
}
#soch-voice-widget .soch-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
}
#soch-voice-widget .soch-bar {
  width: 4px;
  height: 4px;
  background: #444;
  border-radius: 2px;
  /* No CSS transition — heights are driven by RAF for smooth, GPU-friendly motion. */
}
#soch-voice-widget .soch-bars.ai .soch-bar { background: #ea6a47; }
#soch-voice-widget .soch-bars.user .soch-bar { background: #777; }
#soch-voice-widget .soch-status {
  font-size: 12px;
  color: #aaa;
  min-height: 16px;
}

/* Transcript */
#soch-voice-widget .soch-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  min-height: 96px;
}
#soch-voice-widget .soch-transcript::-webkit-scrollbar { width: 4px; }
#soch-voice-widget .soch-transcript::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }

#soch-voice-widget .soch-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  word-wrap: break-word;
}
#soch-voice-widget .soch-msg.ai {
  align-self: flex-start;
  background: #2a2a2a;
  color: #f5efe0;
  border-bottom-left-radius: 4px;
}
#soch-voice-widget .soch-msg.user {
  align-self: flex-end;
  background: rgba(234, 106, 71, 0.15);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
#soch-voice-widget .soch-msg.user.untranscribed {
  color: #aaa;
  font-style: italic;
}

/* CTA / Score reveal */
#soch-voice-widget .soch-cta {
  padding: 14px 18px;
  border-top: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#soch-voice-widget .soch-score-ring {
  width: 128px;
  height: 128px;
  position: relative;
}
#soch-voice-widget .soch-score-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}
#soch-voice-widget .soch-score-ring .ring-bg {
  fill: none;
  stroke: #333;
  stroke-width: 8;
}
#soch-voice-widget .soch-score-ring .ring-fg {
  fill: none;
  stroke: #ea6a47;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease;
}
#soch-voice-widget .soch-score-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
}
#soch-voice-widget .soch-score-num span.suffix {
  font-size: 14px;
  font-weight: 400;
  color: #aaa;
  margin-left: 2px;
}
#soch-voice-widget .soch-tier {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ea6a47;
  font-weight: 600;
}
#soch-voice-widget .soch-opps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
#soch-voice-widget .soch-opps li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #f5efe0;
}
#soch-voice-widget .soch-opps li::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #ea6a47;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

/* Bottom bar */
#soch-voice-widget .soch-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 16px;
  border-top: 1px solid #2a2a2a;
}
#soch-voice-widget .soch-iconbtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2a2a2a;
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#soch-voice-widget .soch-iconbtn:hover { background: #333; }
#soch-voice-widget .soch-iconbtn.muted { color: #ea6a47; }

#soch-voice-widget .soch-main-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ea6a47;
  border: none;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(234, 106, 71, 0.35);
  transition: transform 0.15s ease, background 0.2s ease;
}
#soch-voice-widget .soch-main-btn:hover { transform: scale(1.05); }
#soch-voice-widget .soch-main-btn:disabled { opacity: 0.6; cursor: progress; }
#soch-voice-widget .soch-main-btn.active {
  background: #c54a2a;
  animation: soch-pulse 1.6s ease-in-out infinite;
}

#soch-voice-widget .soch-error {
  font-size: 12px;
  color: #ff8a72;
  text-align: center;
  padding: 8px 16px;
}

/* Book-a-call (existing Cal.com 30-min event) */
#soch-voice-widget .soch-booking {
  padding: 10px 18px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#soch-voice-widget .soch-book-btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid #ea6a47;
  color: #ea6a47;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
#soch-voice-widget .soch-book-btn:hover {
  background: #ea6a47;
  color: #ffffff;
}
#soch-voice-widget .soch-booking-note {
  margin: 0;
  font-size: 11px;
  color: #aaa;
  text-align: center;
}

/* Typed email (the bot asks for it here; never by voice) */
#soch-voice-widget .soch-email-form {
  padding: 8px 18px 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#soch-voice-widget .soch-email-label {
  font-size: 12px;
  color: #f5efe0;
}
#soch-voice-widget .soch-email-row {
  display: flex;
  gap: 6px;
}
#soch-voice-widget .soch-email-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #2a2a2a;
  background: #111;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  outline: none;
}
#soch-voice-widget .soch-email-input:focus { border-color: #ea6a47; }
#soch-voice-widget .soch-email-input[aria-invalid="true"] { border-color: #ff8a72; }
#soch-voice-widget .soch-email-submit {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #ea6a47;
  background: transparent;
  color: #ea6a47;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#soch-voice-widget .soch-email-submit:hover {
  background: #ea6a47;
  color: #ffffff;
}
#soch-voice-widget .soch-email-msg {
  margin: 0;
  font-size: 11px;
  color: #aaa;
}
#soch-voice-widget .soch-email-form:has([aria-invalid="true"]) .soch-email-msg { color: #ff8a72; }
#soch-voice-widget .soch-email-submit:focus-visible,
#soch-voice-widget .soch-email-yes:focus-visible,
#soch-voice-widget .soch-email-edit:focus-visible {
  outline: 2px solid #f5efe0;
  outline-offset: 2px;
}

/* Typed email awaiting an explicit "Yes, proceed" */
#soch-voice-widget .soch-email-confirm {
  margin: 8px 18px 2px;
  padding: 10px 12px;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: #111;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#soch-voice-widget .soch-email-confirm-q {
  margin: 0;
  font-size: 12px;
  color: #aaa;
  outline: none;
}
#soch-voice-widget .soch-email-confirm-value {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  overflow-wrap: anywhere;
}
#soch-voice-widget .soch-email-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#soch-voice-widget .soch-email-yes,
#soch-voice-widget .soch-email-edit {
  flex: 1 1 auto;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #ea6a47;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#soch-voice-widget .soch-email-yes { background: #ea6a47; color: #ffffff; }
#soch-voice-widget .soch-email-yes:hover { background: #c54a2a; }
#soch-voice-widget .soch-email-edit { background: transparent; color: #ea6a47; }
#soch-voice-widget .soch-email-edit:hover { background: rgba(234, 106, 71, 0.15); }

/* Mobile */
@media (max-width: 480px) {
  #soch-voice-widget .soch-panel {
    width: 90vw;
    right: 0;
    /* Short phones: keep the bottom controls on screen. */
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
  }
  #soch-voice-widget {
    right: 5vw;
  }
  /* 16px stops iOS Safari zooming the page when the email box is focused. */
  #soch-voice-widget .soch-email-input { font-size: 16px; }
  #soch-voice-widget .soch-email-row { flex-wrap: wrap; }
  #soch-voice-widget .soch-email-submit { flex: 1 1 100%; min-height: 40px; }
  #soch-voice-widget .soch-email-yes,
  #soch-voice-widget .soch-email-edit { min-height: 40px; }
}
