/* ========================
   CALLI Voice UI
   Matches CALLI landing page theme tokens
   ======================== */
:root {
  --bg: #F8F5F0;
  --bg-alt: #F0EBE3;
  --surface: #FFFFFF;
  --fg: #1A1A2E;
  --fg-muted: #5C5C7A;
  --accent: #D4A853;
  --accent-dark: #B8923D;
  --border: rgba(26, 26, 46, 0.1);
  --radius: 16px;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --danger: #E05252;
  --success: #4CAF7A;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 20px 40px;
  background: rgba(248, 245, 240, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.5px;
  color: var(--fg);
  text-decoration: none;
}
.nav-back {
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-back:hover { color: var(--fg); }

/* Main layout */
.app-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 120px 24px 60px;
}

.app-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}
.app-subtitle {
  color: var(--fg-muted);
  font-size: 15px;
  margin-bottom: 40px;
}

/* Call panel */
.call-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(26,26,46,0.08);
  overflow: hidden;
  margin-bottom: 24px;
}

.call-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.call-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.call-avatar svg { width: 28px; height: 28px; fill: white; }

.call-info h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}
.call-status {
  font-size: 13px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
}
.status-dot.live { background: var(--success); animation: pulse 2s infinite; }
.status-dot.ended { background: var(--fg-muted); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Trigger button */
.trigger-section {
  padding: 32px;
  text-align: center;
}
.trigger-section p { color: var(--fg-muted); font-size: 14px; margin-bottom: 20px; }

.btn-call {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(212, 168, 83, 0.4);
}
.btn-call:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(212, 168, 83, 0.5);
}
.btn-call:active { transform: translateY(0); }
.btn-call:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-call.ringing {
  animation: ringPulse 1s infinite;
}
@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,168,83,0.6); }
  50% { box-shadow: 0 0 0 12px rgba(212,168,83,0); }
}

/* Transcript */
.transcript-section {
  padding: 0 32px 28px;
}

.transcript-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 14px;
}

#transcript-log {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.transcript-turn {
  display: flex;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}
.transcript-turn.user { flex-direction: row-reverse; }
.transcript-turn.assistant { flex-direction: row; }

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

.turn-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.turn-badge.user { background: var(--fg); color: white; }
.turn-badge.assistant { background: var(--accent); color: white; }

.turn-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-alt);
  color: var(--fg);
}
.turn-bubble.user { background: var(--fg); color: white; }
.turn-bubble.assistant { background: var(--bg-alt); }

.turn-time {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* Controls */
.controls {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.btn-control:hover { border-color: var(--fg); background: var(--bg-alt); }
.btn-control.active { background: var(--fg); color: white; border-color: var(--fg); }
.btn-control.danger { border-color: var(--danger); color: var(--danger); }
.btn-control.danger:hover { background: var(--danger); color: white; }

.control-spacer { flex: 1; }

.lang-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 50px;
  background: var(--bg-alt);
  color: var(--fg-muted);
  font-weight: 600;
}

/* Slot picker */
.slots-panel {
  padding: 24px 32px;
  border-top: 1px solid var(--border);
  display: none;
}
.slots-panel.visible { display: block; }

.slots-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--fg);
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.slot-btn {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.slot-btn:hover { border-color: var(--accent); background: rgba(212,168,83,0.05); }
.slot-btn.selected { border-color: var(--accent); background: rgba(212,168,83,0.1); color: var(--accent-dark); font-weight: 600; }

.btn-confirm-booking {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity 0.2s;
}
.btn-confirm-booking:hover { opacity: 0.85; }
.btn-confirm-booking:disabled { opacity: 0.4; cursor: not-allowed; }

/* Booking confirmed state */
.confirmed-banner {
  padding: 28px 32px;
  background: rgba(76, 175, 122, 0.08);
  border-top: 1px solid rgba(76,175,122,0.2);
  text-align: center;
  display: none;
}
.confirmed-banner.visible { display: block; }
.confirmed-banner h3 { font-family: var(--font-display); font-size: 18px; margin-bottom: 6px; color: var(--success); }
.confirmed-banner p { font-size: 14px; color: var(--fg-muted); }

/* Listening indicator */
.listening-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-muted);
}
.listening-indicator.active { display: flex; }
.listening-bars { display: flex; gap: 3px; align-items: center; }
.listening-bars span {
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
  animation: barBounce 1s infinite;
}
.listening-bars span:nth-child(2) { animation-delay: 0.15s; }
.listening-bars span:nth-child(3) { animation-delay: 0.3s; }
@keyframes barBounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 32px;
  color: var(--fg-muted);
  font-size: 14px;
}