/* Music Mosaic — Customer Support Chatbot Widget Styles
   Matches site/assets/redesign/theme.css design tokens and mobile breakpoints. */

/* Floating Launcher */
.mm-chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gold, #f2a93b);
  color: var(--gold-ink, #241a06);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
}

.mm-chatbot-launcher:hover {
  transform: scale(1.08);
}

.mm-chatbot-launcher:focus-visible {
  outline: 3px solid var(--gold, #f2a93b);
  outline-offset: 4px;
}

.mm-chatbot-launcher svg {
  width: 28px;
  height: 28px;
  transition: transform 0.2s ease;
}

.mm-chatbot-launcher.is-open .icon-chat {
  display: none;
}
.mm-chatbot-launcher:not(.is-open) .icon-close {
  display: none;
}

/* Accent Color Variants */
.mm-chatbot[data-accent="coral"] .mm-accent-bg,
.mm-chatbot-launcher[data-accent="coral"] {
  background: var(--coral, #e85667);
  color: #fff;
}
.mm-chatbot[data-accent="teal"] .mm-accent-bg,
.mm-chatbot-launcher[data-accent="teal"] {
  background: var(--teal, #2bb6a8);
  color: #fff;
}
.mm-chatbot[data-accent="violet"] .mm-accent-bg,
.mm-chatbot-launcher[data-accent="violet"] {
  background: var(--violet, #8b6fe8);
  color: #fff;
}

/* Chat Window Container */
.mm-chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--bg-raised, #1d1a3a);
  border: 1px solid var(--line, rgba(245, 241, 232, 0.14));
  border-radius: var(--radius-m, 18px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header */
.mm-chat-header {
  padding: 16px 18px;
  background: var(--bg-raised-2, #262148);
  border-bottom: 1px solid var(--line, rgba(245, 241, 232, 0.12));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.mm-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold, #f2a93b);
  color: var(--gold-ink, #241a06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display, 'Bricolage Grotesque', sans-serif);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.mm-chat-header-text h3 {
  font-family: var(--display, 'Bricolage Grotesque', sans-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink, #f5f1e8);
  margin: 0;
  line-height: 1.2;
}

.mm-chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-muted, #a79fc9);
  margin-top: 2px;
}

.mm-chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal, #2bb6a8);
}

.mm-chat-close-btn {
  background: transparent;
  border: none;
  color: var(--ink-muted, #a79fc9);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.mm-chat-close-btn:hover {
  color: var(--ink, #f5f1e8);
  background: rgba(245, 241, 232, 0.08);
}

/* Escalation Banner */
.mm-chat-escalation-banner[hidden] {
  display: none;
}
.mm-chat-escalation-banner {
  background: rgba(242, 169, 59, 0.15);
  border-bottom: 1px solid rgba(242, 169, 59, 0.3);
  padding: 8px 14px;
  font-size: 12.5px;
  color: var(--gold, #f2a93b);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Messages Scroll Area */
.mm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 241, 232, 0.2) transparent;
}

.mm-chat-messages::-webkit-scrollbar {
  width: 6px;
}
.mm-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(245, 241, 232, 0.2);
  border-radius: 3px;
}

/* Message Bubbles */
.mm-msg {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  animation: mmFadeIn 0.2s ease-out;
}

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

.mm-msg.mm-msg-visitor {
  align-self: flex-end;
}

.mm-msg.mm-msg-assistant,
.mm-msg.mm-msg-staff {
  align-self: flex-start;
}

.mm-msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-s, 10px);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.mm-msg-visitor .mm-msg-bubble {
  background: var(--gold, #f2a93b);
  color: var(--gold-ink, #241a06);
  border-bottom-right-radius: 2px;
  font-weight: 500;
}

.mm-msg-assistant .mm-msg-bubble {
  background: var(--bg-raised-2, #262148);
  color: var(--ink, #f5f1e8);
  border: 1px solid var(--line, rgba(245, 241, 232, 0.1));
  border-bottom-left-radius: 2px;
}

.mm-msg-staff .mm-msg-bubble {
  background: #2c2557;
  color: var(--ink, #f5f1e8);
  border: 1px solid var(--teal, #2bb6a8);
  border-bottom-left-radius: 2px;
}

.mm-msg-badge {
  font-family: var(--mono, 'Space Mono', monospace);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mm-msg-staff .mm-msg-badge {
  color: var(--teal, #2bb6a8);
}

.mm-msg-assistant .mm-msg-badge {
  color: var(--ink-muted, #a79fc9);
}

.mm-msg-time {
  font-size: 11px;
  color: var(--ink-muted, #a79fc9);
  margin-top: 3px;
  opacity: 0.7;
}

.mm-msg-visitor .mm-msg-time {
  align-self: flex-end;
}

/* Typing Indicator */
.mm-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-raised-2, #262148);
  border-radius: var(--radius-s, 10px);
  border-bottom-left-radius: 2px;
  width: fit-content;
  border: 1px solid var(--line, rgba(245, 241, 232, 0.1));
}

.mm-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold, #f2a93b);
  animation: mmTyping 1.4s infinite ease-in-out;
}

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

@keyframes mmTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Input Form */
.mm-chat-input-area {
  padding: 12px 14px;
  background: var(--bg-raised-2, #262148);
  border-top: 1px solid var(--line, rgba(245, 241, 232, 0.12));
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.mm-chat-input {
  flex: 1;
  background: var(--bg-raised, #1d1a3a);
  border: 1px solid var(--line, rgba(245, 241, 232, 0.14));
  border-radius: var(--radius-s, 10px);
  padding: 10px 12px;
  color: var(--ink, #f5f1e8);
  font-family: var(--body, 'Public Sans', sans-serif);
  font-size: 14px;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s;
}

.mm-chat-input:focus {
  border-color: var(--gold, #f2a93b);
}

.mm-chat-send-btn {
  background: var(--gold, #f2a93b);
  color: var(--gold-ink, #241a06);
  border: none;
  border-radius: var(--radius-s, 10px);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
}

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

.mm-chat-send-btn:not(:disabled):hover {
  transform: scale(1.05);
}

.mm-chat-footer-note {
  font-size: 11px;
  text-align: center;
  color: var(--ink-muted, #a79fc9);
  padding: 4px 0 8px;
  background: var(--bg-raised-2, #262148);
  opacity: 0.7;
}

/* Mobile Responsiveness */
@media (max-width: 860px) {
  .mm-chatbot-launcher {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
  .mm-chatbot-window {
    bottom: 80px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: 480px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-chatbot-launcher,
  .mm-chatbot-window,
  .mm-msg,
  .mm-typing-dot {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
