/* ============================================================================
   MM Help Chat — Floating Widget Styles
   Uses dark theme CSS variables from local-theme/dark-theme.css
   ============================================================================ */

/* ---------- Floating trigger button ---------- */
#mmhc-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--mm-accent, #10B981);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
#mmhc-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(16, 185, 129, 0.5);
  background: var(--mm-accent-hover, #059669);
}
#mmhc-trigger:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
#mmhc-trigger svg {
  width: 26px;
  height: 26px;
  transition: opacity 0.2s ease;
}
#mmhc-trigger .mmhc-icon-close { display: none; }
#mmhc-trigger.mmhc-open .mmhc-icon-chat { display: none; }
#mmhc-trigger.mmhc-open .mmhc-icon-close { display: block; }

/* Unread pulse animation */
#mmhc-trigger:not(.mmhc-open)::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: var(--mm-danger, #EF4444);
  border-radius: 50%;
  border: 2px solid var(--mm-bg, #0A0A0A);
  animation: mmhc-pulse 2s infinite;
}
#mmhc-trigger.mmhc-seen:not(.mmhc-open)::after { display: none; }

@keyframes mmhc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Chat panel ---------- */
#mmhc-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  height: 520px;
  max-height: calc(100dvh - 120px);
  background: var(--mm-bg-card, #151515);
  border: 1px solid var(--mm-border, rgba(255,255,255,0.12));
  border-radius: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  transform: translateY(16px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
#mmhc-panel.mmhc-visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Panel header ---------- */
#mmhc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(16,185,129,0.15) 0%, transparent 60%);
  border-bottom: 1px solid var(--mm-border, rgba(255,255,255,0.12));
  flex-shrink: 0;
}
#mmhc-header-title {
  font-family: 'Jost', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--mm-text, #F5F5F5);
  display: flex;
  align-items: center;
  gap: 8px;
}
#mmhc-header-title .mmhc-dot {
  width: 8px;
  height: 8px;
  background: var(--mm-accent, #10B981);
  border-radius: 50%;
  display: inline-block;
}
#mmhc-close {
  background: none;
  border: none;
  color: var(--mm-text-secondary, #A0A0A0);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
#mmhc-close:hover {
  color: var(--mm-text, #F5F5F5);
  background: rgba(255,255,255,0.08);
}
#mmhc-close svg { width: 18px; height: 18px; }

/* ---------- Message area ---------- */
#mmhc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#mmhc-messages::-webkit-scrollbar { width: 4px; }
#mmhc-messages::-webkit-scrollbar-track { background: transparent; }
#mmhc-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* ---------- Bot message bubble ---------- */
.mmhc-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px 12px 12px 4px;
  background: rgba(255,255,255,0.06);
  color: var(--mm-text, #F5F5F5);
  font-size: 14px;
  line-height: 1.5;
  font-family: 'Inter', sans-serif;
  animation: mmhc-fadeIn 0.25s ease;
}

/* ---------- User selection echo ---------- */
.mmhc-msg-user {
  align-self: flex-end;
  background: var(--mm-accent, #10B981);
  color: #fff;
  border-radius: 12px 12px 4px 12px;
  font-weight: 500;
}

/* ---------- Options (choice buttons) ---------- */
.mmhc-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: mmhc-fadeIn 0.3s ease;
}
.mmhc-opt {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--mm-border, rgba(255,255,255,0.12));
  color: var(--mm-text, #F5F5F5);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.mmhc-opt:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--mm-accent, #10B981);
}
.mmhc-opt:active {
  transform: scale(0.98);
}
.mmhc-opt:focus-visible {
  outline: 2px solid var(--mm-accent, #10B981);
  outline-offset: 2px;
}

/* ---------- Typing indicator ---------- */
.mmhc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  max-width: 70px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px 12px 12px 4px;
}
.mmhc-typing span {
  width: 6px;
  height: 6px;
  background: var(--mm-text-secondary, #A0A0A0);
  border-radius: 50%;
  display: inline-block;
  animation: mmhc-bounce 1.2s infinite;
}
.mmhc-typing span:nth-child(2) { animation-delay: 0.15s; }
.mmhc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes mmhc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes mmhc-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Powered-by footer ---------- */
#mmhc-footer {
  padding: 8px 18px;
  text-align: center;
  font-size: 11px;
  color: var(--mm-text-muted, rgba(255,255,255,0.55));
  border-top: 1px solid var(--mm-border, rgba(255,255,255,0.12));
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 480px) {
  #mmhc-trigger {
    bottom: 80px; /* above mobile sticky bar */
    right: 16px;
  }
  #mmhc-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 65dvh;
    max-height: 65dvh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
  }
  #mmhc-panel.mmhc-visible {
    transform: translateY(0);
  }
}

/* Ensure it sits above the mobile bar */
@media (max-width: 768px) {
  #mmhc-trigger {
    bottom: 80px;
  }
}
