/* ============================================================
   Voice Booking Agent — Widget Styles
   Embedded dark theme matching financial-advisor.co.za
   ============================================================ */

.voice-agent-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', system-ui, sans-serif;
}

/* Floating button */
.voice-agent-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #6fb7b2, #4a9e99);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.voice-agent-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(111, 183, 178, 0.4);
}

.voice-agent-btn.listening {
  background: linear-gradient(135deg, #4a9e99, #2d7a76);
  animation: pulse-ring 1.5s ease-in-out infinite;
}

.voice-agent-btn.connecting {
  background: linear-gradient(135deg, #f59a2a, #d44a3a);
  animation: pulse-ring 1s ease-in-out infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(111, 183, 178, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(111, 183, 178, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 183, 178, 0); }
}

/* Panel */
.voice-agent-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  background: linear-gradient(180deg, #251f1b 0%, #1b1714 100%);
  border-radius: 1.2rem;
  border: 1px solid rgba(244, 236, 223, 0.1);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  overflow: hidden;
  color: #f4ecdf;
}

.voice-agent-panel.open {
  display: flex;
  animation: slideUp 0.3s ease-out;
}

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

/* Header */
.voice-agent-header {
  padding: 1rem 1.2rem;
  background: rgba(67, 59, 52, 0.6);
  border-bottom: 1px solid rgba(244, 236, 223, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.voice-agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6fb7b2, #4a9e99);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #132126;
  flex-shrink: 0;
}

.voice-agent-header-info {
  flex: 1;
}

.voice-agent-header-info h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f4ecdf;
}

.voice-agent-header-info span {
  font-size: 0.78rem;
  color: #9e907f;
}

.voice-agent-close {
  background: none;
  border: none;
  color: #9e907f;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 0.5rem;
  transition: color 0.2s, background 0.2s;
}

.voice-agent-close:hover {
  color: #f4ecdf;
  background: rgba(244, 236, 223, 0.08);
}

/* Transcript area */
.voice-agent-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 200px;
  max-height: 340px;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 236, 223, 0.15) transparent;
}

.voice-agent-msg {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: 0.9rem;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: fadeIn 0.25s ease-out;
}

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

.voice-agent-msg.assistant {
  align-self: flex-start;
  background: rgba(111, 183, 178, 0.15);
  border: 1px solid rgba(111, 183, 178, 0.2);
  color: #cce6e3;
}

.voice-agent-msg.user {
  align-self: flex-end;
  background: rgba(244, 236, 223, 0.1);
  border: 1px solid rgba(244, 236, 223, 0.12);
  color: #f4ecdf;
}

.voice-agent-msg.system {
  align-self: center;
  background: rgba(245, 154, 42, 0.12);
  border: 1px solid rgba(245, 154, 42, 0.2);
  color: #f59a2a;
  font-size: 0.82rem;
  text-align: center;
}

/* Status bar */
.voice-agent-status {
  padding: 0.7rem 1.2rem;
  background: rgba(67, 59, 52, 0.4);
  border-top: 1px solid rgba(244, 236, 223, 0.06);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #9e907f;
}

.voice-agent-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fb7b2;
  flex-shrink: 0;
}

.voice-agent-status-dot.active {
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.voice-agent-status-dot.error { background: #d44a3a; }
.voice-agent-status-dot.connecting { background: #f59a2a; }

/* Booking confirmed banner */
.voice-agent-booking {
  margin: 0.5rem 1.2rem 0.8rem;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, rgba(111, 183, 178, 0.2), rgba(111, 183, 178, 0.08));
  border: 1px solid rgba(111, 183, 178, 0.3);
  border-radius: 0.8rem;
  text-align: center;
  animation: fadeIn 0.3s ease-out;
}

.voice-agent-booking strong {
  color: #6fb7b2;
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.3rem;
}

.voice-agent-booking p {
  margin: 0;
  font-size: 0.82rem;
  color: #d4c7b5;
}

/* Responsive */
@media (max-width: 480px) {
  .voice-agent-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 90px;
  }
  .voice-agent-btn {
    width: 56px;
    height: 56px;
    font-size: 24px;
    bottom: 16px;
    right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .voice-agent-btn,
  .voice-agent-panel.open,
  .voice-agent-msg,
  .voice-agent-status-dot.active,
  .voice-agent-booking {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .voice-agent-btn:hover {
    transform: none;
  }
}