/* ==========================================================================
   MUT Shuttle AI Assistant - Floating Chat Widget Styling
   ========================================================================== */

/* Container fixed at bottom-right corner */
.ai-chat-widget-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1055;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* children enable pointer events */
}

/* On mobile with bottom-nav */
body.pb-5 .ai-chat-widget-wrap,
body.has-bottom-nav .ai-chat-widget-wrap {
  bottom: 76px;
}

@media (max-width: 576px) {
  .ai-chat-widget-wrap {
    bottom: 74px;
    right: 16px;
  }
}

/* Tooltip Hint Bubble */
.ai-chat-tooltip {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: aiTooltipPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  white-space: nowrap;
}

.ai-tooltip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #ffffff;
  display: block;
}

@keyframes aiTooltipPop {
  0% { opacity: 0; transform: translateY(10px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Floating Action Button (FAB) with 3D Avatar */
.ai-chat-fab {
  pointer-events: auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2.5px solid #ffffff;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 26px rgba(193, 2, 48, 0.32), 0 4px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  padding: 0;
  animation: aiFabFloat 3.2s ease-in-out infinite alternate;
}

@keyframes aiFabFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

.ai-chat-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 32px rgba(193, 2, 48, 0.45), 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Pulsing Outer Glow Ring */
.ai-chat-fab::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(193, 2, 48, 0.35) 0%, transparent 70%);
  animation: aiFabPulse 2.4s ease-out infinite;
  z-index: -1;
}

@keyframes aiFabPulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

/* AI Fab Icons & Avatar */
.ai-fab-icon-wrap {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ai-fab-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.ai-chat-fab:hover .ai-fab-avatar-img {
  transform: scale(1.06);
}

.ai-chat-fab.is-open {
  background: linear-gradient(135deg, #c10230, #9f1121);
}

.ai-chat-fab.is-open .ai-fab-avatar-img {
  display: none !important;
}

.ai-chat-fab .ai-icon-close {
  display: none;
  color: #ffffff;
  font-size: 1.35rem;
}

.ai-chat-fab.is-open .ai-icon-close {
  display: inline-block !important;
}

/* AI Pill Badge on FAB */
.ai-fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.15rem 0.42rem;
  border-radius: 9999px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.04em;
  z-index: 2;
}

.ai-fab-online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  border: 2.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

/* ==========================================================================
   Chat Window / Panel
   ========================================================================== */
.ai-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.25), 0 6px 18px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1055;
  transform-origin: bottom right;
  animation: aiPanelOpen 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes aiPanelOpen {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(24px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 576px) {
  .ai-chat-panel {
    bottom: 74px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: calc(100vh - 150px);
    max-height: 540px;
    border-radius: 18px;
  }
}

/* Chat Header */
.ai-chat-header {
  background: linear-gradient(135deg, #c10230 0%, #a80528 50%, #880420 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(193, 2, 48, 0.2);
  flex-shrink: 0;
}

.ai-header-avatar {
  width: 44px;
  height: 44px;
  position: relative;
  flex-shrink: 0;
}

.ai-header-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  background: #ffffff;
  display: block;
}

.ai-avatar-online {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.btn-icon-glass {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.btn-icon-glass:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

/* Chat Body */
.ai-chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
  padding: 1rem;
}

.ai-chat-body::-webkit-scrollbar {
  width: 5px;
}
.ai-chat-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Message Rows */
.ai-msg {
  display: flex;
  gap: 0.55rem;
  max-width: 88%;
}

.ai-msg-bot {
  align-self: flex-start;
  align-items: flex-start;
}

.ai-msg-user {
  align-self: flex-end;
  justify-content: flex-end;
}

.ai-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  background: #ffffff;
  margin-top: 2px;
}

.ai-msg-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-msg-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

/* Message Bubbles */
.ai-bubble {
  padding: 0.75rem 0.95rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  word-break: break-word;
}

.ai-msg-bot .ai-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
}

.ai-msg-user .ai-bubble {
  background: linear-gradient(135deg, #c10230 0%, #9f1121 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 3px 10px rgba(193, 2, 48, 0.2);
}

.ai-msg-time {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.25rem;
  padding: 0 0.35rem;
}

.ai-msg-user .ai-msg-time {
  text-align: right;
}

/* Quick Suggestion Chips */
.ai-suggestion-chips {
  margin-top: 0.4rem;
}

.ai-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.ai-chip:hover {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #c10230;
  transform: translateY(-1px);
}

/* Action Buttons inside Bot Message */
.ai-actions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed #e2e8f0;
}

.ai-action-btn {
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  padding: 0.3rem 0.75rem !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

.ai-action-btn-primary {
  background: #c10230 !important;
  color: #ffffff !important;
  border: none !important;
}
.ai-action-btn-primary:hover {
  background: #9f1121 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

.ai-action-btn-soft {
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
}
.ai-action-btn-soft:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  transform: translateY(-1px);
}

/* Chat Footer & Input */
.ai-chat-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.ai-input-field {
  border-radius: 9999px !important;
  padding: 0.55rem 1rem !important;
  font-size: 0.88rem !important;
  border: 1.5px solid #cbd5e1 !important;
  background-color: #f8fafc !important;
  transition: all 0.2s ease !important;
}

.ai-input-field:focus {
  background-color: #ffffff !important;
  border-color: #c10230 !important;
  box-shadow: 0 0 0 3px rgba(193, 2, 48, 0.12) !important;
  outline: none !important;
}

.ai-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1rem !important;
  box-shadow: 0 2px 6px rgba(193, 2, 48, 0.25) !important;
}

/* Typing Indicator Animation */
.ai-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0.35rem 0.5rem;
}

.ai-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: aiDotBounce 1.4s infinite ease-in-out both;
}

.ai-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes aiDotBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background: #c10230; }
}
