/* ============================================
   DALAI IMPEX CHATBOT - PRODUCTION STYLES
   Matched to Website Color Palette
   ============================================ */

/* === COLOR PALETTE - MATCHED TO WEBSITE === */
:root {
  --primary-green: #609966;
  --dark-green: #40513B;
  --cream: #EDF1D6;
  --light-green: #9DC08B;
  --accent-gold: #eddea6;
  --shadow: rgba(64, 81, 59, 0.15);
  --shadow-strong: rgba(64, 81, 59, 0.3);
  --text-dark: #40513B;
  --text-muted: #6E7F68;
}

/* === FLOATING HELP TEXT === */
#chatbot-help-text {
  position: fixed;
  bottom: 105px;
  right: 25px;
  background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
  color: white;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 15px var(--shadow-strong);
  z-index: 9997;
  animation: floatHelpText 3s ease-in-out infinite;
  cursor: pointer;
}

#chatbot-help-text::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 25px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--dark-green);
}

@keyframes floatHelpText {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* Hide help text when chat is open */
#chatbot-window.active~#chatbot-help-text,
.chatbot-open #chatbot-help-text {
  display: none;
}

/* === FLOATING CHAT BUTTON === */
#chatbot-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 65px;
  height: 65px;
  background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 8px 25px var(--shadow-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 3px solid var(--cream);
  animation: pulseButton 2.5s ease-in-out infinite;
}

#chatbot-button:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 35px var(--shadow-strong);
  animation: none;
}

#chatbot-button svg {
  width: 32px;
  height: 32px;
  fill: var(--cream);
  transition: all 0.3s ease;
}

#chatbot-button:hover svg {
  transform: scale(1.1);
}

@keyframes pulseButton {

  0%,
  100% {
    box-shadow: 0 8px 25px var(--shadow-strong), 0 0 0 0 rgba(96, 153, 102, 0.5);
  }

  50% {
    box-shadow: 0 8px 25px var(--shadow-strong), 0 0 0 15px rgba(96, 153, 102, 0);
  }
}

/* === NOTIFICATION BADGE === */
#chatbot-notification {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--cream);
  animation: bounce 0.5s ease;
}

@keyframes bounce {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }
}

/* === CHAT WINDOW === */
#chatbot-window {
  position: fixed;
  bottom: 110px;
  right: 30px;
  width: 400px;
  height: 600px;
  background: var(--cream);
  border-radius: 20px;
  box-shadow: 0 20px 60px var(--shadow-strong);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  border: 2px solid var(--primary-green);
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* Crisp text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

#chatbot-window.active {
  display: flex;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* === CHAT HEADER === */
#chatbot-header {
  background: linear-gradient(135deg, var(--dark-green), var(--primary-green));
  color: var(--cream);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--primary-green);
  position: relative;
  overflow: hidden;
}

#chatbot-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
  animation: shimmer 5s linear infinite;
}

@keyframes shimmer {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#chatbot-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

#chatbot-avatar {
  width: 45px;
  height: 45px;
  background: var(--cream);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 2px solid var(--accent-gold);
}

#chatbot-title {
  display: flex;
  flex-direction: column;
}

/* FIXED: Header text visibility - using cream color */
#chatbot-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 450;
  letter-spacing: 0.5px;
  color: var(--cream) !important;
}

#chatbot-title p {
  margin: 0;
  font-size: 13px;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--cream) !important;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

#chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--cream);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

#chatbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* === MESSAGES CONTAINER === */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: linear-gradient(180deg, var(--cream) 0%, #ffffff 100%);
}

#chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--light-green);
  border-radius: 3px;
}

/* === CHAT MESSAGES === */
.chat-message {
  margin-bottom: 15px;
  animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  display: flex;
  justify-content: flex-end;
}

.user-message .message-content {
  background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
  color: white;
  padding: 12px 18px;
  border-radius: 20px 20px 5px 20px;
  max-width: 80%;
  box-shadow: 0 4px 15px var(--shadow);
}

.bot-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.bot-message .message-content {
  background: white;
  color: var(--text-dark);
  padding: 15px 18px;
  border-radius: 20px 20px 20px 5px;
  max-width: 90%;
  box-shadow: 0 4px 15px var(--shadow);
  border: 1px solid rgba(96, 153, 102, 0.2);
  line-height: 1.6;
}

.bot-message .message-content strong {
  color: var(--dark-green);
  font-weight: 500;
}

.bot-message .message-content a {
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 500;
}

.bot-message .message-content a:hover {
  text-decoration: underline;
}

/* === QUICK REPLY BUTTONS === */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-left: 5px;
}

.quick-reply-btn {
  background: linear-gradient(135deg, var(--cream), white);
  color: var(--dark-green);
  border: 2px solid var(--primary-green);
  padding: 10px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  font-family: inherit;
}

.quick-reply-btn:hover {
  background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--shadow);
}

/* === PRODUCT CARD === */
.product-card {
  background: linear-gradient(135deg, #f8faf7, white);
  border: 2px solid var(--light-green);
  border-radius: 15px;
  padding: 18px;
  margin: 10px 0;
  box-shadow: 0 4px 15px var(--shadow);
  /* Fix text smudging */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.product-card h3 {
  margin: 0 0 12px 0;
  color: var(--dark-green);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.product-card p {
  margin: 6px 0;
  font-size: 13px;
  color: var(--text-dark);
  line-height: 1.5;
  font-weight: 400;
}

.product-card p strong {
  font-weight: 500;
}

.product-card a {
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 500;
}

.product-card a:hover {
  text-decoration: underline;
}

/* === QUOTE SUCCESS === */
.quote-success {
  background: linear-gradient(135deg, #f0fdf4, white);
  border: 2px solid #22c55e;
  border-radius: 15px;
  padding: 18px;
  margin: 10px 0;
}

/* === TYPING INDICATOR === */
.typing-dots {
  display: flex;
  gap: 5px;
  padding: 15px 20px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 15px var(--shadow);
}

.typing-dots span {
  width: 10px;
  height: 10px;
  background: var(--primary-green);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-8px);
  }
}

/* === CHAT INPUT === */
#chatbot-input-container {
  padding: 15px 20px;
  background: white;
  border-top: 2px solid var(--shadow);
  display: flex;
  gap: 10px;
  align-items: center;
}

#chatbot-input {
  flex: 1;
  border: 2px solid var(--shadow);
  border-radius: 25px;
  padding: 12px 18px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
  background: var(--cream);
  color: var(--dark-green);
  font-family: inherit;
}

#chatbot-input:focus {
  border-color: var(--primary-green);
  background: white;
  box-shadow: 0 0 0 3px rgba(96, 153, 102, 0.1);
}

#chatbot-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

#chatbot-send {
  background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
  border: none;
  color: var(--cream);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#chatbot-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px var(--shadow-strong);
}

#chatbot-send svg {
  width: 20px;
  height: 20px;
  fill: var(--cream);
}

/* === BRANDED FOOTER === */
.chatbot-footer {
  padding: 10px 20px;
  background: var(--cream);
  border-top: 1px solid var(--shadow);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.chatbot-footer a {
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.chatbot-footer a:hover {
  color: var(--dark-green);
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 480px) {
  #chatbot-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 120px);
    right: 10px;
    bottom: 100px;
    border-radius: 15px;
  }

  #chatbot-button {
    width: 55px;
    height: 55px;
    right: 15px;
    bottom: 20px;
  }

  #chatbot-help-text {
    right: 10px;
    bottom: 85px;
    font-size: 12px;
    padding: 8px 12px;
  }

  .quick-reply-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .product-card {
    padding: 12px;
  }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === PRINT STYLES === */
@media print {

  #chatbot-button,
  #chatbot-window,
  #chatbot-help-text {
    display: none !important;
  }
}