/* Escher AI Standalone Chat Widget Styles */
/* All classes prefixed with .escher-chat- to avoid conflicts */

.escher-chat-widget {
  --chat-primary: 174 62% 47%;
  --chat-primary-foreground: 0 0% 100%;
  --chat-background: 220 20% 10%;
  --chat-foreground: 210 20% 98%;
  --chat-muted: 215 20% 20%;
  --chat-muted-foreground: 215 20% 65%;
  --chat-border: 215 20% 25%;
  --chat-accent: 45 93% 47%;
  
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  box-sizing: border-box;
}

.escher-chat-widget *, .escher-chat-widget *::before, .escher-chat-widget *::after {
  box-sizing: border-box;
}

/* Floating Toggle Button */
.escher-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--chat-primary)), hsl(174 62% 40%));
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 99998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
  overflow: hidden;
}

.escher-chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.escher-chat-toggle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.escher-chat-toggle-icon {
  width: 24px;
  height: 24px;
  color: white;
}

.escher-chat-online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border: 2px solid hsl(var(--chat-background));
  border-radius: 50%;
}

/* Chat Panel */
.escher-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 440px;
  height: 600px;
  max-height: 70vh;
  background: hsl(var(--chat-background));
  border: 1px solid hsl(var(--chat-border));
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.95) translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.escher-chat-panel.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Header */
.escher-chat-header {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid hsl(var(--chat-border));
  background: hsl(var(--chat-muted));
}

.escher-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
}

.escher-chat-header-info {
  flex: 1;
}

.escher-chat-header-name {
  font-weight: 600;
  color: hsl(var(--chat-foreground));
  margin: 0;
  font-size: 15px;
}

.escher-chat-header-role {
  font-size: 12px;
  color: hsl(var(--chat-muted-foreground));
  margin: 0;
}

.escher-chat-header-actions {
  display: flex;
  gap: 8px;
}

.escher-chat-header-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: hsl(var(--chat-muted-foreground));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.escher-chat-header-btn:hover {
  background: hsl(var(--chat-border));
  color: hsl(var(--chat-foreground));
}

.escher-chat-header-btn svg {
  width: 18px;
  height: 18px;
}

/* Messages Area */
.escher-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.escher-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.escher-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.escher-chat-messages::-webkit-scrollbar-thumb {
  background: hsl(var(--chat-border));
  border-radius: 3px;
}

/* Welcome Message */
.escher-chat-welcome {
  text-align: center;
  padding: 20px;
}

.escher-chat-welcome-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 12px;
  object-fit: cover;
}

.escher-chat-welcome-title {
  font-size: 16px;
  font-weight: 600;
  color: hsl(var(--chat-foreground));
  margin: 0 0 8px;
}

.escher-chat-welcome-text {
  font-size: 13px;
  color: hsl(var(--chat-muted-foreground));
  margin: 0;
  line-height: 1.6;
}

.escher-chat-welcome-link {
  color: hsl(var(--chat-primary));
  text-decoration: none;
  cursor: pointer;
}

.escher-chat-welcome-link:hover {
  text-decoration: underline;
}

/* Suggested Questions */
.escher-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

.escher-chat-suggestion {
  padding: 8px 14px;
  background: hsl(var(--chat-muted));
  border: 1px solid hsl(var(--chat-border));
  border-radius: 20px;
  font-size: 12px;
  color: hsl(var(--chat-foreground));
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.escher-chat-suggestion:hover {
  background: hsl(var(--chat-border));
  border-color: hsl(var(--chat-primary));
}

/* Message Bubbles */
.escher-chat-message {
  max-width: 85%;
  display: flex;
  flex-direction: column;
}

.escher-chat-message.user {
  align-self: flex-end;
}

.escher-chat-message.assistant {
  align-self: flex-start;
}

.escher-chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.escher-chat-message.user .escher-chat-bubble {
  background: hsl(var(--chat-primary));
  color: hsl(var(--chat-primary-foreground));
  border-bottom-right-radius: 4px;
}

.escher-chat-message.assistant .escher-chat-bubble {
  background: hsl(var(--chat-muted));
  color: hsl(var(--chat-foreground));
  border-bottom-left-radius: 4px;
}

.escher-chat-copy-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: hsl(var(--chat-muted-foreground));
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.escher-chat-bubble:hover .escher-chat-copy-btn {
  opacity: 1;
}

.escher-chat-copy-btn:hover {
  color: hsl(var(--chat-foreground));
}

.escher-chat-copy-btn svg {
  width: 14px;
  height: 14px;
}

/* Loading Indicator */
.escher-chat-loading {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.escher-chat-loading-dot {
  width: 8px;
  height: 8px;
  background: hsl(var(--chat-primary));
  border-radius: 50%;
  animation: escher-chat-bounce 1.4s ease-in-out infinite both;
}

.escher-chat-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.escher-chat-loading-dot:nth-child(2) { animation-delay: -0.16s; }
.escher-chat-loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes escher-chat-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.escher-chat-input-area {
  padding: 16px;
  border-top: 1px solid hsl(var(--chat-border));
  background: hsl(var(--chat-muted));
}

.escher-chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: hsl(var(--chat-background));
  border: 1px solid hsl(var(--chat-border));
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
}

.escher-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: hsl(var(--chat-foreground));
  font-size: 14px;
  outline: none;
  padding: 8px 0;
}

.escher-chat-input::placeholder {
  color: hsl(var(--chat-muted-foreground));
}

.escher-chat-input-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: hsl(var(--chat-muted-foreground));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.escher-chat-input-btn:hover {
  background: hsl(var(--chat-border));
  color: hsl(var(--chat-foreground));
}

.escher-chat-input-btn.send {
  background: hsl(var(--chat-primary));
  color: hsl(var(--chat-primary-foreground));
}

.escher-chat-input-btn.send:hover {
  background: hsl(174 62% 40%);
}

.escher-chat-input-btn.listening {
  background: #ef4444;
  color: white;
}

.escher-chat-input-btn svg {
  width: 18px;
  height: 18px;
}

/* Contact Modal */
.escher-chat-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.escher-chat-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.escher-chat-modal {
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  background: hsl(var(--chat-background));
  border: 1px solid hsl(var(--chat-border));
  border-radius: 16px;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.escher-chat-modal-overlay.open .escher-chat-modal {
  transform: scale(1);
}

.escher-chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid hsl(var(--chat-border));
}

.escher-chat-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: hsl(var(--chat-foreground));
  margin: 0;
}

.escher-chat-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: hsl(var(--chat-muted-foreground));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.escher-chat-modal-close:hover {
  background: hsl(var(--chat-border));
  color: hsl(var(--chat-foreground));
}

.escher-chat-modal-body {
  padding: 20px;
}

/* Contact Form */
.escher-chat-form-group {
  margin-bottom: 16px;
}

.escher-chat-form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--chat-foreground));
  margin-bottom: 6px;
}

.escher-chat-form-input,
.escher-chat-form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: hsl(var(--chat-muted));
  border: 1px solid hsl(var(--chat-border));
  border-radius: 8px;
  color: hsl(var(--chat-foreground));
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.escher-chat-form-input:focus,
.escher-chat-form-textarea:focus {
  border-color: hsl(var(--chat-primary));
}

.escher-chat-form-textarea {
  min-height: 100px;
  resize: vertical;
}

.escher-chat-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.escher-chat-form-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  border: none;
}

.escher-chat-form-btn.primary {
  background: hsl(var(--chat-primary));
  color: hsl(var(--chat-primary-foreground));
}

.escher-chat-form-btn.primary:hover {
  background: hsl(174 62% 40%);
}

.escher-chat-form-btn.secondary {
  background: hsl(var(--chat-muted));
  color: hsl(var(--chat-foreground));
  border: 1px solid hsl(var(--chat-border));
}

.escher-chat-form-btn.secondary:hover {
  background: hsl(var(--chat-border));
}

/* Calendly Embed */
.escher-chat-calendly {
  width: 100%;
  height: 500px;
  border: none;
  border-radius: 8px;
}

/* Responsive */
@media (max-width: 480px) {
  .escher-chat-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
    max-height: none;
    bottom: 16px;
    right: 16px;
  }
  
  .escher-chat-toggle {
    bottom: 16px;
    right: 16px;
  }
}
