/* ============================================================
   Voice Intake Widget — standalone embeddable page
   Design tokens mirror public/css/theme.css
   ============================================================ */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ===== TOKENS ===== */
:root {
  --bg:          #0A0F1C;
  --bg-2:        #0F1629;
  --surface:     #141D2E;
  --surface-2:   #1A2540;
  --border:      #1E2D45;
  --teal:        #00D4A4;
  --teal-dim:    rgba(0, 212, 164, 0.12);
  --teal-glow:   rgba(0, 212, 164, 0.25);
  --amber:       #F59E0B;
  --amber-dim:   rgba(245, 158, 11, 0.12);
  --red:         #f87171;
  --red-dim:     rgba(248, 113, 113, 0.12);
  --text:        #E8EDF4;
  --text-2:      #8897B0;
  --text-3:      #536179;
  --ff-head:     'Sora', system-ui, sans-serif;
  --ff-body:     'DM Sans', system-ui, sans-serif;
  --radius:      10px;
  --radius-lg:   16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ===== PAGE SHELL ===== */
.widget-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---- Nav / Header ---- */
.widget-nav {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.widget-nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-head);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.widget-nav-logo svg { color: var(--teal); }
.widget-nav-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--teal-dim);
  border: 1px solid rgba(0,212,164,0.2);
  border-radius: 99px;
  padding: 0.25rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.04em;
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px var(--teal);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---- Layout ---- */
.widget-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 420px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 2rem 3rem;
  gap: 2.5rem;
  align-items: start;
}

/* ---- Left: Info panel ---- */
.widget-info {}
.widget-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.85rem;
}
.widget-info h1 {
  font-family: var(--ff-head);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 1rem;
}
.widget-info p {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 480px;
}

.phase-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.phase-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.3s, background 0.3s;
}
.phase-item.active {
  border-color: var(--teal);
  background: var(--teal-dim);
}
.phase-item.done {
  border-color: rgba(0,212,164,0.2);
  background: rgba(0,212,164,0.05);
}
.phase-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-3);
  transition: background 0.3s, color 0.3s;
}
.phase-item.active .phase-icon { background: var(--teal-dim); color: var(--teal); }
.phase-item.done .phase-icon    { background: rgba(0,212,164,0.15); color: var(--teal); }
.phase-item.done .phase-icon svg { stroke: var(--teal); }
.phase-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.3;
}
.phase-item.active .phase-label { color: var(--text); }
.phase-item.done .phase-label    { color: var(--teal); }

/* ---- Right: Widget card ---- */
.widget-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 1.5rem;
  box-shadow: 0 0 0 1px rgba(0,212,164,0.06), 0 20px 60px rgba(0,0,0,0.4);
}

/* Call header */
.widget-header {
  padding: 1.25rem 1.5rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.widget-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal) 0%, #00a884 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--teal-glow);
  position: relative;
}
.widget-avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(0,212,164,0.3);
  animation: ring 2s ease-in-out infinite;
}
@keyframes ring {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%       { transform: scale(1.08); opacity: 0; }
}
.widget-header-info { flex: 1; min-width: 0; }
.widget-company {
  font-family: var(--ff-head);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.widget-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.1rem;
}
.widget-call-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--teal);
}
.widget-call-status .live-dot { width: 6px; height: 6px; }

/* Waveform bars */
.waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}
.waveform-bar {
  width: 2.5px;
  border-radius: 2px;
  background: var(--teal);
  animation: wave 1s ease-in-out infinite;
  height: 4px;
}
.waveform-bar:nth-child(1)  { animation-delay: 0.00s; }
.waveform-bar:nth-child(2)  { animation-delay: 0.08s; }
.waveform-bar:nth-child(3)  { animation-delay: 0.16s; }
.waveform-bar:nth-child(4)  { animation-delay: 0.24s; }
.waveform-bar:nth-child(5)  { animation-delay: 0.32s; }
.waveform-bar:nth-child(6)  { animation-delay: 0.40s; }
.waveform-bar:nth-child(7)  { animation-delay: 0.48s; }
.waveform-bar:nth-child(8)  { animation-delay: 0.56s; }
.waveform-bar:nth-child(9)  { animation-delay: 0.64s; }
.waveform-bar:nth-child(10) { animation-delay: 0.72s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.4); }
  50%       { transform: scaleY(1.4); }
}

/* Transcript */
.transcript {
  height: 380px;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

.bubble-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.bubble-row.ai    { flex-direction: row; }
.bubble-row.user  { flex-direction: row-reverse; }

.bubble-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
}
.bubble-avatar.ai  { background: var(--teal); }
.bubble-avatar.user{ background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

.bubble-wrap { display: flex; flex-direction: column; gap: 0.2rem; max-width: 80%; }
.bubble-row.user .bubble-wrap { align-items: flex-end; }

.bubble-speaker {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-3);
  padding: 0 0.25rem;
}
.bubble-text {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}
.bubble-row.user .bubble-text {
  background: rgba(0,212,164,0.1);
  border-color: rgba(0,212,164,0.2);
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}
.bubble-row.user .bubble-speaker { text-align: right; }

/* Typing indicator */
.typing-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  animation: slideUp 0.3s ease both;
}
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 0.85rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  animation: bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Input row */
.input-row {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.6rem;
  align-items: center;
  background: var(--bg-2);
}
.input-row input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.6rem 1rem;
  font-family: var(--ff-body);
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.input-row input::placeholder { color: var(--text-3); }
.input-row input:focus { border-color: rgba(0,212,164,0.4); }
.input-row button {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--teal);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
.input-row button:hover  { background: #00b894; transform: scale(1.06); }
.input-row button:active { transform: scale(0.95); }
.input-row button:disabled { background: var(--border); cursor: not-allowed; transform: none; }

/* Booking summary */
.summary-panel {
  padding: 1.5rem;
  animation: slideUp 0.4s cubic-bezier(0.16,1,0.3,1) both;
}
.summary-title {
  font-family: var(--ff-head);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.summary-title svg { color: var(--teal); }
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.summary-field {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.summary-field.full { grid-column: 1 / -1; }
.summary-field-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 0.3rem;
}
.summary-field-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--teal-dim);
  border: 1px solid rgba(0,212,164,0.25);
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--teal);
}
.summary-badge .live-dot { width: 5px; height: 5px; }

.summary-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.btn-primary {
  width: 100%;
  padding: 0.8rem 1.25rem;
  background: var(--teal);
  border: none;
  border-radius: var(--radius);
  font-family: var(--ff-head);
  font-size: 0.88rem;
  font-weight: 700;
  color: #0A0F1C;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  text-align: center;
}
.btn-primary:hover { background: #00b894; transform: translateY(-1px); }
.btn-secondary {
  width: 100%;
  padding: 0.7rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--ff-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: var(--text-3); color: var(--text); }

/* Config panel */
.config-panel {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}
.config-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 0.85rem;
}
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.config-field {}
.config-label {
  font-size: 0.65rem;
  color: var(--text-3);
  margin-bottom: 0.3rem;
}
.config-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-family: var(--ff-body);
  font-size: 0.8rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.config-input:focus { border-color: rgba(0,212,164,0.35); }
.btn-restart {
  margin-top: 1rem;
  width: 100%;
  padding: 0.55rem 1rem;
  background: var(--amber-dim);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius);
  font-family: var(--ff-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--amber);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.btn-restart:hover { background: rgba(245,158,11,0.2); }

/* Back nav */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s;
  margin-top: 0.5rem;
}
.back-link:hover { color: var(--teal); }

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .widget-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .widget-card { position: static; }
  .widget-info { display: none; }
  body > .widget-shell > .widget-nav { padding: 0 1.25rem; }
}
@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-field.full { grid-column: auto; }
}
