/* AI Chatbot Widget Styles - REBUILT FROM SCRATCH */
#ai-chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Toggle - SUPER SIMPLE */
.chatbot-toggle {
  width: 90px;
  height: 90px;
  cursor: pointer;
}

.chatbot-icon-face {
  width: 90px;
  height: 90px;
  display: block;
  border-radius: 50%;
  border: 3px solid #22d3ee;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.5);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  object-fit: cover;
}

.chatbot-toggle:hover .chatbot-icon-face {
  box-shadow: 0 12px 32px rgba(34, 211, 238, 0.7);
  border-color: #67e8f9;
}

.chatbot-pulse {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid #22d3ee;
  animation: pulse 2s ease-in-out infinite;
  pointer-events: none;
}

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

.chatbot-label {
  position: absolute;
  right: 100px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.95);
  color: #22d3ee;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  border: 1px solid rgba(34, 211, 238, 0.3);
}

.chatbot-toggle:hover .chatbot-label {
  opacity: 1;
}

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(34, 211, 238, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
  z-index: 999999;
  overscroll-behavior: contain;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chatbot-window.hidden {
  display: none !important;
}

/* Chat Header */
.chatbot-header {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.3) 0%, rgba(34, 211, 238, 0.1) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 16px;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto !important;
  height: auto;
  min-height: 60px;
}

.chatbot-header-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.chatbot-avatar-container {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.chatbot-avatar {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.3) 0%, rgba(34, 211, 238, 0.2) 100%);
  border: 2px solid #22d3ee;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
  flex-shrink: 0;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-5px);
  }
}

.chatbot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatbot-avatar svg {
  width: 40px;
  height: 40px;
}

.chatbot-status {
  display: none; /* Hide status indicator for cleaner look */
}

.chatbot-status-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

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

.chatbot-status-text {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
}

.chatbot-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0;
  line-height: 1.2;
}

.chatbot-title p {
  font-size: 11px;
  color: #94a3b8;
  margin: 3px 0 0 0;
  line-height: 1.2;
}

.chatbot-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #cbd5e1;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* Messages Area */
.chatbot-messages {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 20px !important;
  display: flex !important;
  flex-direction: column !important;
  background: rgba(15, 23, 42, 0.5) !important;
  scrollbar-width: thin !important;
  scrollbar-color: rgba(34, 211, 238, 0.5) rgba(15, 23, 42, 0.3) !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  min-height: 0 !important;
}

.chatbot-messages::before {
  content: '';
  flex: 1 0 auto;
  min-height: 0;
}

.chatbot-messages::-webkit-scrollbar {
  width: 8px;
  display: block !important;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(34, 211, 238, 0.5);
  border-radius: 4px;
  border: 2px solid rgba(15, 23, 42, 0.5);
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 211, 238, 0.7);
}

/* Message Bubbles */
.chatbot-message {
  display: flex !important;
  gap: 10px !important;
  animation: messageSlideIn 0.3s ease-out;
  margin-bottom: 16px !important;
  flex-shrink: 0 !important;
}

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

.bot-message {
  align-items: flex-start;
}

.user-message {
  align-items: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.bot-message .message-avatar {
  background: rgba(8, 145, 178, 0.2);
  border: 1px solid #22d3ee;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-message .message-avatar {
  background: rgba(34, 211, 238, 0.2);
  border: 1px solid #22d3ee;
  color: #22d3ee;
  font-weight: 600;
  font-size: 14px;
}

.message-avatar svg {
  width: 24px;
  height: 24px;
}

.message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.bot-message .message-content {
  background: rgba(8, 145, 178, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.2);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.user-message .message-content {
  background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  color: #0f172a;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.message-content p {
  margin: 0 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.message-content a {
  color: #22d3ee !important;
  text-decoration: underline !important;
  font-weight: 600;
  transition: color 0.2s ease;
}

.message-content a:hover {
  color: #67e8f9 !important;
}

.bot-message .message-content a {
  color: #22d3ee !important;
}

.user-message .message-content a {
  color: #0f172a !important;
  text-decoration: underline !important;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #22d3ee;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Input Area */
.chatbot-input-area {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px 18px;
  background: rgba(8, 145, 178, 0.05);
  flex: 0 0 auto !important;
  height: auto;
}

.chatbot-suggestions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
}

.chatbot-suggestions::-webkit-scrollbar {
  display: none;
}

.chatbot-suggestions.hidden {
  display: none;
}

.suggestion-chip {
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #22d3ee;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.suggestion-chip:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: #22d3ee;
  transform: translateY(-2px);
}

.chatbot-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 12px 18px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.chatbot-input:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.chatbot-input::placeholder {
  color: #64748b;
}

.chatbot-send-btn {
  background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #0f172a;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.4);
}

.chatbot-send-btn:active {
  transform: scale(0.95);
}

.chatbot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hidden elements - removed from UI */
.chatbot-footer,
.chatbot-footer-row,
.email-transcript-btn,
.contact-link,
.powered-by,
.chatbot-suggestions {
  display: none !important;
}

/* Email Modal */
.chatbot-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999; /* Highest z-index */
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.chatbot-modal.hidden {
  display: none;
}

.chatbot-modal-content {
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.chatbot-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chatbot-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0;
}

.email-transcript-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.email-modal-description {
  font-size: 14px;
  color: #94a3b8;
  margin: 0;
}

.email-input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.email-input:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.email-submit-btn {
  background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.email-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 211, 238, 0.4);
}

.email-submit-btn:active {
  transform: translateY(0);
}

.email-status {
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.email-status.hidden {
  display: none;
}

.email-status.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.email-status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  #ai-chatbot-widget {
    bottom: 16px;
    right: 16px;
  }

  .chatbot-toggle {
    width: 70px;
    height: 70px;
  }

  .chatbot-icon-face {
    width: 70px;
    height: 70px;
    border: 2px solid #22d3ee;
  }

  .chatbot-pulse {
    width: 76px;
    height: 76px;
  }

  .chatbot-label {
    display: none;
  }

  .chatbot-window {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    margin: 0;
    z-index: 999999;
  }
  
  .chatbot-avatar {
    width: 50px;
    height: 50px;
  }

  .message-content {
    max-width: 85%;
  }

  .chatbot-suggestions {
    flex-wrap: nowrap;
  }

  .suggestion-chip {
    font-size: 11px;
    padding: 5px 10px;
  }
}

/* Loading State */
.chatbot-loading {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(34, 211, 238, 0.3);
  border-top-color: #22d3ee;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Voice Assistant Button - Better Design */
.voice-toggle-btn {
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.3);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #22d3ee;
  transition: all 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

.voice-toggle-btn:hover {
  background: rgba(34, 211, 238, 0.1);
  color: #22d3ee;
  transform: scale(1.1);
}

.voice-toggle-btn.active {
  background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  color: #0f172a;
  animation: voice-pulse 2s ease-in-out infinite;
}

.voice-toggle-btn.listening {
  background: #ef4444;
  color: white;
  animation: listening-pulse 1.5s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(34, 211, 238, 0);
  }
}

@keyframes listening-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
}

.voice-toggle-btn svg {
  width: 20px;
  height: 20px;
}

/* Voice status indicator */
.voice-status-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #10b981;
  border: 2px solid rgba(15, 23, 42, 0.98);
  border-radius: 50%;
  display: none;
}

.voice-toggle-btn.active .voice-status-indicator,
.voice-toggle-btn.listening .voice-status-indicator {
  display: block;
  animation: blink 1s ease-in-out infinite;
}

.voice-toggle-btn.listening .voice-status-indicator {
  background: #fbbf24;
}

/* Voice transcript message styles */
.voice-transcript {
  font-style: italic;
  opacity: 0.9;
  border-left: 3px solid #22d3ee;
  padding-left: 8px;
}

.user-message .voice-transcript {
  border-left-color: rgba(15, 23, 42, 0.5);
}

