/* ═══════════════════════════════════════════════════════════════
   MSM Aventra — AVA Chatbot v2 (Premium UI)
═══════════════════════════════════════════════════════════════ */

/* ─── FAB BUTTON ─────────────────────────────────────────────── */
.chatbot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #b71c1c, #e51c23);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 1100;
  box-shadow: 0 8px 32px rgba(229,28,35,0.4), 0 2px 8px rgba(0,0,0,0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.chatbot-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(229,28,35,0.5), 0 4px 12px rgba(0,0,0,0.3);
}

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

.chatbot-fab i {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chatbot-fab.open i {
  transform: rotate(180deg);
}

/* ─── PULSE ANIMATION ────────────────────────────────────────── */
.chatbot-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(229,28,35,0.5);
  animation: fabPulse 2s ease-out infinite;
}

@keyframes fabPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ─── BADGE ───────────────────────────────────────────────────── */
.chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #10b981;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
  animation: badgeBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgeBounce {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* ─── CHAT WINDOW ────────────────────────────────────────────── */
.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 360px;
  max-height: 560px;
  background: #0f1219;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  z-index: 1099;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 4px 20px rgba(229,28,35,0.1);
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

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

/* ─── HEADER ─────────────────────────────────────────────────── */
.chatbot-header {
  background: linear-gradient(135deg, #8b0000, #c41e1e, #e51c23);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.chatbot-header::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.25);
  flex-shrink: 0;
}

.chatbot-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 3px;
}

.chatbot-status {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chatbot-online-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  animation: onlinePulse 2s ease-in-out infinite;
}

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

.chatbot-close {
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
  position: relative;
}

.chatbot-close:hover {
  background: rgba(255,255,255,0.22);
}

/* ─── MESSAGES AREA ───────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #090c14;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(229,28,35,0.3); border-radius: 99px; }

/* ─── MESSAGE BUBBLES ────────────────────────────────────────── */
.msg-bot {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: msgSlideIn 0.3s ease;
}

.msg-user {
  display: flex;
  justify-content: flex-end;
  animation: msgSlideIn 0.3s ease;
}

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

.msg-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #b71c1c, #e51c23);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-body {
  max-width: 82%;
}

.msg-bot .msg-body {
  background: #141824;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 0 14px 14px 14px;
  padding: 10px 14px;
}

.msg-user .msg-body {
  background: linear-gradient(135deg, #b71c1c, #e51c23);
  border-radius: 14px 0 14px 14px;
  padding: 10px 14px;
}

.msg-body p {
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(255,255,255,0.88);
  margin: 0;
}

.msg-user .msg-body p { color: #fff; }

.msg-body p a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg-body p strong { color: #fff; }

.msg-time {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  margin-top: 5px;
  text-align: right;
}

.msg-bot .msg-time { text-align: left; }

/* ─── TYPING INDICATOR ────────────────────────────────────────── */
.msg-typing { animation: msgSlideIn 0.3s ease; }

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out 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: scale(1); opacity: 0.5; }
  40% { transform: scale(1.3); opacity: 1; }
}

/* ─── SUGGESTION CHIPS ────────────────────────────────────────── */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 4px;
}

.suggestion-chip {
  background: rgba(229,28,35,0.1);
  border: 1px solid rgba(229,28,35,0.22);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #ff8a8a;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.suggestion-chip:hover {
  background: rgba(229,28,35,0.2);
  border-color: rgba(229,28,35,0.4);
  color: #ffaaaa;
  transform: translateY(-1px);
}

/* ─── FOOTER / INPUT ──────────────────────────────────────────── */
.chatbot-footer {
  background: #0d1018;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 12px 14px 10px;
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 6px 6px 6px 14px;
  transition: border-color 0.2s;
}

.chat-input-row:focus-within {
  border-color: rgba(229,28,35,0.35);
  background: rgba(255,255,255,0.06);
}

.chat-input-row input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: rgba(255,255,255,0.9);
  font-family: 'Inter', sans-serif;
  caret-color: var(--red-light);
}

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

.chat-send-btn {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #b71c1c, #e51c23);
  border: none;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: linear-gradient(135deg, #e51c23, #ff4757);
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chatbot-powered {
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .chatbot-window {
    right: 12px;
    bottom: 90px;
    width: calc(100vw - 24px);
    max-height: 70vh;
  }
  .chatbot-fab {
    right: 16px;
    bottom: 16px;
  }
}

/* ─── LIGHT MODE OVERRIDES ───────────────────────────────────── */
[data-theme="light"] .chatbot-window {
  background: #ffffff;
  border-color: rgba(10,15,40,0.08);
  box-shadow: 0 24px 80px rgba(10,15,40,0.15), 0 4px 20px rgba(229,28,35,0.08);
}

[data-theme="light"] .chat-messages {
  background: #f3f5fc;
}

[data-theme="light"] .msg-bot .msg-body {
  background: #ffffff;
  border-color: rgba(10,15,40,0.08);
}

[data-theme="light"] .msg-body p {
  color: #1a2340;
}

[data-theme="light"] .msg-body p strong { color: #0b0f1e; }
[data-theme="light"] .msg-body p a { color: #0284c7; }
[data-theme="light"] .msg-time { color: rgba(10,15,40,0.3); }

[data-theme="light"] .chatbot-footer {
  background: #f8f9fc;
  border-color: rgba(10,15,40,0.06);
}

[data-theme="light"] .chat-input-row {
  background: rgba(10,15,40,0.04);
  border-color: rgba(10,15,40,0.1);
}

[data-theme="light"] .chat-input-row:focus-within {
  border-color: rgba(229,28,35,0.3);
  background: rgba(10,15,40,0.02);
}

[data-theme="light"] .chat-input-row input {
  color: #1a2340;
}

[data-theme="light"] .chat-input-row input::placeholder {
  color: rgba(10,15,40,0.3);
}

[data-theme="light"] .chatbot-powered { color: rgba(10,15,40,0.2); }
[data-theme="light"] .chatbot-badge { border-color: #f8f9fc; }

[data-theme="light"] .suggestion-chip {
  background: rgba(229,28,35,0.06);
  border-color: rgba(229,28,35,0.15);
  color: #c51018;
}
[data-theme="light"] .suggestion-chip:hover {
  background: rgba(229,28,35,0.12);
  border-color: rgba(229,28,35,0.3);
  color: #a00e14;
}

[data-theme="light"] .typing-dots span {
  background: rgba(10,15,40,0.25);
}
