/* MultiChat WhatsApp Support - Frontend Styles v1.4.0 — Redesigned */

/* ─── Google Font ─── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

/* ─── Size CSS variables ─── */
#mws-root {
  --mws-icon-size:    60px;
  --mws-popup-w:      330px;
  --mws-font-scale:   1;
  --mws-icon-img:     34px;
  --mws-popup-bottom: 80px;
  --mws-green:        #25d366;
  --mws-green-dark:   #1da851;
  --mws-header-bg:    #4FC3F7;
  --mws-header-dark:  #039BE5;
  --mws-chat-bg:      #e5ddd5;
  --mws-radius:       18px;

  position: fixed;
  z-index: 999999;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#mws-root.mws-left  { left: 20px;  bottom: 20px; }
#mws-root.mws-right { right: 20px; bottom: 20px; }

/* ─── Floating Icon ─── */
.mws-icon {
  width:  var(--mws-icon-size);
  height: var(--mws-icon-size);
  border-radius: 50%;
  background: var(--mws-green);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,.45);
  cursor: pointer;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
  animation: mws-pulse 2.5s infinite;
}
.mws-icon:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 28px rgba(37,211,102,.55);
}
.mws-icon img {
  width:  var(--mws-icon-img);
  height: var(--mws-icon-img);
  filter: brightness(0) invert(1);
}

/* ─── Popup Shell ─── */
.mws-popup {
  position: absolute;
  bottom: var(--mws-popup-bottom);
  width: var(--mws-popup-w);
  max-width: 88vw;
  background: #fff;
  border-radius: var(--mws-radius);
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.1);
  opacity: 0;
  transform: translateY(24px) scale(.95);
  pointer-events: none;
  transition: opacity .4s cubic-bezier(.4,0,.2,1),
              transform .4s cubic-bezier(.34,1.4,.64,1);
}
#mws-root.mws-left  .mws-popup { left: 0; }
#mws-root.mws-right .mws-popup { right: 0; }
.mws-popup.mws-show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.mws-popup { font-size: calc(var(--mws-font-scale) * 14px); }

/* ─── Header ─── */
.mws-header {
  background: linear-gradient(135deg, var(--mws-header-bg) 0%, var(--mws-header-dark) 100%);
  color: #fff;
  padding: 1.1em 2.5em 1em 1.1em;
  position: relative;
  display: flex;
  gap: .8em;
  align-items: flex-start;
}
.mws-header-icon {
  width: 3em;
  height: 3em;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mws-header-icon svg { width: 1.7em; height: 1.7em; fill: #fff; }
.mws-header-text { flex: 1; }
.mws-header-title {
  font-size: 1.15em;
  font-weight: 800;
  margin: 0 0 .25em;
  line-height: 1.2;
}
.mws-header-sub {
  font-size: .83em;
  opacity: .9;
  font-weight: 600;
  line-height: 1.4;
}
.mws-close {
  position: absolute;
  right: .6em; top: .5em;
  border: none;
  background: rgba(255,255,255,.18);
  color: #fff;
  width: 1.8em; height: 1.8em;
  border-radius: 50%;
  font-size: 1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  line-height: 1;
}
.mws-close:hover { background: rgba(255,255,255,.32); }

/* ─── Chat Body ─── */
.mws-body {
  background-color: var(--mws-chat-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cg opacity='.06' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Ccircle cx='15' cy='15' r='6'/%3E%3Crect x='38' y='9' width='14' height='14' rx='3'/%3E%3Ccircle cx='65' cy='15' r='4'/%3E%3Cpath d='M5 45 l10 10 l10-10'/%3E%3Ccircle cx='50' cy='50' r='8'/%3E%3Ccircle cx='15' cy='65' r='5'/%3E%3Crect x='60' y='60' width='12' height='12' rx='3'/%3E%3C/g%3E%3C/svg%3E");
  padding: .9em .85em;
  display: flex;
  flex-direction: column;
  gap: .65em;
}

/* ─── Reply badge ─── */
.mws-reply-badge {
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: .32em .9em;
  font-size: .72em;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #666;
  text-align: center;
  align-self: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ─── Agent Row ─── */
.mws-agent {
  display: flex;
  align-items: flex-start;
  gap: .65em;
  cursor: pointer;
  animation: mws-slide-in .38s ease both;
}
.mws-agent:nth-child(2) { animation-delay: .06s; }
.mws-agent:nth-child(3) { animation-delay: .12s; }
.mws-agent:nth-child(4) { animation-delay: .18s; }

/* Avatar */
.mws-agent-avatar-wrap { position: relative; flex-shrink: 0; }
.mws-agent-avatar-wrap img {
  width: 3.1em;
  height: 3.1em;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  display: block;
}
.mws-online-dot {
  position: absolute;
  bottom: 2px; right: 2px;
  width: .72em; height: .72em;
  border-radius: 50%;
  background: var(--mws-green);
  border: 2px solid #fff;
}

/* Bubble */
.mws-bubble {
  background: #fff;
  border-radius: 0 .9em .9em .9em;
  padding: .5em .75em .6em;
  max-width: 78%;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
}
.mws-bubble::before {
  content: '';
  position: absolute;
  left: -.42em; top: 0;
  width: 0; height: 0;
  border-top: .48em solid #fff;
  border-left: .48em solid transparent;
}
.mws-agent:hover .mws-bubble {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0,0,0,.14);
}
.mws-bubble-name {
  font-size: .76em;
  font-weight: 700;
  color: #999;
  margin-bottom: .15em;
}
.mws-bubble-msg {
  font-size: .93em;
  font-weight: 700;
  color: #1c1c1c;
  line-height: 1.35;
}

/* ─── Footer ─── */
.mws-footer {
  background: #f5f5f5;
  padding: .6em .85em;
  border-top: 1px solid #e8e8e8;
  text-align: center;
}
.mws-powered {
  font-size: .69em;
  color: #bbb;
  font-weight: 600;
  letter-spacing: .02em;
}
.mws-powered span { color: var(--mws-green); }

/* ─── Animations ─── */
@keyframes mws-pulse {
  0%,100% { box-shadow: 0 4px 20px rgba(37,211,102,.45); }
  50%      { box-shadow: 0 4px 20px rgba(37,211,102,.3), 0 0 0 12px rgba(37,211,102,.08); }
}
@keyframes mws-slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  #mws-root { --mws-popup-w: calc(100vw - 32px); }
  #mws-root.mws-left,
  #mws-root.mws-right { left: 16px; right: 16px; bottom: 16px; }
  #mws-root.mws-right .mws-popup { right: 0; left: auto; }
  #mws-root.mws-left  .mws-popup { left: 0; }
}

/* ════ Product Support Button ════ */
.mws-psb-cart-wrapper {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
a.mws-psb-woo,a.mws-psb-woo:link,a.mws-psb-woo:visited {
  display:inline-flex !important;align-items:center;gap:8px;
  background:var(--mws-psb-color,#25d366) !important;color:#fff !important;
  text-decoration:none !important;border:none !important;
  border-radius:3px;padding:0.8em 1.4em;font-size:1em;font-weight:700;
  line-height:1;cursor:pointer;white-space:nowrap;
  transition:background .2s,transform .15s,box-shadow .2s;
  box-shadow:0 2px 6px rgba(0,0,0,.15);vertical-align:middle;
}
a.mws-psb-woo:hover,a.mws-psb-woo:focus {
  background:color-mix(in srgb,var(--mws-psb-color,#25d366) 85%,#000) !important;
  color:#fff !important;transform:translateY(-1px);
  box-shadow:0 4px 12px rgba(0,0,0,.22);outline:none;
}
a.mws-psb-woo .mws-psb-woo-icon { width:1.2em;height:1.2em;flex-shrink:0;fill:#fff; }
@media(max-width:480px){
  .mws-psb-cart-wrapper{flex-direction:column;align-items:stretch;}
  a.mws-psb-woo{justify-content:center;width:100%;}
}
