/* Smart AI Chatbot Frontend Styles */
.smart-chatbot {
  --primary-color: #4f46e5;
  --text-color: #111827;
  --bg-color: #ffffff;
  --border-color: #e5e7eb;
  --user-message-bg: #e9ecfb;
  --bot-message-bg: #f3f4f6;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --bottom-spacing: 20px;
  --side-spacing: 20px;
  --chatbot-width: 350px;
  --chatbot-height: 500px;

  position: fixed;
  bottom: var(--bottom-spacing);
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue",
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-color);
}

.smart-chatbot-right {
  right: var(--side-spacing);
}

.smart-chatbot-left {
  left: var(--side-spacing);
}

/* Chatbot Button */
.smart-chatbot-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.smart-chatbot-button:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.smart-chatbot-button.hidden {
  display: none;
}

.smart-chatbot-button.has-notification::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  background-color: #ef4444;
  border-radius: 50%;
  border: 2px solid white;
}

/* Chatbot Window */
.smart-chatbot-window {
  position: absolute;
  bottom: 80px;
  width: var(--chatbot-width);
  height: var(--chatbot-height);
  border-radius: 16px;
  background-color: var(--bg-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.smart-chatbot-right .smart-chatbot-window {
  right: 0;
}

.smart-chatbot-left .smart-chatbot-window {
  left: 0;
}

.smart-chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chatbot Header */
.smart-chatbot-header {
  padding: 12px 16px;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.smart-chatbot-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.smart-chatbot-header-actions {
  display: flex;
  gap: 8px;
}

.smart-chatbot-header button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.smart-chatbot-header button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Chatbot Messages */
.smart-chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background-color: #f9fafc;
}

.smart-chatbot-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

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

.smart-chatbot-message.user {
  align-items: flex-end;
}

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

/* Enhanced Message Styling */
.smart-chatbot-message-content {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.smart-chatbot-message.user .smart-chatbot-message-content {
  background-color: var(--primary-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.smart-chatbot-message.bot .smart-chatbot-message-content {
  background-color: #f3f4f6;
  color: var(--text-color);
  border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.smart-chatbot-typing-indicator .typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #aaa;
  display: inline-block;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.6);
  }
  40% {
    transform: scale(1);
  }
}

/* Slider for Suggested Queries */
.smart-chatbot-suggested-queries {
  padding: 10px 16px;
  background-color: #f9fafb;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.smart-chatbot-query-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.smart-chatbot-query-nav-container {
  display: flex;
  gap: 4px;
}

.smart-chatbot-query-slider {
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  scroll-behavior: smooth;
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
  flex-wrap: nowrap;
  flex: 1;
}

.smart-chatbot-query-slider::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.smart-chatbot-suggested-query {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #f3f4f6;
  color: var(--text-color);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  margin-right: 8px;
  white-space: normal;
  max-width: 250px;
  line-height: 1.3;
  flex: 0 0 auto;
}

.smart-chatbot-suggested-query:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.smart-chatbot-suggested-query svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.smart-chatbot-query-nav {
  width: 22px;
  height: 22px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #eee;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
}

.smart-chatbot-query-nav:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.smart-chatbot-query-nav svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* Update the Suggested Queries Popup */
.smart-chatbot-suggested-popup {
  position: absolute;
  bottom: 80px;
  z-index: 9998;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  width: 280px;
  padding: 0;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  overflow: hidden;
  border: 1px solid rgba(229, 231, 235, 0.5);
}

.smart-chatbot-right .smart-chatbot-suggested-popup {
  right: 20px;
}

.smart-chatbot-left .smart-chatbot-suggested-popup {
  left: 20px;
}

.smart-chatbot-suggested-popup.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.smart-chatbot-suggested-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: var(--primary-color);
  color: white;
}

.smart-chatbot-suggested-popup-title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.smart-chatbot-suggested-popup-title svg {
  width: 18px;
  height: 18px;
}

.smart-chatbot-suggested-popup-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.smart-chatbot-suggested-popup-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.smart-chatbot-suggested-popup-queries {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.smart-chatbot-suggested-popup-query {
  background-color: rgba(249, 250, 251, 0.7);
  color: var(--text-color);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(240, 240, 240, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
}

.smart-chatbot-suggested-popup-query:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.smart-chatbot-suggested-popup-query svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.smart-chatbot-suggested-popup-query:hover svg {
  opacity: 1;
}

/* Chatbot Input */
/* Enhanced Input Area */
.smart-chatbot-input {
  display: flex;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-color);
}

.smart-chatbot-input textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  margin-right: 10px;
  resize: none;
  height: 40px;
  overflow: hidden;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  line-height: 1.4;
}

.smart-chatbot-input textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.smart-chatbot-send {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  position: relative;
}

.smart-chatbot-send svg {
  width: 18px;
  height: 18px;
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.smart-chatbot-send:hover {
  background-color: #4338ca;
  transform: scale(1.05);
}

/* Product Recommendations */
.smart-chatbot-products {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
}

.smart-chatbot-product {
  display: flex;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.smart-chatbot-product:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.smart-chatbot-product-image {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}

.smart-chatbot-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.smart-chatbot-product-info {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.smart-chatbot-product-name {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}

.smart-chatbot-product-price {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 13px;
}

.smart-chatbot-product-button {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  text-align: center;
  transition: background-color 0.2s ease;
  align-self: flex-start;
  font-weight: 500;
}

.smart-chatbot-product-button:hover {
  background-color: #4338ca;
  color: white;
}

/* Powered By */
.smart-chatbot-powered-by {
  padding: 6px 12px;
  text-align: center;
  font-size: 11px;
  color: #6b7280;
  background-color: #f9fafb;
  border-top: 1px solid var(--border-color);
}

/* Responsive Styles */
@media (max-width: 480px) {
  .smart-chatbot-window {
    width: calc(100vw - 40px);
    height: 60vh;
    bottom: 70px;
  }

  .smart-chatbot-right {
    right: 10px;
  }

  .smart-chatbot-left {
    left: 10px;
  }

  .smart-chatbot-button {
    width: 50px;
    height: 50px;
  }

  .smart-chatbot-button svg {
    width: 20px;
    height: 20px;
  }

  .smart-chatbot-suggested-popup {
    width: calc(100vw - 40px);
    bottom: 70px;
  }
}
