/* ══════════════════════════════════════════════════════
   MOZAI CHAT SYSTEM — paste into your styles.css
══════════════════════════════════════════════════════ */

/* ── TRIGGER BUTTON ── */
.mozai-trigger {
  position: fixed;
  bottom: 110px;
  right: 20px;
  width: 56px;
  height: 56px;
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mozai-trigger.chat-open {
  display: none !important;
}
/* Arrow button: above logo, small, separate click area */
.mozai-trigger-arrow-btn {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translate(-50%, 0);
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(147,51,234,0.25);
  color: rgba(192,132,252,0.95);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background 0.2s, color 0.2s;
}
.mozai-trigger-arrow-btn:hover {
  background: rgba(147,51,234,0.45);
  color: #fff;
}

/* 3 dots around the logo (ring) - decorative only */
.mozai-trigger-hint-ring {
  position: absolute;
  inset: -14px;
  pointer-events: none;
  z-index: 2;
}
.mozai-hint-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(192,132,252,0.85);
  top: 50%;
  left: 50%;
}
.mozai-hint-dot:nth-child(1) { transform: translate(calc(-50% + 20px), -50%); }
.mozai-hint-dot:nth-child(2) { transform: translate(-50%, calc(-50% + 20px)); }
.mozai-hint-dot:nth-child(3) { transform: translate(calc(-50% - 20px), -50%); }
.mozai-trigger-vinyl {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  animation: mozaiFloat 3s ease-in-out infinite;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.mozai-trigger:hover .mozai-trigger-vinyl {
  transform: scale(1.14) rotate(-8deg);
}
.mozai-trigger-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid rgba(147,51,234,0.6);
  box-shadow:
    0 0 0 4px rgba(147,51,234,0.15),
    0 0 28px rgba(147,51,234,0.6),
    0 0 60px rgba(147,51,234,0.25);
  background: #0a0818;
}
.mozai-trigger-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.mozai-trigger-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(147,51,234,0.35);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(1);
  animation: mozaiRingPulse 2.5s ease-out infinite;
  pointer-events: none;
}
.mozai-ring-1 { width: 72px;  height: 72px;  animation-delay: 0s; }
.mozai-ring-2 { width: 88px; height: 88px; animation-delay: 0.6s; border-color: rgba(147,51,234,0.20); }
.mozai-trigger-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147,51,234,0.18) 0%, transparent 70%);
  animation: mozaiPulseGlow 2s ease-in-out infinite;
  pointer-events: none;
}
.mozai-trigger-notes {
  position: absolute;
  top: -10px; left: 50%;
  pointer-events: none;
}
.mozai-float-note {
  position: absolute;
  font-size: 14px;
  color: rgba(192,132,252,0.8);
  left: var(--x, 0px);
  animation: mozaiNoteFloat 2.4s ease-in-out infinite;
  animation-delay: var(--d, 0s);
  opacity: 0;
}

@keyframes mozaiFloat {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes mozaiRingPulse {
  0%   { transform: translate(-50%,-50%) scale(0.9); opacity: 0.8; }
  100% { transform: translate(-50%,-50%) scale(1.6); opacity: 0; }
}
@keyframes mozaiPulseGlow {
  0%,100% { opacity: 0.6; transform: scale(1); }
  50%     { opacity: 1.0; transform: scale(1.15); }
}
@keyframes mozaiNoteFloat {
  0%   { transform: translateY(0);     opacity: 0; }
  20%  { opacity: 0.9; }
  100% { transform: translateY(-48px); opacity: 0; }
}

/* ── LAUNCH ANIMATION ── */
.mozai-launch-overlay {
  position: fixed;
  inset: 0;
  z-index: 399;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 6, 24, 0.85);
}
.mozai-launch-overlay.hidden {
  display: none !important;
}

.mozai-launch-char {
  position: absolute;
  width: 140px;
  height: 140px;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
  bottom: 120px;
  right: 40px;
  transform-origin: center bottom;
  opacity: 0;
}
.mozai-launch-char.launching {
  animation: mozaiLaunch 0.75s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes mozaiLaunch {
  0%   { opacity: 1; transform: scale(0.7) translateY(0) rotate(0deg); }
  40%  { opacity: 1; transform: scale(1.2) translateY(-180px) rotate(-15deg); }
  70%  { opacity: 1; transform: scale(0.95) translateY(-80px) rotate(8deg); }
  100% { opacity: 0; transform: scale(0.5) translateY(-300px) rotate(-5deg); }
}
.mozai-spark {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: mozaiSpark 0.6s ease-out forwards;
}
@keyframes mozaiSpark {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(0); opacity: 0; }
}

/* ── CHAT PANEL ── */
.mozai-panel {
  position: fixed;
  bottom: 108px;
  right: 24px;
  width: 380px;
  height: 580px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  z-index: 300;
  overflow: hidden;
  background: rgba(10, 6, 24, 0.96);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 1px solid rgba(147,51,234,0.25);
  box-shadow:
    0 40px 100px rgba(0,0,0,0.75),
    0 0 0 1px rgba(147,51,234,0.12),
    0 0 80px rgba(147,51,234,0.15),
    inset 0 1px 0 rgba(255,255,255,0.06);
  transform-origin: bottom right;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}
.mozai-panel.hidden {
  display: none !important;
  pointer-events: none;
}
.mozai-panel.visible {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Minimized: Mozai completely hidden to right, only small arrow peeks */
.mozai-panel.minimized,
.mozai-panel.minimized.visible {
  width: 28px !important;
  min-width: 28px;
  height: 56px !important;
  right: 0 !important;
  bottom: 110px;
  transform: none;
  border-radius: 8px 0 0 8px;
  border-right: none;
  padding: 0;
  box-shadow: -2px 0 12px rgba(0,0,0,0.3);
}
.mozai-panel.minimized .mozai-panel-header,
.mozai-panel.minimized .mozai-messages,
.mozai-panel.minimized .mozai-typing,
.mozai-panel.minimized .mozai-suggestions,
.mozai-panel.minimized .mozai-input-row {
  display: none !important;
}
.mozai-panel.minimized .mozai-edge-tab {
  display: flex !important;
}

/* Edge tab: only arrow button when minimized - click to expand */
.mozai-edge-tab {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  user-select: none;
}
.mozai-edge-arrow-btn {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(147,51,234,0.12);
  color: rgba(192,132,252,0.75);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  border-radius: 8px 0 0 8px;
}
.mozai-edge-arrow-btn:hover {
  background: rgba(147,51,234,0.25);
  color: rgba(192,132,252,0.95);
}

.mozai-minimize-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(147,51,234,0.25);
  background: rgba(147,51,234,0.10);
  color: rgba(192,132,252,0.75);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}
.mozai-minimize-btn:hover {
  background: rgba(147,51,234,0.30);
  color: #fff;
}

/* Header */
.mozai-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.9rem;
  border-bottom: 1px solid rgba(147,51,234,0.15);
  background: rgba(147,51,234,0.06);
  flex-shrink: 0;
}
.mozai-header-avatar-wrap { position: relative; flex-shrink: 0; }
.mozai-header-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(147,51,234,0.55);
  box-shadow: 0 0 16px rgba(147,51,234,0.50);
  animation: mozaiAvatarBob 3s ease-in-out infinite;
}
@keyframes mozaiAvatarBob {
  0%,100% { transform: translateY(0) rotate(0deg); }
  25%     { transform: translateY(-3px) rotate(-2deg); }
  75%     { transform: translateY(2px) rotate(2deg); }
}
.mozai-header-avatar.thinking {
  animation: mozaiAvatarThink 0.5s ease-in-out infinite alternate;
  border-color: rgba(192,132,252,0.8);
  box-shadow: 0 0 24px rgba(192,132,252,0.65);
}
@keyframes mozaiAvatarThink {
  0%   { transform: translateY(0) rotate(-4deg) scale(1.0); }
  100% { transform: translateY(-4px) rotate(4deg) scale(1.05); }
}
.mozai-header-status {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid rgba(10,6,24,0.95);
  box-shadow: 0 0 8px rgba(74,222,128,0.6);
}
.mozai-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.mozai-header-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #C084FC 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.mozai-header-sub {
  font-size: 0.70rem;
  color: rgba(168,155,192,0.70);
  letter-spacing: 0.01em;
}
.mozai-close-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(147,51,234,0.25);
  background: rgba(147,51,234,0.10);
  color: rgba(192,132,252,0.75);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}
.mozai-close-btn:hover {
  background: rgba(147,51,234,0.30);
  color: #fff;
}

/* Messages */
.mozai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}
.mozai-messages::-webkit-scrollbar { width: 3px; }
.mozai-messages::-webkit-scrollbar-thumb { background: rgba(147,51,234,0.35); border-radius: 999px; }

.mozai-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  animation: mozaiMsgIn 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes mozaiMsgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.mozai-msg.user { flex-direction: row-reverse; }
.mozai-msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
  border: 1.5px solid rgba(147,51,234,0.45);
}
.mozai-msg-bubble {
  max-width: 78%;
  padding: 0.65rem 0.9rem;
  border-radius: 16px;
  font-size: 0.83rem;
  line-height: 1.55;
}
.mozai-msg.mozai-side .mozai-msg-bubble {
  background: rgba(30,18,55,0.85);
  border: 1px solid rgba(147,51,234,0.22);
  color: rgba(245,243,255,0.92);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.30);
}
.mozai-msg.user .mozai-msg-bubble {
  background: linear-gradient(135deg, rgba(147,51,234,0.80) 0%, rgba(99,102,241,0.70) 100%);
  border: 1px solid rgba(147,51,234,0.40);
  color: rgba(255,255,255,0.96);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 20px rgba(147,51,234,0.25);
}
.mozai-cursor {
  display: inline-block;
  width: 2px; height: 13px;
  background: rgba(192,132,252,0.8);
  margin-left: 2px;
  vertical-align: middle;
  animation: mozaiBlink 0.7s ease-in-out infinite;
}
@keyframes mozaiBlink { 0%,100%{opacity:1} 50%{opacity:0} }

.mozai-note-emit {
  position: absolute;
  font-size: 12px;
  color: rgba(192,132,252,0.8);
  pointer-events: none;
  animation: mozaiNoteEmit 1.2s ease-out forwards;
}
@keyframes mozaiNoteEmit {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--ex,10px), var(--ey,-40px)) scale(0.6); }
}

/* Typing indicator */
.mozai-typing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  flex-shrink: 0;
}
.mozai-typing.hidden { display: none; }
.mozai-typing-dots {
  display: flex;
  gap: 4px;
  padding: 0.55rem 0.8rem;
  background: rgba(30,18,55,0.85);
  border: 1px solid rgba(147,51,234,0.22);
  border-radius: 12px;
  border-bottom-left-radius: 3px;
}
.mozai-typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(192,132,252,0.7);
  animation: mozaiDot 1.2s ease-in-out infinite;
}
.mozai-typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.mozai-typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes mozaiDot {
  0%,100% { transform: translateY(0); opacity: 0.5; }
  50%     { transform: translateY(-6px); opacity: 1; background: rgba(192,132,252,1); }
}

/* Suggestions */
.mozai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  flex-shrink: 0;
}
.mozai-suggestion-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(147,51,234,0.25);
  background: rgba(147,51,234,0.09);
  color: rgba(192,132,252,0.85);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.mozai-suggestion-btn:hover {
  background: rgba(147,51,234,0.80);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(147,51,234,0.40);
  transform: translateY(-1px);
}

/* Input */
.mozai-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(147,51,234,0.12);
  flex-shrink: 0;
}
.mozai-input {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(147,51,234,0.25);
  background: rgba(147,51,234,0.08);
  color: rgba(245,243,255,0.92);
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.18s;
}
.mozai-input::placeholder { color: rgba(168,155,192,0.50); }
.mozai-input:focus {
  border-color: rgba(147,51,234,0.55);
  background: rgba(147,51,234,0.13);
  box-shadow: 0 0 0 3px rgba(147,51,234,0.12);
}
.mozai-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #9333EA 0%, #6366F1 100%);
  color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(147,51,234,0.50);
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.mozai-send-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 24px rgba(147,51,234,0.70);
}
.mozai-send-btn:active { transform: scale(0.95); }

.mozai-context-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: rgba(192,132,252,0.65);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(147,51,234,0.08);
  border: 1px solid rgba(147,51,234,0.15);
  margin-bottom: 0.5rem;
  align-self: center;
}

@media (max-width: 768px) {
  /* Mozai trigger — higher up so it doesn't overlap the floating player */
  .mozai-trigger { right: 14px; bottom: 210px !important; }
  .mozai-panel:not(.minimized) { width: calc(100vw - 24px); right: 12px; bottom: 210px; max-height: 55vh; }
  .mozai-panel.minimized { right: 0 !important; bottom: 210px !important; }
}
