/* ===== LIVE CHAT — visitor widget + admin inbox ========================== */

/* ---- Floating visitor widget -------------------------------------------- */
#mfChatRoot { position: fixed; right: 22px; bottom: 22px; z-index: 1200; font-family: var(--font-body, Inter, sans-serif); }

.mf-chat-toggle {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--navy, #0E1B2E); color: var(--bone, #F6F4EE);
  border: none; border-radius: 999px; cursor: pointer;
  padding: 13px 20px; font-size: 14.5px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(14,27,46,0.28);
  transition: box-shadow 0.15s ease;
  animation: mf-chat-bounce 2.6s ease-in-out infinite;
}
.mf-chat-toggle:hover {
  box-shadow: 0 12px 30px rgba(14,27,46,0.34);
  animation-play-state: paused;   /* hold still while the user aims at it */
}
.mf-chat-toggle.is-open { opacity: 0; pointer-events: none; animation: none; }
.mf-chat-toggle svg { color: var(--gold, #E0A53D); }

/* Gentle attention-grabbing bounce on the collapsed button */
@keyframes mf-chat-bounce {
  0%, 55%, 100% { transform: translateY(0); }
  70%           { transform: translateY(-9px); }
  85%           { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .mf-chat-toggle { animation: none; }
}

.mf-chat-panel {
  position: absolute; right: 0; bottom: 0;
  width: min(370px, calc(100vw - 44px)); height: min(540px, calc(100vh - 100px));
  display: flex; flex-direction: column;
  background: var(--white, #fff); border-radius: 18px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(14,27,46,0.32);
  animation: mf-chat-in 0.18s ease-out;
}
@keyframes mf-chat-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.mf-chat-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  background: var(--navy, #0E1B2E); color: var(--bone, #F6F4EE);
  padding: 16px 18px;
}
.mf-chat-head strong { font-size: 15.5px; display: block; }
.mf-chat-status { font-size: 11.5px; color: rgba(246,244,238,0.7); }
.mf-chat-close { background: none; border: none; color: var(--bone, #F6F4EE); font-size: 16px; cursor: pointer; opacity: 0.8; }
.mf-chat-close:hover { opacity: 1; }

.mf-chat-intro { padding: 16px 18px 4px; }
.mf-chat-intro p { font-size: 13.5px; color: var(--text-mute, #6b7280); margin: 0 0 12px; }
.mf-chat-fields { display: flex; flex-direction: column; gap: 8px; }
.mf-chat-fields input {
  border: 1.5px solid var(--line-light, #E7E1D3); border-radius: 9px;
  padding: 9px 11px; font-size: 13px; font-family: inherit;
}

.mf-chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.mf-msg { display: flex; }
.mf-msg.visitor { justify-content: flex-end; }
.mf-msg.system { justify-content: center; }
.mf-bubble {
  max-width: 80%; padding: 9px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.mf-msg.visitor .mf-bubble { background: var(--navy, #0E1B2E); color: var(--bone, #F6F4EE); border-bottom-right-radius: 4px; }
.mf-msg.agent .mf-bubble { background: var(--paper-2, #F0EDE4); color: var(--text-dark, #1b2333); border-bottom-left-radius: 4px; }
.mf-msg.system .mf-bubble { background: transparent; color: var(--text-mute, #9aa0aa); font-size: 12px; font-style: italic; max-width: 100%; text-align: center; }

.mf-chat-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line-light, #E7E1D3); }
.mf-chat-form input {
  flex: 1; border: 1.5px solid var(--line-light, #E7E1D3); border-radius: 999px;
  padding: 10px 15px; font-size: 13.5px; font-family: inherit;
}
.mf-chat-form input:focus { outline: 2px solid var(--gold, #E0A53D); outline-offset: 1px; }
.mf-chat-form button {
  flex-shrink: 0; width: 42px; border: none; border-radius: 50%; cursor: pointer;
  background: var(--gold, #E0A53D); color: var(--navy, #0E1B2E);
  display: inline-flex; align-items: center; justify-content: center;
}
.mf-chat-form button:hover { filter: brightness(1.05); }

/* ---- Admin inbox (embedded in admin.html) ------------------------------- */
.admin-chat-card {
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
  overflow: hidden; margin-bottom: 48px;
  display: grid; grid-template-columns: 300px 1fr; min-height: 460px;
}
@media (max-width: 720px) { .admin-chat-card { grid-template-columns: 1fr; } }

.admin-chat-list { border-right: 1px solid var(--line-light); overflow-y: auto; max-height: 560px; }
.admin-chat-list-empty { padding: 24px; color: var(--text-mute); font-size: 13.5px; text-align: center; }
.admin-convo {
  display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer;
  padding: 14px 16px; border-bottom: 1px solid var(--line-light);
}
.admin-convo:hover { background: var(--paper); }
.admin-convo.active { background: var(--gold-soft); }
.admin-convo .ac-name { font-weight: 600; font-size: 14px; color: var(--text-dark); }
.admin-convo .ac-preview { font-size: 12.5px; color: var(--text-mute); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-convo .ac-unread { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-left: 6px; }

.admin-chat-thread { display: flex; flex-direction: column; }
.admin-chat-thread-head { padding: 14px 18px; border-bottom: 1px solid var(--line-light); }
.admin-chat-thread-head strong { font-size: 15px; }
.admin-chat-thread-head span { font-size: 12.5px; color: var(--text-mute); }
.admin-chat-thread-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; max-height: 420px; }
.admin-chat-empty { margin: auto; color: var(--text-mute); font-size: 14px; padding: 40px; text-align: center; }
.admin-chat-reply { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-light); }
.admin-chat-reply input {
  flex: 1; border: 1.5px solid var(--line-light); border-radius: 999px; padding: 10px 15px; font-size: 14px; font-family: inherit;
}
.admin-chat-reply button { flex-shrink: 0; }

/* Reuse visitor bubble styles in the admin thread, but flip the perspective:
   the agent (you) is on the right, the visitor on the left. */
.admin-chat-thread-body .mf-msg.agent { justify-content: flex-end; }
.admin-chat-thread-body .mf-msg.visitor { justify-content: flex-start; }
.admin-chat-thread-body .mf-msg.agent .mf-bubble { background: var(--navy); color: var(--bone); border-bottom-right-radius: 4px; border-bottom-left-radius: 14px; }
.admin-chat-thread-body .mf-msg.visitor .mf-bubble { background: var(--paper-2); color: var(--text-dark); border-bottom-left-radius: 4px; border-bottom-right-radius: 14px; }
