/* MAU AI Chat Widget Styles - Premium & Mobile-First */
.mau-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0f1015;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.mau-chat-trigger:hover {
  transform: scale(1.06);
  border-color: rgba(255, 42, 103, 0.6);
  box-shadow: 0 12px 35px rgba(255, 42, 103, 0.3);
}

.mau-chat-trigger svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mau-chat-trigger[aria-expanded="true"] .mau-chat-icon-open {
  display: none;
}
.mau-chat-trigger[aria-expanded="false"] .mau-chat-icon-close {
  display: none;
}

.mau-chat-nudge{
  position:fixed;
  right:92px;
  bottom:33px;
  z-index:9998;
  max-width:220px;
  padding:12px 17px;
  border:1px solid #ece6da55;
  border-radius:999px;
  background:#0f1015;
  color:#ece6da;
  box-shadow:0 10px 25px #0004;
  font-size:12px;
  font-weight:650;
  white-space:nowrap;
  pointer-events:none;
  opacity:0;
  transform:translateX(8px);
}
.mau-chat-attention .mau-chat-nudge{animation:mau-nudge 4.8s ease both}
.mau-chat-attention .mau-chat-trigger{animation:mau-chat-breathe 1.8s ease-in-out 2}
@keyframes mau-nudge{0%,100%{opacity:0;transform:translateX(8px)}12%,82%{opacity:1;transform:none}}
@keyframes mau-chat-breathe{0%,100%{box-shadow:0 10px 30px #0007}50%{box-shadow:0 10px 30px #0007,0 0 0 8px #2b7a7040}}
@media(max-width:640px){.mau-chat-nudge{right:78px;bottom:21px;padding:10px 13px;font-size:11px}}
@media(prefers-reduced-motion:reduce){.mau-chat-attention .mau-chat-trigger,.mau-chat-attention .mau-chat-nudge{animation:none}}

/* Chat Window Modal */
.mau-chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9999;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100dvh - 120px);
  background: #0d0e12;
  color: #f3f3f3;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

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

/* Header */
.mau-chat-header {
  padding: 14px 18px;
  background: #14161f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

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

.mau-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff2a67, #7928ca);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.mau-chat-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: #fff;
  line-height: 1.2;
}

.mau-chat-status {
  font-size: 12px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

.mau-chat-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.mau-chat-close-btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.mau-chat-close-btn:hover {
  color: #fff;
}

/* Messages Box */
.mau-chat-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mau-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.mau-chat-msg--assistant {
  align-self: flex-start;
  background: #191b24;
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.mau-chat-msg--user {
  align-self: flex-end;
  background: #ff2a67;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.mau-chat-typing {
  font-size: 12px;
  color: #999;
  font-style: italic;
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Quick Prompts Container with Wheel & Swipe Support */
.mau-chat-prompts-wrapper {
  padding: 8px 14px;
  background: #111218;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.mau-chat-prompts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mau-chat-prompts::-webkit-scrollbar {
  display: none;
}

.mau-chat-prompt-btn {
  padding: 7px 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  font-size: 12px;
  color: #ddd;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  user-select: none;
}

.mau-chat-prompt-btn:hover {
  background: rgba(255, 42, 103, 0.18);
  border-color: rgba(255, 42, 103, 0.5);
  color: #fff;
}

/* Input Form */
.mau-chat-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #14161f;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 100%;
}

.mau-chat-privacy{flex-shrink:0;margin:0;padding:0 16px 11px;background:#14161f;color:#aab0af;font-size:10px;line-height:1.45}
.mau-chat-privacy a{color:#d4eee7;text-decoration:underline;text-underline-offset:2px}

.mau-chat-input {
  flex: 1;
  background: #0d0e12;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-size: 16px !important; /* CRITICAL: 16px prevents iOS Safari / Mobile Chrome from auto-zooming on focus */
  outline: none;
  min-width: 0;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.mau-chat-input:focus {
  border-color: #ff2a67;
}

.mau-chat-send {
  background: #ff2a67;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.mau-chat-send:active {
  transform: scale(0.96);
}

.mau-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Interactive In-Chat Lead Card */
.mau-chat-lead-card {
  margin: 10px 0;
  padding: 14px;
  background: linear-gradient(135deg, rgba(255, 42, 103, 0.1), rgba(121, 40, 202, 0.14));
  border: 1px solid rgba(255, 42, 103, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.mau-lead-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}

.mau-lead-card-header svg {
  color: #ff2a67;
  flex-shrink: 0;
}

.mau-lead-card-desc {
  font-size: 12px;
  color: #a1a1aa;
  margin: 0;
  line-height: 1.45;
}

.mau-lead-card-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.mau-lead-card-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.mau-lead-card-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mau-lead-card-lbl {
  font-size: 11px;
  font-weight: 600;
  color: #a1a1aa;
}

.mau-lead-card-input {
  width: 100%;
  background: #090a0f;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-size: 16px !important; /* 16px prevents iOS zoom */
  outline: none;
  min-width: 0;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mau-lead-card-input:focus {
  border-color: #ff2a67;
  box-shadow: 0 0 0 2px rgba(255, 42, 103, 0.2);
}

.mau-lead-card-error {
  font-size: 11.5px;
  color: #ff4976;
  background: rgba(255, 42, 103, 0.12);
  border: 1px solid rgba(255, 42, 103, 0.25);
  border-radius: 6px;
  padding: 6px 10px;
  line-height: 1.4;
}

.mau-lead-card-btn {
  background: #ff2a67;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.1s;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.mau-lead-card-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.mau-lead-card-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.mau-lead-card-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mau-lead-card-note {
  font-size: 11px;
  color: #71717a;
  text-align: center;
}

.mau-lead-card-success {
  padding: 10px 14px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 8px;
  color: #4ade80;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

/* System Status Separator & Session Restart */
.mau-chat-system-status {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 6px;
  width: 100%;
}

.mau-chat-system-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-size: 11.5px;
  color: #a1a1aa;
  font-weight: 500;
  user-select: none;
}

.mau-chat-restart-wrapper {
  display: flex;
  justify-content: center;
  margin: 6px 0 10px;
  width: 100%;
}

.mau-chat-restart-btn {
  background: rgba(255, 42, 103, 0.12);
  border: 1px solid rgba(255, 42, 103, 0.35);
  color: #ff4976;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mau-chat-restart-btn:hover {
  background: #ff2a67;
  color: #fff;
}

/* Mobile Fullscreen Bottom-Sheet Adaptation */
@media (max-width: 640px) {
  .mau-chat-trigger {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
  .mau-chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 85vh;
    height: 85dvh;
    max-height: 85dvh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .mau-chat-footer {
    padding: 10px 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .mau-chat-lead-card {
    padding: 12px;
  }
  .mau-lead-card-fields {
    flex-direction: column;
  }
  .mau-lead-card-btn {
    width: 100%;
    padding: 11px;
  }
  body.mau-chat-locked {
    overflow: hidden !important;
    overflow-x: hidden !important;
    touch-action: none;
  }
}
