/* ============================================================
   MADNI DATES - AI ROBOT MASCOT & CHATBOT STYLES
   Ultra-Smooth CSS Animations + Luxury Navy & Gold Theme
   ============================================================ */

/* ── Container Floating at Bottom-Right ── */
.madni-mascot-wrapper {
  position: fixed;
  bottom: 95px;
  right: 22px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* children enable pointer events */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Proactive Speech Bubble ── */
.mascot-speech-bubble {
  pointer-events: auto;
  background: #ffffff;
  color: #0d1546;
  border: 1.5px solid #dfb24b;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 14px;
  max-width: 250px;
  font-size: 0.82rem;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(13, 21, 70, 0.16);
  margin-bottom: 8px;
  position: relative;
  cursor: pointer;
  animation: bubblePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mascot-speech-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(223, 178, 75, 0.3);
}
.mascot-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 24px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #dfb24b;
}
.bubble-close-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  margin-left: auto;
}
.bubble-close-btn:hover {
  color: #ef4444;
}

/* ── The Mascot Avatar Button ── */
.mascot-avatar-btn {
  pointer-events: auto;
  position: relative;
  width: 78px;
  height: 82px;
  cursor: pointer;
  filter: drop-shadow(0 10px 20px rgba(13, 21, 70, 0.25));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mascot-avatar-btn:hover {
  transform: scale(1.08) translateY(-4px);
}
.mascot-avatar-btn:active {
  transform: scale(0.95);
}

/* ── Robot Character Animations ── */
.robot-body-group {
  animation: mascotFloat 3.8s ease-in-out infinite;
  transform-origin: center bottom;
}

/* Eye Blinking */
.robot-eye {
  transform-origin: center;
  animation: eyeBlink 4.2s infinite;
}

/* Hover: Happy Smile Eyes */
.mascot-avatar-btn:hover .robot-eye {
  animation: none;
  transform: scaleY(0.2) translateY(2px);
}

/* Antenna Blinking Pulse */
.robot-antenna-led {
  animation: antennaPulse 2.2s infinite ease-in-out;
  transform-origin: center;
}

/* Waving Hand */
.robot-wave-hand {
  transform-origin: 18px 52px;
  animation: waveHand 4.5s ease-in-out infinite;
}
.mascot-avatar-btn:hover .robot-wave-hand {
  animation: waveHand 0.9s ease-in-out infinite;
}

/* Real Dry Fruit in Robot's Hand */
.mascot-fruit-container {
  position: absolute;
  left: -2px;
  top: 36px;
  width: 32px;
  height: 32px;
  z-index: 10;
  cursor: pointer;
  animation: fruitLift 6s ease-in-out infinite;
  transform-origin: center bottom;
}
.mascot-fruit-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  transition: transform 0.25s;
}
.mascot-fruit-container:hover img {
  transform: scale(1.22) rotate(-8deg);
}

/* Sparkles around dry fruit */
.mascot-sparkle {
  position: absolute;
  color: #dfb24b;
  font-size: 11px;
  pointer-events: none;
  opacity: 0;
  animation: sparkleSpin 3.5s ease-in-out infinite;
}
.mascot-sparkle-1 { top: -4px; left: 18px; animation-delay: 0.8s; }
.mascot-sparkle-2 { bottom: -3px; left: -2px; animation-delay: 2.2s; }

/* Notification Status Dot */
.mascot-online-dot {
  position: absolute;
  top: 4px;
  right: 14px;
  width: 13px;
  height: 13px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  animation: dotPulse 2s infinite;
}

/* Celebration Dance (triggered via JS when added to cart) */
.mascot-avatar-btn.celebrating {
  animation: cartBounce 1.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── Keyframes ── */
@keyframes mascotFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(1.5deg); }
}

@keyframes eyeBlink {
  0%, 94%, 100% { transform: scaleY(1); }
  96%, 98% { transform: scaleY(0.08); }
}

@keyframes antennaPulse {
  0%, 100% { opacity: 0.75; filter: drop-shadow(0 0 2px #dfb24b); }
  50% { opacity: 1; filter: drop-shadow(0 0 8px #dfb24b); }
}

@keyframes waveHand {
  0%, 65%, 100% { transform: rotate(0deg); }
  72% { transform: rotate(-24deg); }
  78% { transform: rotate(14deg); }
  84% { transform: rotate(-20deg); }
  90% { transform: rotate(8deg); }
}

@keyframes fruitLift {
  0%, 75%, 100% { transform: translateY(0) scale(1); }
  85% { transform: translateY(-6px) scale(1.14); }
}

@keyframes sparkleSpin {
  0% { transform: scale(0) rotate(0deg); opacity: 0; }
  35% { transform: scale(1.2) rotate(180deg); opacity: 1; }
  70%, 100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

@keyframes bubblePop {
  0% { opacity: 0; transform: scale(0.6) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes cartBounce {
  0% { transform: scale(1); }
  25% { transform: scale(1.25) translateY(-18px) rotate(-12deg); }
  50% { transform: scale(1.1) translateY(-8px) rotate(10deg); }
  75% { transform: scale(1.2) translateY(-14px) rotate(-6deg); }
  100% { transform: scale(1) translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   CHAT WINDOW MODAL
   ═══════════════════════════════════════════════════════════════ */
.mascot-chat-modal {
  pointer-events: auto;
  display: none;
  position: fixed;
  bottom: 100px;
  right: 22px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(13, 21, 70, 0.28), 0 0 0 1px rgba(223, 178, 75, 0.25);
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  animation: chatOpen 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.mascot-chat-modal.is-open {
  display: flex;
}

@keyframes chatOpen {
  from { opacity: 0; transform: translateY(25px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Header */
.mascot-chat-header {
  background: linear-gradient(135deg, #0d1546 0%, #1a2770 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #dfb24b;
}
.mascot-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mascot-chat-header-avatar {
  width: 38px;
  height: 38px;
  background: rgba(223, 178, 75, 0.15);
  border: 1.5px solid #dfb24b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.mascot-chat-header-avatar svg {
  width: 24px;
  height: 24px;
}
.mascot-chat-header-text h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  font-family: Georgia, serif;
}
.mascot-chat-header-text span {
  font-size: 0.72rem;
  color: #dfb24b;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mascot-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
}
.chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Chat Body / Messages Area */
.mascot-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* Message Bubble Styles */
.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  font-size: 0.86rem;
  line-height: 1.45;
  animation: msgFade 0.25s ease both;
}
.chat-msg-bot {
  align-self: flex-start;
}
.chat-msg-bot .chat-msg-content {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.chat-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-msg-user .chat-msg-content {
  background: #0d1546;
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(13, 21, 70, 0.2);
}

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

/* Interactive Product Card in Chat */
.chat-product-card {
  margin-top: 8px;
  background: #ffffff;
  border: 1.5px solid #dfb24b;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(223, 178, 75, 0.12);
}
.chat-product-card img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.chat-product-info {
  flex: 1;
}
.chat-product-info h5 {
  margin: 0 0 3px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0d1546;
}
.chat-product-info .price {
  font-size: 0.8rem;
  font-weight: bold;
  color: #dfb24b;
}
.chat-product-btn {
  background: #dfb24b;
  color: #0d1546;
  border: none;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  text-decoration: none;
}
.chat-product-btn:hover {
  background: #c99b36;
  transform: translateY(-1px);
}

/* Quick Suggestion Chips */
.mascot-quick-chips {
  padding: 8px 14px;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.mascot-quick-chips::-webkit-scrollbar {
  display: none;
}
.chip-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.chip-btn:hover {
  border-color: #dfb24b;
  color: #0d1546;
  background: #fffbeb;
}

/* Typing indicator */
.chat-typing {
  display: inline-flex;
  gap: 4px;
  padding: 6px 10px;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* Chat Input Bar */
.mascot-chat-footer {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-input-field {
  flex: 1;
  border: 1.5px solid #cbd5e1;
  border-radius: 24px;
  padding: 9px 14px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input-field:focus {
  border-color: #dfb24b;
}

/* Voice Mic Button */
.chat-mic-btn {
  background: #f1f5f9;
  border: none;
  color: #475569;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-mic-btn:hover {
  background: #e2e8f0;
  color: #0d1546;
}
.chat-mic-btn.is-recording {
  background: #fee2e2;
  color: #dc2626;
  animation: micPulse 1.2s infinite;
}
@keyframes micPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* Send Button */
.chat-send-btn {
  background: #0d1546;
  border: none;
  color: #dfb24b;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-send-btn:hover {
  background: #1a2770;
  transform: scale(1.06);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE DOCKING FOR MOBILE SCREENS (< 768px)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .madni-mascot-wrapper {
    bottom: 82px;
    right: 14px;
  }
  .mascot-avatar-btn {
    width: 66px;
    height: 70px;
  }
  .mascot-fruit-container {
    width: 26px;
    height: 26px;
    top: 30px;
    left: -2px;
  }
  .mascot-speech-bubble {
    max-width: 220px;
    font-size: 0.76rem;
    padding: 8px 11px;
  }
  .mascot-chat-modal {
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    bottom: 74px;
    height: 76vh;
    max-height: 520px;
    border-radius: 18px;
  }
}
