/* ===== Scoped widget CSS: only affects #ms-chat and #ms-wa-toggle ===== */
#ms-chat, #ms-chat * , #ms-wa-toggle, #ms-wa-toggle * {
  --msw-green: #25d366;
  --msw-dark-green: #1fa84a;
  --msw-header-start: #2ea44d;
  --msw-header-end: #1e8a48;
  --msw-bubble-bg: #f3eadf;
  --msw-widget-width: 320px;
  --msw-radius: 14px;
  --msw-shadow: 0 8px 24px rgba(0,0,0,0.18);
  --msw-font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}
/* Remove black outline/focus ring from WhatsApp toggle */
#ms-wa-toggle,
#ms-wa-toggle:focus,
#ms-wa-toggle:active,
#ms-wa-toggle:focus-visible,
#ms-wa-toggle .ms-wa-inner,
#ms-wa-toggle .ms-wa-inner:focus,
#ms-wa-toggle .ms-wa-inner:active,
#ms-wa-toggle .ms-wa-inner:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}


#ms-chat * { box-sizing: border-box; }

#ms-chat {
  width: var(--msw-widget-width) !important;
  position: fixed !important;
  right: 20px !important;
  bottom: 84px !important;
  background: linear-gradient(180deg,#ffffff,#fbfaf7);
  border-radius: var(--msw-radius);
  box-shadow: var(--msw-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
  transform: none !important;
  backface-visibility: hidden !important;
  perspective: none !important;
  isolation: isolate;
  opacity: 0;
  transition: opacity .24s ease;
  will-change: opacity;
  max-height: 80vh;
  min-height: 300px;
  z-index: 10060 !important;
  font-family: var(--msw-font);
  font-size: 14px;
  line-height: 1.45;
}

#ms-chat.open { display: flex; opacity: 1; pointer-events: auto; }
#ms-chat:not(.open) { display: none; opacity: 0; pointer-events: none; }

#ms-chat .ms-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 14px;
  background: linear-gradient(90deg,var(--msw-header-start),var(--msw-header-end));
  color:#fff;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}

#ms-chat .ms-brand { display:flex; align-items:center; gap:10px; }

#ms-chat .ms-logo {
  width:56px;
  height:56px;
  object-fit:contain;
  background: #fff;
  padding:6px;
  border-radius:6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.04);
  flex-shrink:0;
}

#ms-chat .ms-title { line-height:1; }
#ms-chat .ms-name { font-weight:700; font-size:14px; letter-spacing:0.1px; }
#ms-chat .ms-status { font-size:12px; opacity:0.95; margin-top:2px; }

#ms-chat .ms-close {
  background:transparent; border:none; color:rgba(255,255,255,0.95);
  font-size:16px; cursor:pointer; padding:6px; line-height:1;
}

#ms-chat .ms-body {
  padding:16px;
  background:transparent;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0; /* critical fix */
}

#ms-chat .ms-bubble {
  background: var(--msw-bubble-bg);
  color:#333;
  padding:14px 16px;
  border-radius:14px;
  border-top-left-radius:8px;
  border-bottom-right-radius:8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  font-size:14px;
  line-height:1.45;
  word-wrap: break-word !important;
  overflow-wrap: anywhere !important;
}

#ms-chat .ms-footer {
  display:flex;
  gap:8px;
  align-items:center;
  padding:12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.88));
  border-top:1px solid rgba(0,0,0,0.03);
  flex: 0 0 auto;
}

#ms-chat .ms-input {
  flex:1;
  padding:10px 12px;
  border-radius:8px;
  border:1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.95);
  font-size:14px;
  color:#333;
  outline:none;
  min-width: 0;
}

#ms-chat .ms-send {
  width:44px;
  height:44px;
  border-radius:50%;
  border:none;
  background: linear-gradient(180deg,var(--msw-green),var(--msw-dark-green));
  display:inline-flex;
  justify-content:center;
  align-items:center;
  cursor:pointer;
  box-shadow: 0 6px 14px rgba(37,211,102,0.22);
  transition: transform .12s ease, box-shadow .12s ease;
}
#ms-chat .ms-send:active { transform: translateY(1px); }

#ms-wa-toggle {
  position: fixed !important;
  right: 20px !important;
  bottom: 20px !important;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:6px;
  background:transparent;
  border:none;
  cursor:pointer;
  z-index:10070 !important;
  transform: none !important;
  isolation: isolate;
}

#ms-wa-toggle .ms-wa-inner {
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:999px;
  background: linear-gradient(90deg,var(--msw-green),var(--msw-dark-green));
  box-shadow: 0 10px 28px rgba(37,211,102,0.18);
  color:#fff;
  font-weight:700;
  font-size:14px;
}
