/* AI Chat Leads Frontend Styles */

.ai-chat-widget {
  position: fixed;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ai-chat-widget.bottom-right {
  bottom: 20px;
  right: 20px;
}

.ai-chat-widget.bottom-left {
  bottom: 20px;
  left: 20px;
}

.ai-chat-toggle {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #ff6900 0%, #ff6900 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  color: white;
  /* anchor for the ::before icon */
  position: relative;
  padding: 6px;
}

.ai-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}


.ai-chat-toggle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background-image: url('../img/yogi-50.svg');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 50%;
  background-color: transparent;
}

/* Fixed, contained chat window (desktop). Keeps widget anchored bottom-right and prevents
   message content from stretching the entire page. Mobile behavior above still applies. */
.ai-chat-container {
  width: 360px;
  max-width: 90vw;
  height: 520px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.ai-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8f9fa;
}

.message-content {
  word-break: break-word;
  white-space: normal;
  max-width: 75%;
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: 12px;
  /* limit bubble width so messages wrap inside the container */
}

.ai-chat-widget.bottom-left .ai-chat-container {
  right: auto;
  left: 0;
}

.ai-chat-header {
  background: linear-gradient(135deg, #ff6900 0%, #ff6900 100%);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.ai-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.ai-chat-close:hover {
  background-color: #ff6900;
}

.ai-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
}

.ai-message,
.user-message {
  margin-bottom: 15px;
  display: flex;
}

.ai-message {
  justify-content: flex-start;
}

.user-message {
  justify-content: flex-end;
}

.message-content {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
}

.ai-message .message-content {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
  background: linear-gradient(135deg, #ff6900 0%, #ff6900 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-chat-input-area {
  padding: 20px;
  background: white;
  border-top: 1px solid #e9ecef;
}

#ai-chat-question-form {
  display: flex;
  gap: 10px;
}

#ai-chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#ai-chat-input:focus {
  border-color: #ff6900;
}

#ai-chat-send {
  padding: 12px 20px;
  background: linear-gradient(135deg, #ff6900 0%, #ff6900 100%);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.2s;
}

#ai-chat-send:hover {
  transform: translateY(-1px);
}

.ai-chat-response-buttons {
  text-align: center;
  margin-top: 15px;
}

.ai-chat-response-buttons p {
  margin-bottom: 15px;
  font-size: 14px;
  color: #666;
}

.response-btn {
  padding: 10px 25px;
  margin: 0 10px;
  border: 2px solid;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.yes-btn {
  background: #28a745;
  color: white;
  border-color: #28a745;
}

.yes-btn:hover {
  background: #218838;
  border-color: #218838;
}

.no-btn {
  background: transparent;
  color: #dc3545;
  border-color: #dc3545;
}

.no-btn:hover {
  background: #dc3545;
  color: white;
}

.ai-chat-lead-form {
  margin-top: 15px;
}

.ai-chat-lead-form p {
  margin-bottom: 15px;
  font-size: 14px;
  color: #666;
  text-align: center;
}

.ai-chat-lead-form input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.ai-chat-lead-form input:focus {
  border-color: #ff6900;
}

#submit-lead {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.2s;
}

#submit-lead:hover {
  transform: translateY(-1px);
}

.ai-chat-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: #ff6900;
  border-radius: 50%;
  animation: loading 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loading {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .ai-chat-container {
    width: 300px;
    height: 450px;
  }

  .ai-chat-widget.bottom-right {
    right: 10px;
  }

  .ai-chat-widget.bottom-left {
    left: 10px;
  }
}

/* New conversational chat styles */
.ai-chat-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 15px 0;
  padding: 0 20px;
}

.ai-chat-buttons button {
  padding: 12px 20px;
  border: 2px solid;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  background: white;
}

.ai-chat-buttons .yes-btn {
  color: #28a745;
  border-color: #28a745;
}

.ai-chat-buttons .yes-btn:hover {
  background: #28a745;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.ai-chat-buttons .no-btn {
  color: #6c757d;
  border-color: #6c757d;
}

.ai-chat-buttons .no-btn:hover {
  background: #6c757d;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.ai-chat-buttons .contact-btn {
  margin: 5px 0;
}

/* Enhanced input area */
#ai-chat-input-area {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #e9ecef;
  gap: 10px;
}

#ai-chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

#ai-chat-input:focus {
  border-color: #ff6900;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#ai-chat-send {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #ff6900 0%, #ff6900 100%);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#ai-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#ai-chat-send:active {
  transform: scale(0.95);
}

/* Message styling improvements */
.ai-message .message-content {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #333;
  border-radius: 12px 12px 12px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  margin-left: 45px;
}

.ai-message .message-content::before {
  /* small icon next to AI messages */
  content: "";
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background-image: url('../img/yogi-50.svg');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.user-message .message-content {
  background: linear-gradient(135deg, #ff6900 0%, #ff6900 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Typing indicator enhancement */
.loading-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.loading-dots::before {
  /* show small byn icon before typing dots */
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  background-image: url('../img/-50.svg');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: #ff6900;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {

  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Header update */
.ai-chat-header h3::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: middle;
  background-image: url('../img/yogi-50.svg');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

/* Responsive improvements */
@media (max-width: 480px) {
  .ai-chat-buttons {
    padding: 0 15px;
  }

  .ai-chat-buttons button {
    padding: 10px 16px;
    font-size: 13px;
  }

  #ai-chat-input-area {
    padding: 12px 15px;
  }

  #ai-chat-send {
    width: 40px;
    height: 40px;
  }
}

/* Additional button styles for sales flow */
.ai-chat-buttons .continue-btn {
  margin: 5px 0;
  transition: all 0.3s ease;
}

.ai-chat-buttons .continue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Enhanced message styling for business content */
.ai-message .message-content {
  line-height: 1.6;
  white-space: pre-line;
  /* Allows line breaks in messages */
}

/* Special styling for service introduction */
.ai-message .message-content:contains("🚀") {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-left: 4px solid #2196f3;
}

/* Highlight important messages */
.ai-message .message-content:contains("🎉") {
  background: linear-gradient(135deg, #fff3e0 0%, #ffcc02 20%);
  border-left: 4px solid #ff9800;
  font-weight: 600;
}

/* Success message styling */
.ai-message .message-content:contains("consultation") {
  background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
  border-left: 4px solid #4caf50;
}

/* Business-focused animations */
@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.ai-chat-buttons button:hover {
  animation: pulse 0.6s ease-in-out;
}

/* Professional gradient for contact buttons */
.ai-chat-buttons .contact-btn.yes-btn {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  border: none;
}

.ai-chat-buttons .contact-btn.yes-btn:hover {
  background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.ai-chat-buttons .continue-btn.yes-btn {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  color: white;
  border: none;
}

.ai-chat-buttons .continue-btn.yes-btn:hover {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}