/* Scoped to widget root only - won't affect Webflow */
#lucia-widget-root .app {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

#lucia-widget-root .container {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  border-radius: 24px;
  padding: 48px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 36px;
  color: #1F2937;
  margin-bottom: 12px;
}

.subtitle {
  font-size: 16px;
  color: #6B7280;
}

/* Start Section */
/* Start Section - Shows collapsed widget for testing */
.start-section {
  text-align: center;
  padding: 40px 0;
}

/* Horizontal Pill Widget - Collapsed State */
.widget-collapsed {
  background: white;
  border-radius: 9999px;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.widget-collapsed:hover:not(.connecting-state) {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.widget-collapsed.connecting-state {
  cursor: wait !important;
  pointer-events: none !important;
}

.widget-collapsed:hover .voice-chat-button:not(.connecting) {
  background: #1a3d57;
}

/* Avatar wrapper for collapsed state - needed for online indicator positioning */
.avatar-wrapper-collapsed {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.widget-avatar {
  width: 56px;
  height: 56px;
  min-width: 56px; /* Prevent shrinking */
  min-height: 56px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center; /* Center the face */
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: block;
  flex-shrink: 0;
}

/* Green online indicator */
.online-indicator {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  background: #5CC23E;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 20;
}

.voice-chat-button {
  background: #132F45;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 9999px;
  font-family: 'Work Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: none; /* Prevent button click, parent handles it */
  min-width: 200px; /* Fixed width to accommodate "GIVE IT A TRY" - prevents layout shift */
  white-space: nowrap; /* Prevent text wrapping */
}

.voice-chat-button:hover {
  background: #1a3d57;
}

/* Connecting state - button text changes to "CONNECTING" */
.voice-chat-button.connecting {
  cursor: wait !important;
  pointer-events: none !important;
}

.connecting-dots-inline {
  display: inline-block;
  margin-left: 4px;
}

.connecting-dots-inline .dot {
  display: inline-block;
  animation: dot-pulse 1.4s ease-in-out infinite;
  opacity: 0.4;
}

.connecting-dots-inline .dot:nth-child(1) {
  animation-delay: 0s;
}

.connecting-dots-inline .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.connecting-dots-inline .dot:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* Scoped styles for embedded mode */
#lucia-widget-root .widget-collapsed.connecting-state {
  cursor: wait !important;
  pointer-events: none !important;
}

#lucia-widget-root .voice-chat-button {
  min-width: 200px !important; /* Fixed width to accommodate "GIVE IT A TRY" - prevents layout shift */
  justify-content: center !important; /* Center content */
  white-space: nowrap !important; /* Prevent text wrapping */
}

#lucia-widget-root .voice-chat-button.connecting {
  cursor: wait !important;
  pointer-events: none !important;
}

#lucia-widget-root .connecting-dots-inline {
  display: inline-block !important;
  margin-left: 4px !important;
}

#lucia-widget-root .connecting-dots-inline .dot {
  display: inline-block !important;
  animation: dot-pulse 1.4s ease-in-out infinite !important;
  opacity: 0.4 !important;
}

#lucia-widget-root .connecting-dots-inline .dot:nth-child(1) {
  animation-delay: 0s !important;
}

#lucia-widget-root .connecting-dots-inline .dot:nth-child(2) {
  animation-delay: 0.2s !important;
}

#lucia-widget-root .connecting-dots-inline .dot:nth-child(3) {
  animation-delay: 0.4s !important;
}

.hint {
  margin-top: 16px;
  color: #9CA3AF;
  font-size: 14px;
}

/* Call UI - Expanded Panel */
.call-ui {
  background: #FFFFFF;
  border-radius: 26px;
  width: 284px; /* Match collapsed widget width: 56px avatar + 12px gap + 200px button + 16px padding = 284px */
  padding: 0 10px;
  margin-bottom: 32px;
  box-shadow: 0px 5px 10px #132F4540;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.call-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px 16px;
  margin-bottom: 0;
}

.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 64px;
  height: 64px;
  min-width: 64px; /* Prevent shrinking */
  min-height: 64px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center; /* Center the face */
  border: 3px solid #E9EFF4;
  transition: all 0.3s;
  display: block;
  flex-shrink: 0;
}

.avatar.talking {
  border-color: #6F39E5;
}

.pulse-ring {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border: 3px solid #6F39E5;
  border-radius: 50%;
  animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  display: none; /* Remove oval line over widget */
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.3;
  }
}

.call-info {
  flex: 1;
  min-width: 0; /* Allow text to wrap within flex container */
}

.call-info h3 {
  font-size: 16px;
  color: #132F45;
  margin-bottom: 4px;
  font-weight: 600;
  line-height: 1.2;
}

.call-info .role {
  font-size: 12px;
  color: #132F45;
  font-weight: 400;
  margin: 0;
  line-height: 1.4;
}


#lucia-widget-root .end-btn {
  background: #E5E7EB !important;
  color: #6B7280 !important;
  border: none !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  font-size: 20px !important;
  font-weight: 300 !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
}

#lucia-widget-root .end-btn:hover {
  background: #D1D5DB !important;
  transform: scale(1.05) !important;
}

#lucia-widget-root .end-btn:active {
  background: #D1D5DB !important;
}

#lucia-widget-root .end-btn.active,
#lucia-widget-root .controls .end-btn.active,
#lucia-widget-root .call-ui .end-btn.active,
#lucia-widget-root button.end-btn.active {
  background: #E5E7EB !important;
  color: #6B7280 !important;
}

#lucia-widget-root .end-btn,
#lucia-widget-root .controls .end-btn,
#lucia-widget-root .call-ui .end-btn,
#lucia-widget-root button.end-btn,
div#lucia-widget-root .controls button.end-btn,
div#lucia-widget-root button.end-btn {
  background: #E5E7EB !important;
  color: #6B7280 !important;
  border: none !important;
  box-shadow: none !important;
}

div#lucia-widget-root .controls button.end-btn:hover,
div#lucia-widget-root button.end-btn:hover {
  background: #D1D5DB !important;
  box-shadow: none !important;
}

/* Ensure expanded widget matches collapsed widget width */
#lucia-widget-root .call-ui {
  width: 284px !important; /* Match collapsed widget width */
}

/* Sound wave container - ensure extended width in embedded mode */
#lucia-widget-root .volume-visualizer {
  width: 250px !important; /* Extended container width */
}

/* Sound Wave Visualizer */
.volume-visualizer {
  display: flex;
  gap: 3px;
  justify-content: center;
  align-items: center;
  width: 250px; /* Extended from 197px to fill more of the widget width */
  height: 70px;
  box-sizing: border-box;
  margin: 0 auto 8px auto;
  padding: 27px 20px;
  background: #F5F8FA;
  border-radius: 10px;
}

.vol-bar {
  width: 4px;
  background: transparent linear-gradient(96deg, #A73AFB 0%, #6F39E5 54%, #3833D7 100%);
  border-radius: 2px;
  height: 16px;
  max-height: 31px;
  opacity: 0.3;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

/* User Speaking - Animated gradient bars */
.vol-bar.user-speaking {
  opacity: 1;
  animation: userWave 0.6s ease-in-out infinite;
}

/* Agent Speaking - Animated gradient bars (smoother) */
.vol-bar.agent-speaking {
  opacity: 1;
  animation: agentWave 0.8s ease-in-out infinite;
}

@keyframes userWave {
  0%, 100% { 
    transform: scaleY(0.5); 
    opacity: 0.8;
  }
  50% { 
    transform: scaleY(1.8); 
    opacity: 1;
  }
}

@keyframes agentWave {
  0%, 100% { 
    transform: scaleY(0.6); 
    opacity: 0.7;
  }
  50% { 
    transform: scaleY(1.9); 
    opacity: 1;
  }
}

/* Status text below sound wave */
.status-text {
  text-align: center;
  font-family: Arial, sans-serif;
  font-size: 10px;
  line-height: 11px;
  color: #929DA7;
  margin: 8px 0 16px 0;
  font-weight: normal;
  letter-spacing: 0px;
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 0 16px 20px 16px;
}

.control-btn {
  background: #F3F4F6;
  border: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: #6B7280;
}

.control-btn:hover {
  background: #E5E7EB;
  transform: scale(1.05);
}

.control-btn.active {
  background: #6F39E5;
  border-color: #6F39E5;
  color: white;
}

.control-btn.active svg {
  fill: white;
}

.control-btn svg {
  transition: fill 0.2s ease;
}

.end-btn,
.controls .end-btn,
.call-ui .end-btn,
button.end-btn {
  background: #E5E7EB !important;
  color: #6B7280 !important;
  border: none !important;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  font-weight: 300;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
}

.end-btn:hover,
.controls .end-btn:hover,
.call-ui .end-btn:hover,
button.end-btn:hover {
  background: #D1D5DB !important;
  transform: scale(1.05);
}

.end-btn:active,
.controls .end-btn:active,
.call-ui .end-btn:active,
button.end-btn:active {
  background: #D1D5DB !important;
}

.end-btn.active,
.controls .end-btn.active,
.call-ui .end-btn.active,
button.end-btn.active {
  background: #E5E7EB !important;
  color: #6B7280 !important;
}

/* Logs */
.logs {
  margin-top: 32px;
}

.logs h3 {
  font-size: 16px;
  color: #374151;
  margin-bottom: 12px;
}

.log-entries {
  background: #F9FAFB;
  border-radius: 12px;
  padding: 16px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 13px;
  font-family: 'Courier New', monospace;
}

.log-entry {
  padding: 4px 0;
  line-height: 1.6;
}

.log-entry .timestamp {
  color: #9CA3AF;
  font-weight: 600;
}

.log-entry.success {
  color: #10B981;
}

.log-entry.error {
  color: #EF4444;
}

.log-entry.info {
  color: #3B82F6;
}

.log-entry.warning {
  color: #F59E0B;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 32px 24px;
  }
  
  .header h1 {
    font-size: 28px;
  }
  
  .start-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Widget-specific resets - scoped to widget only */
#lucia-widget-root *,
#lucia-widget-root *::before,
#lucia-widget-root *::after {
  box-sizing: border-box;
}

/* Only style the dev test page, not the widget itself */
#root {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

