

/* Malleversa AI Chat Widget Styles */

:root {
  --mv-chat-primary: #1e3a8a;
  --mv-chat-primary-hover: #1e40af;
  --mv-chat-accent: #3b82f6;
  --mv-chat-bg: #ffffff;
  --mv-chat-bubble-user: #1e3a8a;
  --mv-chat-bubble-ai: #f1f5f9;
  --mv-chat-text: #1e293b;
  --mv-chat-text-muted: #64748b;
  --mv-chat-border: #e2e8f0;
  --mv-chat-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.18), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --mv-chat-radius: 18px;
}

/* Floating Launch Button */
.mv-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 12px 20px 12px 16px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.25s ease;
  user-select: none;
}

.mv-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.45);
}

.mv-chat-launcher:active {
  transform: translateY(0);
}

.mv-chat-launcher-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mv-chat-launcher-badge {
  background: #10b981;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  position: absolute;
  top: 10px;
  left: 28px;
}

/* Chat Window Container */
.mv-chat-container {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 99999;
  width: 380px;
  height: 580px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 100px);
  background: #ffffff;
  border-radius: var(--mv-chat-radius);
  box-shadow: var(--mv-chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--mv-chat-border);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.mv-chat-container.mv-chat-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92) translateY(16px);
}

.mv-chat-container.mv-chat-expanded {
  width: 600px;
  height: 720px;
}

/* Header */
.mv-chat-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mv-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mv-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.mv-chat-title-group h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.mv-chat-subtitle {
  font-size: 12px;
  color: #93c5fd;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.mv-chat-subtitle::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
}

.mv-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mv-chat-btn-icon {
  background: transparent;
  border: none;
  color: #ffffff;
  opacity: 0.8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mv-chat-btn-icon:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* AI data-use notice */
.mv-chat-disclosure {
  padding: 10px 14px;
  border-bottom: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #334155;
  font-size: 11px;
  line-height: 1.45;
}

.mv-chat-disclosure a {
  color: #1d4ed8;
  font-weight: 700;
  white-space: nowrap;
}

/* Quick Suggestion Chips */
.mv-chat-quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--mv-chat-border);
  scrollbar-width: none;
}

.mv-chat-quick-actions::-webkit-scrollbar {
  display: none;
}

.mv-chat-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.mv-chat-chip:hover {
  border-color: #3b82f6;
  color: #1d4ed8;
  background: #eff6ff;
}

/* Messages Body */
.mv-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #ffffff;
}

.mv-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: mvFadeIn 0.2s ease-out;
}

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

.mv-chat-msg.mv-msg-user {
  align-self: flex-end;
}

.mv-chat-msg.mv-msg-user .mv-chat-bubble {
  background: #1e3a8a;
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
}

.mv-chat-msg.mv-msg-assistant {
  align-self: flex-start;
}

.mv-chat-msg.mv-msg-assistant .mv-chat-bubble {
  background: #f1f5f9;
  color: #1e293b;
  border-radius: 16px 16px 16px 4px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
}

.mv-chat-bubble p {
  margin: 0 0 8px 0;
}

.mv-chat-bubble p:last-child {
  margin-bottom: 0;
}

.mv-chat-bubble ul, .mv-chat-bubble ol {
  margin: 6px 0;
  padding-left: 20px;
}

.mv-chat-bubble a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
}

.mv-msg-user .mv-chat-bubble a {
  color: #93c5fd;
}

/* Recommendation card inside assistant bubble */
.mv-chat-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.mv-chat-card-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 14px;
  margin-bottom: 4px;
}

.mv-chat-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.mv-chat-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none !important;
  transition: all 0.15s;
}

.mv-btn-whatsapp {
  background: #25d366;
  color: #ffffff !important;
}

.mv-btn-whatsapp:hover {
  background: #1eb956;
}

.mv-btn-profile {
  background: #f1f5f9;
  color: #334155 !important;
  border: 1px solid #cbd5e1;
}

.mv-btn-profile:hover {
  background: #e2e8f0;
}

/* Typing indicator */
.mv-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #f1f5f9;
  border-radius: 16px;
  width: fit-content;
}

.mv-chat-typing-dot {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: mvBounce 1.4s infinite ease-in-out both;
}

.mv-chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.mv-chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Footer Input Area */
.mv-chat-footer {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid var(--mv-chat-border);
}

.mv-chat-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mv-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.mv-chat-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.mv-chat-send-btn {
  background: #1e3a8a;
  color: #ffffff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mv-chat-send-btn:hover {
  background: #2563eb;
}

.mv-chat-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* Mobile Fullscreen rules */
@media (max-width: 640px) {
  .mv-chat-container {
    position: fixed !important;
    top: var(--mv-chat-top, 0px) !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: var(--mv-chat-height, 100dvh) !important;
    max-width: 100vw !important;
    max-height: -webkit-fill-available;
    border-radius: 0 !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .mv-chat-container.mv-chat-hidden {
    display: none !important;
  }

  /* Prevent auto-zoom on iOS Safari/Chrome when input is focused (requires >= 16px font-size) */
  .mv-chat-input {
    font-size: 16px !important;
  }

  .mv-chat-launcher {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
  }

  .mv-chat-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }
}

