/* Chat Widget Styles */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 350px;
  height: 500px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.chat-widget.open {
  display: flex;
}

.chat-widget-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 30px; /* Make it pill-shaped */
  padding: 10px 15px; /* Adjust padding for content */
  display: flex;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: transform 0.3s ease, background-color 0.3s ease;
  min-width: 120px; /* Ensure enough width for content */
  justify-content: space-around;
}

.chat-widget-toggle:hover {
  transform: scale(1.05);
  background-color: #0056b3;
}

.chat-toggle-content {
  display: flex;
  align-items: center;
  gap: 8px; /* Space between avatar and text */
}

.chat-toggle-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
}

.chat-toggle-text {
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
}

.chat-widget-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-widget-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.chat-widget-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-widget-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-avatar-container {
  padding: 16px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
}

.chat-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #667eea;
}

.chat-avatar-video {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #667eea;
}

.chat-status {
  font-size: 12px;
  color: #64748b;
  margin-top: 8px;
}

.chat-conversation {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  max-height: 200px;
}

.chat-message {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.chat-message.user {
  background: #667eea;
  color: white;
  margin-left: 20px;
  text-align: right;
}

.chat-message.assistant {
  background: #f1f5f9;
  color: #334155;
  margin-right: 20px;
}

.chat-input-container {
  padding: 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.chat-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-send-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.chat-send-btn:hover {
  background: #5a67d8;
}

.chat-send-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.chat-controls {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.chat-control-btn {
  background: none;
  border: 1px solid #d1d5db;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.chat-control-btn:hover {
  background: #f8fafc;
  border-color: #667eea;
}

.chat-control-btn.recording {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.chat-control-btn.processing {
  background: #f59e0b;
  color: white;
  border-color: #f59e0b;
}

.chat-clear-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.chat-clear-btn:hover {
  background: #dc2626;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .chat-widget {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    bottom: 20px;
    right: 20px;
    left: 20px;
  }
  
  .chat-widget-toggle {
    bottom: 20px;
    right: 20px;
  }
}

/* Animation for smooth transitions */
.chat-widget {
  animation: slideUp 0.3s ease-out;
}

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

/* Loading spinner */
.chat-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}