/* Martvill floating M bot — isolated stylesheet */
#mv-chat {
  position: fixed !important;
  right: 20px !important;
  bottom: 88px !important;
  z-index: 99999 !important;
  font-family: Inter, system-ui, sans-serif;
  width: auto !important;
  height: auto !important;
  max-width: 100vw;
  pointer-events: none;
}
#mv-chat * { box-sizing: border-box; }
#mv-chat button,
#mv-chat .mv-chat-panel,
#mv-chat input {
  pointer-events: auto;
}

#mv-chat [hidden] {
  display: none !important;
}

/* FAB character */
.mv-bot-fab {
  position: relative !important;
  width: 68px !important;
  height: 68px !important;
  border: none !important;
  background: transparent !important;
  cursor: pointer;
  padding: 0 !important;
  animation: mvFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 24px rgba(0, 212, 255, 0.4));
}
.mv-bot-fab.open {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.4) !important;
}

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

.mv-bot-body {
  position: relative;
  width: 68px !important;
  height: 68px !important;
  border-radius: 50% !important;
  background: linear-gradient(145deg, #0c1222, #152038) !important;
  border: 2px solid rgba(0, 212, 255, 0.5) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  z-index: 2;
}
.mv-bot-face {
  width: 38px !important;
  height: 38px !important;
  max-width: 38px !important;
  max-height: 38px !important;
  object-fit: contain !important;
  display: block !important;
  position: relative;
  z-index: 2;
}

.mv-bot-glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, rgba(0,212,255,0.4), transparent 70%);
  pointer-events: none;
  animation: mvGlow 2.5s ease-in-out infinite;
}
@keyframes mvGlow {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.mv-bot-rings { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.mv-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 212, 255, 0.35);
  animation: mvSpin 10s linear infinite;
}
.mv-ring-1 { inset: -5px; }
.mv-ring-2 {
  inset: -12px;
  border-color: rgba(168, 85, 247, 0.3);
  animation-direction: reverse;
  animation-duration: 14s;
}
@keyframes mvSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.mv-bot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a855f7, #00d4ff);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}
.mv-bot-badge.hide { display: none !important; }

.mv-bot-tooltip {
  position: absolute;
  right: 78px;
  top: 50%;
  transform: translateY(-50%);
  background: #0e1525;
  border: 1px solid rgba(0,212,255,0.25);
  color: #e8eef8;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.mv-bot-fab:hover .mv-bot-tooltip { opacity: 1; }

/* Panel */
.mv-chat-panel {
  position: absolute !important;
  right: 0 !important;
  bottom: 80px !important;
  width: min(360px, calc(100vw - 24px)) !important;
  height: min(480px, calc(100vh - 120px)) !important;
  max-height: 480px !important;
  background: #0c1222 !important;
  border: 1px solid rgba(0, 212, 255, 0.2) !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.mv-chat-panel[hidden] {
  display: none !important;
}

.mv-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(0,212,255,0.12), rgba(168,85,247,0.12));
  border-bottom: 1px solid rgba(0,212,255,0.12);
  flex-shrink: 0;
}
.mv-chat-header-left { display: flex; align-items: center; gap: 10px; }
.mv-chat-avatar {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(0,212,255,0.4);
  background: #0a0e1a;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
}
.mv-chat-avatar img {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  object-fit: contain !important;
}
.mv-chat-header strong { display: block; font-size: 14px; color: #e8eef8; }
.mv-chat-status { font-size: 11px; color: #00d4ff; display: flex; align-items: center; gap: 5px; }
.mv-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 6px #22c55e;
}
.mv-chat-close {
  background: none; border: none; color: #8b9bb8;
  font-size: 22px; cursor: pointer; line-height: 1; padding: 4px 8px;
}

.mv-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.mv-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}
.mv-bubble-bot {
  align-self: flex-start;
  background: #121a2e;
  border: 1px solid rgba(0,212,255,0.15);
  color: #e8eef8;
}
.mv-bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  color: #fff;
}

.mv-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px 8px;
  flex-shrink: 0;
}
.mv-chip {
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.25);
  color: #00d4ff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
}

.mv-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(0,212,255,0.12);
  flex-shrink: 0;
}
.mv-chat-form input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,212,255,0.2);
  background: #060a14;
  color: #e8eef8;
  font-size: 13px;
  outline: none;
}
.mv-chat-form button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #a855f7);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}

/* Safety: never let any image in chat explode layout */
#mv-chat img {
  max-width: 42px !important;
  max-height: 42px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}
#mv-chat .mv-bot-face {
  width: 38px !important;
  height: 38px !important;
}
#mv-chat .mv-chat-avatar img {
  width: 22px !important;
  height: 22px !important;
}

@media (max-width: 480px) {
  #mv-chat { right: 12px !important; bottom: 12px !important; }
  .mv-bot-tooltip { display: none !important; }
  .mv-chat-panel {
    width: calc(100vw - 20px) !important;
    height: min(70vh, 460px) !important;
  }
}

/* Typing indicator */
.mv-typing {
  display: flex !important;
  align-items: center;
  gap: 5px;
  padding: 12px 16px !important;
  min-width: 52px;
}
.mv-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.7);
  animation: mvType 1.2s ease-in-out infinite;
}
.mv-typing span:nth-child(2) { animation-delay: 0.15s; }
.mv-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mvType {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .mv-bot-fab,
  .mv-bot-glow,
  .mv-ring,
  .mv-typing span {
    animation: none !important;
  }
}

#mv-chat { bottom: 88px !important; pointer-events: none; }
#mv-chat .mv-bot-fab, #mv-chat .mv-chat-panel, #mv-chat .mv-bot-tooltip { pointer-events: auto; }
@media (max-width: 640px) {
  #mv-chat { bottom: 72px !important; right: 14px !important; }
}
