/* ─── MORA Chat Widget ─────────────────────────────────────────────── */
#mora-widget { position: fixed; bottom: 20px; left: 20px; z-index: 9990; font-family: 'DM Sans', sans-serif; }

/* Trigger button */
#mora-trigger {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f, #2a5298);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(30,58,95,0.45);
  transition: transform .2s, box-shadow .2s;
  animation: mora-attention 3s ease-in-out infinite;
}
#mora-trigger:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(30,58,95,0.55); animation: none; }
#mora-trigger svg { width: 26px; height: 26px; fill: #fff; }
#mora-badge {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #e53e3e; color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

@keyframes mora-attention {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 18px rgba(30,58,95,0.45); }
  50%       { transform: scale(1.07); box-shadow: 0 6px 28px rgba(30,58,95,0.65); }
}

/* Panel */
#mora-panel {
  position: fixed; bottom: 0; left: 0; right: 0;
  width: 100%; max-width: 380px;
  height: 88vh; max-height: 600px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#mora-panel.open { transform: translateY(0); }

@media (min-width: 480px) {
  #mora-panel {
    bottom: 152px; left: 20px; right: auto;
    border-radius: 16px;
    max-height: 520px;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s, opacity .25s;
  }
  #mora-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
  }
}

/* Header */
#mora-header {
  background: linear-gradient(135deg, #0f0f14, #1e3a5f);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
#mora-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
#mora-header-info { flex: 1; }
#mora-header-name { font-size: 14px; font-weight: 700; color: #fff; }
#mora-header-sub { font-size: 11px; color: rgba(255,255,255,0.55); }
#mora-online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #48bb78; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(72,187,120,0.3);
  animation: mora-pulse-dot 2s ease-in-out infinite;
}
@keyframes mora-pulse-dot {
  0%, 100% { opacity: 1; } 50% { opacity: 0.5; }
}
#mora-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.6); font-size: 20px; padding: 4px;
  line-height: 1; flex-shrink: 0;
}
#mora-close:hover { color: #fff; }

/* Messages */
#mora-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
#mora-messages::-webkit-scrollbar { width: 4px; }
#mora-messages::-webkit-scrollbar-thumb { background: #e0ddd8; border-radius: 2px; }

.mora-msg {
  display: flex; gap: 8px; align-items: flex-end;
  animation: mora-msgIn .2s ease;
}
@keyframes mora-msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.mora-msg.user { flex-direction: row-reverse; }

.mora-bubble {
  max-width: 80%; padding: 10px 14px;
  border-radius: 16px; font-size: 13.5px; line-height: 1.55;
}
.mora-msg.bot .mora-bubble {
  background: #f0ede8; color: #0f0f14;
  border-bottom-left-radius: 4px;
}
.mora-msg.user .mora-bubble {
  background: #1e3a5f; color: #fff;
  border-bottom-right-radius: 4px;
}
.mora-msg-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f, #2a5298);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}

/* Typing indicator */
#mora-typing {
  display: none; align-items: center; gap: 8px; padding: 8px 0;
}
#mora-typing.show { display: flex; }
.mora-typing-dots { display: flex; gap: 4px; padding: 10px 14px; background: #f0ede8; border-radius: 16px 16px 16px 4px; }
.mora-typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: #aaa;
  animation: mora-dot 1.2s ease-in-out infinite;
}
.mora-typing-dots span:nth-child(2) { animation-delay: .2s; }
.mora-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes mora-dot { 0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* Quick replies */
#mora-quickreplies {
  padding: 4px 16px 12px;
  display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0;
}
.mora-qr {
  padding: 6px 12px; border-radius: 20px;
  border: 1px solid #1e3a5f; background: #fff;
  color: #1e3a5f; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.mora-qr:hover { background: #1e3a5f; color: #fff; }

/* Input area */
#mora-inputarea {
  border-top: 1px solid #f0ede8; padding: 12px 16px;
  display: flex; gap: 10px; align-items: flex-end; flex-shrink: 0;
}
#mora-input {
  flex: 1; border: 1px solid #e5e2dc; border-radius: 12px;
  padding: 10px 14px; font-size: 13.5px; font-family: inherit;
  resize: none; outline: none; line-height: 1.4; max-height: 96px;
  background: #fafaf8; color: #0f0f14;
  transition: border-color .15s;
}
#mora-input:focus { border-color: #1e3a5f; background: #fff; }
#mora-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: #1e3a5f; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
#mora-send:hover { background: #162d4a; }
#mora-send svg { width: 18px; height: 18px; fill: #fff; }

/* Lead capture form */
#mora-lead-form {
  background: #f7f5f0; border-top: 1px solid #e5e2dc;
  padding: 16px; flex-shrink: 0; display: none;
}
#mora-lead-form.show { display: block; }
#mora-lead-form h4 { font-size: 13px; font-weight: 700; color: #0f0f14; margin-bottom: 10px; }
#mora-lead-form input {
  width: 100%; padding: 9px 12px; border: 1px solid #e5e2dc; border-radius: 8px;
  font-size: 13px; font-family: inherit; margin-bottom: 8px; background: #fff;
  color: #0f0f14; outline: none; box-sizing: border-box;
}
#mora-lead-form input:focus { border-color: #1e3a5f; }
#mora-lead-submit {
  width: 100%; padding: 10px; border-radius: 8px;
  background: #1e3a5f; color: #fff; border: none;
  font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: background .15s;
}
#mora-lead-submit:hover { background: #162d4a; }
#mora-lead-skip { font-size: 11px; color: #aaa; text-align: center; margin-top: 6px; cursor: pointer; }
#mora-lead-skip:hover { color: #666; }
