/* Marsha Landing Chat Widget */

#marsha-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #695C4B;
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: marsha-pulse 3s ease-in-out 2s 3;
}

#marsha-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

#marsha-chat-bubble .material-symbols-outlined {
  color: #fff6ef;
  font-size: 28px;
}

#marsha-chat-bubble.hidden { display: none; }

@keyframes marsha-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); }
  50% { box-shadow: 0 4px 20px rgba(105, 92, 75, 0.4); }
}

/* Chat panel */
#marsha-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: #1A1C1B;
  border-radius: 16px;
  z-index: 10000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

#marsha-chat-panel.open { display: flex; }

/* Header */
.marsha-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(249, 249, 247, 0.1);
}

.marsha-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.marsha-chat-header img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.marsha-chat-header-name {
  color: #F9F9F7;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 14px;
}

.marsha-chat-header-status {
  color: rgba(249, 249, 247, 0.4);
  font-family: 'Public Sans', sans-serif;
  font-size: 11px;
  font-weight: 300;
}

.marsha-chat-close {
  background: none;
  border: none;
  color: rgba(249, 249, 247, 0.4);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
}

.marsha-chat-close:hover { color: rgba(249, 249, 247, 0.7); }

/* Messages */
.marsha-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  scrollbar-width: none;
}

.marsha-chat-messages::-webkit-scrollbar { display: none; }

.marsha-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: 'Public Sans', sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.5;
  word-wrap: break-word;
}

.marsha-msg.assistant {
  align-self: flex-start;
  background: #2d3432;
  color: #F9F9F7;
  border-bottom-left-radius: 4px;
}

.marsha-msg.user {
  align-self: flex-end;
  background: #695C4B;
  color: #fff6ef;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.marsha-typing {
  align-self: flex-start;
  display: none;
  gap: 4px;
  padding: 10px 14px;
  background: #2d3432;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.marsha-typing.visible { display: flex; }

.marsha-typing-dot {
  width: 6px;
  height: 6px;
  background: rgba(249, 249, 247, 0.4);
  border-radius: 50%;
  animation: marsha-typing-bounce 1s infinite ease-in-out;
}

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

@keyframes marsha-typing-bounce {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .marsha-typing-dot { animation: none; opacity: 0.5; }
  #marsha-chat-bubble { animation: none; }
}

/* Input area */
.marsha-chat-input-area {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid rgba(249, 249, 247, 0.1);
  gap: 8px;
}

.marsha-chat-input {
  flex: 1;
  background: #2d3432 !important;
  border: none !important;
  border-radius: 8px;
  color: #F9F9F7 !important;
  font-family: 'Public Sans', sans-serif;
  font-size: 14px;
  font-weight: 300;
  padding: 10px 14px;
  outline: none;
  resize: none;
}

.marsha-chat-input::placeholder { color: rgba(249, 249, 247, 0.2) !important; }
.marsha-chat-input:focus { box-shadow: 0 0 0 1px #695C4B !important; outline: none !important; }

.marsha-chat-send {
  background: #695C4B;
  border: none;
  border-radius: 8px;
  color: #fff6ef;
  cursor: pointer;
  font-size: 16px;
  padding: 10px 14px;
  line-height: 1;
  transition: opacity 0.2s;
}

.marsha-chat-send:hover { opacity: 0.85; }
.marsha-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* Quick reply buttons */
.marsha-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
  align-self: flex-end;
}

.marsha-quick-reply {
  background: transparent;
  border: 1px solid rgba(249, 249, 247, 0.2);
  border-radius: 16px;
  color: #F9F9F7;
  font-family: 'Public Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.3;
  text-align: left;
  max-width: 100%;
}

.marsha-quick-reply:hover {
  background: rgba(105, 92, 75, 0.2);
  border-color: #695C4B;
}

.marsha-quick-reply:active {
  background: rgba(105, 92, 75, 0.35);
}

/* Multi-select: toggled-on pain button */
.marsha-quick-reply.toggled {
  background: rgba(105, 92, 75, 0.3);
  border-color: #695C4B;
}

/* Multi-select: confirm button */
.marsha-pain-confirm {
  background: #695C4B !important;
  color: #fff6ef !important;
  border-color: #695C4B !important;
  font-weight: 500;
}

.marsha-pain-confirm:hover {
  opacity: 0.85;
}

/* Frozen quick replies (after user made a selection) */
.marsha-quick-replies.frozen .marsha-quick-reply {
  cursor: default;
  pointer-events: none;
}

.marsha-quick-replies.frozen .marsha-quick-reply.dimmed {
  opacity: 0.25;
  border-color: rgba(249, 249, 247, 0.08);
}

.marsha-quick-replies.frozen .marsha-quick-reply.selected {
  background: rgba(105, 92, 75, 0.3);
  border-color: #695C4B;
  opacity: 1;
}

/* Inline signup form */
.marsha-signup-form {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #2d3432;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.marsha-signup-input {
  background: #1A1C1B !important;
  border: 1px solid rgba(249, 249, 247, 0.12) !important;
  border-radius: 8px;
  color: #F9F9F7 !important;
  font-family: 'Public Sans', sans-serif;
  font-size: 14px;
  font-weight: 300;
  padding: 10px 12px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.marsha-signup-input::placeholder { color: rgba(249, 249, 247, 0.3) !important; }
.marsha-signup-input:focus { border-color: #695C4B !important; }
.marsha-signup-input:disabled { opacity: 0.5; }

.marsha-signup-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: rgba(249, 249, 247, 0.6);
  font-family: 'Public Sans', sans-serif;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.4;
  cursor: pointer;
  padding: 4px 0;
}

.marsha-signup-consent input[type="checkbox"] {
  accent-color: #695C4B;
  margin-top: 1px;
  flex-shrink: 0;
}

.marsha-signup-submit {
  background: #695C4B;
  border: none;
  border-radius: 8px;
  color: #fff6ef;
  font-family: 'Public Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  cursor: pointer;
  transition: opacity 0.15s;
  width: 100%;
}

.marsha-signup-submit:hover { opacity: 0.85; }
.marsha-signup-submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* Mobile: full-width bottom sheet */
@media (max-width: 480px) {
  #marsha-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 85vh;
    border-radius: 16px 16px 0 0;
  }

  #marsha-chat-bubble {
    bottom: 16px;
    right: 16px;
  }
}
