/* ============================================================
   MNS CHATBOT WIDGET — Modern redesign
   ============================================================ */

/* ── FAB trigger button ───────────────────────────────────── */
#chatbot-icon {
  position: fixed;
  bottom: 28px;
  left: 100px;
  z-index: 9999;
  cursor: pointer;
}
.mns-chat-fab {
  position: relative;
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #FBBF01 0%, #e0a800 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #01357B;
  box-shadow: 0 6px 24px rgba(251,191,1,0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}
.mns-chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(251,191,1,0.55);
}
/* ── Quick-reply chips ────────────────────────────────────── */
.mns-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 92%;
}
.mns-chip {
  background: #fff;
  border: 1.5px solid #c9d8ec;
  color: #01357B;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.mns-chip:hover { background: #eef4fc; border-color: #01357B; }

/* ── After-hours callback form ────────────────────────────── */
.mns-cbform { width: 92%; }
.mns-cbform input[type=text],
.mns-cbform input[type=tel],
.mns-cbform textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1.5px solid #dce5f0;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  background: #f8fafc;
  box-sizing: border-box;
}
.mns-cbform input:focus, .mns-cbform textarea:focus { border-color: #01357B; outline: none; background: #fff; }
.mns-cbform .cb-consent {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.5;
  cursor: pointer;
}
.mns-cbform .cb-consent input { margin-top: 2px; }
.mns-cbform .cb-err { color: #b42318; font-size: 12px; margin-top: 6px; min-height: 0; }
.mns-cbform .cb-send { margin-top: 8px; border: none; }
.mns-cbform .cb-send:disabled { opacity: 0.6; cursor: default; }

/* ── 👍/👎 answer feedback ────────────────────────────────── */
.mns-feedback {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #eef2f7;
  font-size: 11px;
  color: #94a3b8;
}
.mns-feedback button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 5px;
  border-radius: 6px;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
}
.mns-feedback button:hover { opacity: 1; background: #f1f5f9; }
.mns-feedback.done button { cursor: default; opacity: 0.25; }
.mns-feedback.done button.sel { opacity: 1; background: #eef4fc; }

/* ── Chat panel ───────────────────────────────────────────── */
#chatbot-container {
  position: fixed;
  bottom: 100px;
  left: 100px;
  width: 370px;
  max-height: 580px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
#chatbot-container.expanded {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ───────────────────────────────────────────────── */
#chat-header {
  background: linear-gradient(135deg, #01357B 0%, #012460 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mns-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mns-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mns-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mns-chat-hname {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.mns-chat-hstatus {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.mns-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.3);
}
#close-chat {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
#close-chat:hover { background: rgba(255,255,255,0.22); }

/* ── Message area ─────────────────────────────────────────── */
#chat-display {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 10px;
  background: #f4f7fb;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#chat-display::-webkit-scrollbar { width: 4px; }
#chat-display::-webkit-scrollbar-track { background: transparent; }
#chat-display::-webkit-scrollbar-thumb { background: #c9d6e8; border-radius: 4px; }

/* ── Message bubbles ──────────────────────────────────────── */
.message {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: mns-msg-in 0.2s ease;
}
@keyframes mns-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bot-message {
  background: #fff;
  color: #1a1a2e;
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  align-self: flex-start;
}
.user-message {
  background: linear-gradient(135deg, #01357B, #0250b0);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  align-self: flex-end;
}

/* ── Bot message HTML elements ────────────────────────────── */
.bot-message a {
  color: #01357B;
  text-decoration: underline;
  font-weight: 600;
}
.bot-message a:hover { color: #FBBF01; }
.bot-message ul { margin: 6px 0 4px 18px; padding: 0; }
.bot-message li { margin-bottom: 3px; }
.bot-message strong { color: #01357B; }
.bot-message small { color: #888; font-size: 12px; }

/* ── Contact / social action buttons ─────────────────────── */
.mns-chat-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.mns-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none !important;
  color: #fff !important;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.mns-chat-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  color: #fff !important;
}
.mns-chat-navy { background: #01357B; }
.mns-chat-wa   { background: #25D366; }
.mns-chat-fb   { background: #1877F2; }
.mns-chat-ig   { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.mns-chat-tw   { background: #1DA1F2; }

/* ── Input area ───────────────────────────────────────────── */
#chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e8edf4;
  flex-shrink: 0;
}
#user-input {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid #dce5f0;
  border-radius: 24px;
  font-size: 13.5px;
  outline: none;
  background: #f4f7fb;
  color: #111 !important;
  transition: border-color 0.2s, background 0.2s;
}
#user-input:focus {
  border-color: #01357B;
  background: #fff;
  color: #111 !important;
}
#user-input::placeholder { color: #9aabbe; }
#send-button {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #01357B, #0250b0);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 3px 10px rgba(1,53,123,0.35);
}
#send-button:hover {
  transform: scale(1.08);
  box-shadow: 0 5px 14px rgba(1,53,123,0.45);
}

/* ── Quiet human-agent line (deliberately understated) ────── */
#mns-agent-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 14px;
  background: #fff;
  border-top: 1px solid #eef2f7;
  flex-shrink: 0;
  font-size: 11.5px;
  color: #8296ad;
}
.mns-agent-link {
  color: #465f7d;
  font-weight: 600;
  text-decoration: underline;
}
.mns-agent-link:hover { color: #01357B; }
.mns-dot-sm  { width: 6px; height: 6px; box-shadow: none; }
.mns-dot-on  { background: #4ade80; }
.mns-dot-off { background: #b6c2d1; }

/* ── Typing indicator ─────────────────────────────────────── */
.mns-typing {
  display: flex !important;
  align-items: center;
  gap: 5px;
  padding: 12px 16px !important;
}
.mns-typing span {
  width: 8px;
  height: 8px;
  background: #b0bfd4;
  border-radius: 50%;
  display: inline-block;
  animation: mns-bounce 1.2s infinite;
}
.mns-typing span:nth-child(2) { animation-delay: 0.2s; }
.mns-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mns-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  #chatbot-container {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
  }
  #chatbot-icon { bottom: 20px; left: 78px; }
}
