/* ════════════════════════════════════════════════════════
   WARNING: Class names .chat-messages, .chat-input, .chat-input-area
   are ALSO used in orders.css. Avoid loading both on the same page
   without a parent scope wrapper.
   ════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════
   NAGRIVA — AI Chatbot Widget
   chatbot.css
════════════════════════════════════════════════════════ */

.chat-fab-wrapper {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  animation: chatFloat 5s ease-in-out infinite;
}

.chat-fab {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(0, 245, 196, 0.12);
  background: rgba(8, 12, 12, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(0, 245, 196, 0.2), 0 0 60px rgba(0, 245, 196, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  color: #00f5c4;
}

.chat-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 245, 196, 0.2), 0 0 40px rgba(0, 245, 196, 0.08);
  border-color: rgba(0, 245, 196, 0.2);
}

.chat-fab:active {
  transform: scale(0.95);
}

.chat-fab img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-fab.open img {
  transform: rotate(90deg);
}

/* ─── Book a Free Call CTA ─── */
.book-call-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 22px 12px 20px;
  border-radius: 99px;
  background: rgba(8, 8, 12, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 245, 196, 0.02), 0 0 30px rgba(0, 245, 196, 0.03);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  animation: ctaFadeIn 0.6s ease 0.3s both;
}

.book-call-btn:hover {
  border-color: rgba(0, 245, 196, 0.15);
  box-shadow: 0 12px 52px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 245, 196, 0.05), 0 0 40px rgba(0, 245, 196, 0.06);
  color: #fff;
  transform: translateY(-1px);
}

.book-call-btn:active {
  transform: translateY(0);
}

.book-call-btn svg:first-child {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #00f5c4;
}

.book-call-btn .book-call-sparkle {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: rgba(0, 245, 196, 0.5);
}

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

@keyframes chatFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.chat-glow-bg {
  position: fixed;
  bottom: 40px;
  right: 0;
  z-index: 9997;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle at bottom right, rgba(0, 245, 196, 0.07), transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.chat-glow-bg.visible {
  opacity: 1;
}

.chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9998;
  width: 340px;
  height: 500px;
  border-radius: 18px;
  background: rgba(8, 12, 12, 0.94);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(0, 245, 196, 0.1);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 245, 196, 0.05);
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.25s ease;
  overflow: hidden;
}

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

.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00f5c4, #00c2a8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.chat-header-info h4 {
  font-family: 'Syne', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.chat-header-info .chat-status {
  font-size: 0.65rem;
  color: #00f5c4;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.chat-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #00f5c4;
  display: inline-block;
  animation: chatStatusPulse 2s ease-in-out infinite;
}

@keyframes chatStatusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chat-header-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  padding: 0;
}

.chat-header-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 3px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 196, 0.2);
  border-radius: 99px;
}

.message {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.8rem;
  line-height: 1.55;
  animation: chatbot-msg-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  word-wrap: break-word;
}

@keyframes chatbot-msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.typing-cursor {
  display: inline-block;
  width: 1.5px;
  height: 0.9em;
  background: #00f5c4;
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blinkCursor 0.7s step-end infinite;
}

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

.message.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.88);
  border-bottom-left-radius: 4px;
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #00f5c4, #00c2a8);
  color: #040404;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.typing-indicator {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  animation: chatbot-msg-in 0.2s ease;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 245, 196, 0.5);
  animation: typingDot 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); background: #00f5c4; }
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 2px 16px 10px;
  flex-shrink: 0;
}

.quick-btn {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid rgba(0, 245, 196, 0.18);
  background: rgba(0, 245, 196, 0.05);
  color: #00f5c4;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.01em;
}

.quick-btn:hover {
  background: rgba(0, 245, 196, 0.12);
  border-color: rgba(0, 245, 196, 0.35);
  transform: translateY(-1px);
}

.quick-btn:active {
  transform: translateY(0);
  background: rgba(0, 245, 196, 0.18);
}

.chat-input-area {
  padding: 6px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-size: 0.78rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.chat-input:focus {
  border-color: rgba(0, 245, 196, 0.25);
}

.chat-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #00f5c4, #00c2a8);
  color: #040404;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.chat-send:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(0, 245, 196, 0.25);
}

.chat-send:active:not(:disabled) {
  transform: scale(0.95);
}

.chat-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chat-send svg {
  width: 14px;
  height: 14px;
}

.chat-window.attention {
  animation: chatAttention 0.6s ease;
}

@keyframes chatAttention {
  0%, 100% { box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 245, 196, 0.05); }
  50% { box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(0, 245, 196, 0.12), 0 0 0 1px rgba(0, 245, 196, 0.08); }
}

@media (max-width: 640px) {
  .chat-fab-wrapper {
    bottom: 16px;
    right: 16px;
  }

  .chat-fab {
    width: 48px;
    height: 48px;
  }

  .chat-fab img {
    width: 22px;
    height: 22px;
  }

  .chat-window {
    bottom: 76px;
    right: 10px;
    left: 10px;
    width: auto;
    height: 440px;
  }

  .chat-messages {
    padding: 12px 12px 2px;
  }

  .message {
    max-width: 92%;
    font-size: 0.78rem;
  }

  .book-call-btn {
    bottom: 16px;
    left: 16px;
    padding: 10px 16px 10px 14px;
    gap: 7px;
    font-size: 0.75rem;
  }

  .book-call-btn svg:first-child {
    width: 14px;
    height: 14px;
  }

  .book-call-btn .book-call-sparkle {
    width: 11px;
    height: 11px;
  }
}

/* ════════════════════════════════════════════════════════
   ACCESSIBILITY — Reduced Motion
   ════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
