/* Enhanced styles.css for NeverLeafs Chatbot with Dark Green Theme and RAG indicators */

:root {
  --primary-color: #2d4a2b;  /* Dark forest green */
  --secondary-color: #3d5a3b; /* Slightly lighter forest green */
  --accent-color: #4a6349;    /* Medium forest green */
  --button-green: #5a7759;    /* Button green */
  --text-color: #333;
  --light-bg: #f5f5f5;
  --white: #ffffff;
  --border-color: #e0e0e0;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --hover-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  --border-radius: 12px;
  --font-family: 'Montserrat', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--light-bg);
  color: var(--text-color);
  line-height: 1.6;
}

/* Chat Launcher Styles */
#chat-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 20px;
  max-width: 320px;
  z-index: 1000;
  border: 2px solid var(--primary-color);
  animation: slideIn 0.3s ease-out;
}

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

.launcher-message {
  margin-bottom: 15px;
  font-size: 0.95rem;
  color: var(--text-color);
  line-height: 1.5;
}

.end-message {
  background: linear-gradient(135deg, #f0f4f0, #f8faf8);
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  margin-bottom: 15px;
}

#chat-launcher button {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  width: 100%;
}

#chat-launcher button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

/* Chat Container Styles */
.chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  height: 600px;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  border: 1px solid #ddd;
}

/* Enhanced Chat Header with RAG Indicator */
.chat-header {
  background: var(--primary-color);
  color: var(--white);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.chat-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.back-arrow {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.back-arrow:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* RAG Indicator Styles */
.rag-indicator {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  animation: ragIndicatorSlide 0.3s ease-out;
}

@keyframes ragIndicatorSlide {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.rag-indicator span {
  display: inline-block;
  animation: ragIndicatorPulse 2s infinite;
}

@keyframes ragIndicatorPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Chat Window */
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

.chat-window::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.chat-window::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

/* Message Styles */
.chat-message {
  display: flex;
  margin-bottom: 10px;
}

.user-message {
  justify-content: flex-end;
}

.bot-message {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.user-message .message-bubble {
  background: var(--primary-color);
  color: var(--white);
  border-bottom-right-radius: 6px;
}

.bot-message .message-bubble {
  background: var(--white);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Enhanced Options Container */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-width: 100%;
}

.persistent-options {
  position: sticky;
  bottom: 0;
  background: var(--white);
  padding: 15px;
  border-radius: var(--border-radius);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  margin-top: auto;
}

.option-button {
  background: var(--white);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  padding: 10px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.85rem;
  text-align: center;
}

.option-button:hover {
  background: var(--primary-color);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(45, 74, 43, 0.3);
}

.option-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.persistent-option {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  font-weight: 600;
}

.persistent-option:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

/* Enhanced Product Carousel */
.product-carousel {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 15px;
  margin: 10px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.enhanced-carousel {
  border: 2px solid var(--accent-color);
}

.detailed-enhanced-carousel {
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
  border: 2px solid var(--button-green);
}

.carousel-header {
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text-color);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.carousel-container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.carousel-container::-webkit-scrollbar {
  height: 6px;
}

.carousel-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.carousel-container::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

/* Enhanced Product Cards */
.product-card {
  min-width: 180px;
  background: var(--white);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--hover-shadow);
}

.enhanced-product-card {
  border: 2px solid var(--button-green);
}

.shopify-enhanced-card {
  border: 2px solid var(--button-green);
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
}

.detailed-shopify-card {
  border: 2px solid var(--accent-color);
  background: linear-gradient(135deg, #ffffff, #f8faf8);
  min-width: 200px;
}

.product-image {
  width: 100%;
  height: 120px;
  background: var(--light-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  overflow: hidden;
  position: relative;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.product-info {
  text-align: center;
}

.product-name {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 5px;
  color: var(--text-color);
  line-height: 1.3;
}

.product-price {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.product-specs {
  font-size: 0.75rem;
  color: #666;
  line-height: 1.4;
}

.product-specs div {
  margin: 2px 0;
}

.shop-button {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 6px 12px;
  border-radius: 15px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
  width: 100%;
}

.shop-button:hover {
  background: var(--secondary-color);
  transform: translateY(-1px);
}

.shopify-badge {
  font-size: 0.7rem;
  margin-top: 5px;
  padding: 2px 6px;
  border-radius: 10px;
  display: inline-block;
}

/* Shop Indicator */
.shop-indicator {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--button-green);
  color: var(--white);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  opacity: 0.9;
}

/* Thinking Indicator */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #666;
  font-style: italic;
}

.thinking-dots {
  display: flex;
  gap: 3px;
}

.thinking-dots .dot {
  width: 6px;
  height: 6px;
  background: var(--accent-color);
  border-radius: 50%;
  animation: thinking 1.4s infinite ease-in-out;
}

.thinking-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes thinking {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat Footer */
.chat-footer {
  padding: 15px;
  background: var(--white);
  border-top: 1px solid var(--border-color);
}

.input-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--light-bg);
  border-radius: 25px;
  padding: 8px 15px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.input-container:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(74, 99, 73, 0.1);
}

#chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-color);
  outline: none;
}

#chat-input::placeholder {
  color: #999;
}

.send-icon {
  background: var(--primary-color);
  color: var(--white);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.send-icon:hover {
  background: var(--secondary-color);
  transform: scale(1.05);
}

.send-icon svg {
  width: 18px;
  height: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-container {
    width: 95vw;
    height: 85vh;
    bottom: 10px;
    right: 2.5vw;
  }
  
  #chat-launcher {
    width: 90vw;
    right: 5vw;
    max-width: none;
  }
  
  .product-card {
    min-width: 160px;
  }
  
  .detailed-shopify-card {
    min-width: 180px;
  }
  
  .carousel-container {
    gap: 8px;
  }
  
  .chat-header h1 {
    font-size: 1.1rem;
  }
  
  .rag-indicator span {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
}

@media (max-width: 480px) {
  .chat-container {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  
  #chat-launcher {
    width: 95vw;
    right: 2.5vw;
  }
  
  .product-card {
    min-width: 140px;
  }
  
  .message-bubble {
    max-width: 90%;
    font-size: 0.85rem;
  }
  
  .options-container {
    gap: 6px;
  }
  
  .option-button {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

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

.slide-up {
  animation: slideUp 0.3s ease-out;
}

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

/* Utility Classes */
.text-center { text-align: center; }
.text-small { font-size: 0.8rem; }
.text-muted { color: #666; }
.font-bold { font-weight: 600; }
.mt-small { margin-top: 8px; }
.mb-small { margin-bottom: 8px; }

/* Enhanced Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-product { background: var(--primary-color); color: white; }
.badge-faq { background: var(--accent-color); color: white; }
.badge-shopify { background: var(--button-green); color: white; }
.badge-general { background: var(--secondary-color); color: white; }

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* RAG Indicator Styles */
.rag-indicator {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  animation: ragIndicatorSlide 0.3s ease-out;
}

@keyframes ragIndicatorSlide {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.rag-indicator span {
  display: inline-block;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--primary-color);
  color: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  animation: ragIndicatorPulse 2s infinite;
}

@keyframes ragIndicatorPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Badge styles for different RAG systems */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-product {
  background: var(--primary-color);
  color: white;
}

.badge-faq {
  background: var(--accent-color);
  color: white;
}

.badge-general {
  background: var(--secondary-color);
  color: white;
}

/* Persistent Options Styles */
#persistent-options {
  margin-top: 15px;
}

#persistent-options .options-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#persistent-options .option-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 15px;
  font-weight: 500;
  transition: all 0.3s ease;
}

#persistent-options .option-button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Enhanced chat header with RAG system indicator */
.chat-header {
  position: relative;
}

/* Responsive adjustments for RAG indicator */
@media (max-width: 768px) {
  .rag-indicator span {
    font-size: 0.7rem;
    padding: 3px 8px;
  }
}

@media (max-width: 480px) {
  .rag-indicator {
    top: 95%;
  }
  
  .rag-indicator span {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
}