/* =========================================================
   Custom Jivo launcher (Chatwoot-style look)
   ========================================================= */

#my-cw-launcher{
  position: fixed !important;
  inset: auto calc(18px + env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) auto !important;
  z-index: 2147483640 !important; /* below Jivo */
  pointer-events: auto !important;

  transform: translateZ(0);
  isolation: isolate;

  display: inline-flex;
  align-items: center;
  gap: 12px;

  padding: 10px 16px 10px 12px;
  min-height: 66px;

  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;

  background: #8965e0; /* online default */
  color: #fff;

  font: 700 14px/1.1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: .1px;

  box-shadow: 0 12px 28px rgba(0,0,0,.22);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;

  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

#my-cw-launcher:hover{
  transform: translate3d(0,-1px,0);
  box-shadow: 0 16px 34px rgba(0,0,0,.26);
  background: #9574e4; /* fallback */
  background: color-mix(in srgb, #8965e0 92%, #ffffff 8%);
}

#my-cw-launcher:active{
  transform: translate3d(0,0,0);
  background: #7a57d2; /* fallback */
  background: color-mix(in srgb, #8965e0 88%, #000000 12%);
}

#my-cw-launcher:focus-visible{
  outline: none;
  box-shadow:
    0 0 0 4px rgba(17,205,239,.35),
    0 12px 28px rgba(0,0,0,.22);
}

#my-cw-launcher img{
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: block;
  object-fit: cover;

  border: 2px solid rgba(255,255,255,.55);
  box-shadow: 0 1px 2px rgba(0,0,0,.16);
}

/* Avatar wrapper + presence dot */
#my-cw-launcher .cw-avatar{
  position: relative;
  display: block;
  line-height: 0;
  flex: 0 0 auto;
}

#my-cw-launcher .cw-presence{
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;

  background: #6c757d; /* offline default */
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  pointer-events: none;
}

/* ===== Two-line label styling (NEW) ===== */
#my-cw-launcher .cw-label{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  line-height: 1.05;
}

#my-cw-launcher .cw-line1{
  display: block;
  font-size: var(--cs-base, 14px); /* NEW */
}

#my-cw-launcher .cw-line2{
  display: block;
  font-size: var(--cs-sm, 12px);   /* NEW */
  font-weight: 600;
  opacity: .95;
}

/* Presence colors */
#my-cw-launcher.cw-online .cw-presence{ background: #2dce89; }
#my-cw-launcher.cw-offline .cw-presence{ background: #6c757d; }
#my-cw-launcher.cw-busy .cw-presence{ background: #ff6900; }

/* OFFLINE button tint */
#my-cw-launcher.cw-offline{
  background: #6c757d;
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
#my-cw-launcher.cw-offline:hover{
  background: #7a838a; /* fallback */
  background: color-mix(in srgb, #6c757d 92%, #ffffff 8%);
}
#my-cw-launcher.cw-offline:active{
  background: #5e6870; /* fallback */
  background: color-mix(in srgb, #6c757d 88%, #000000 12%);
}

/* BUSY (optional) */
#my-cw-launcher.cw-busy{ background: #ff6900; }
#my-cw-launcher.cw-busy:hover{ background: color-mix(in srgb, #ff6900 92%, #ffffff 8%); }
#my-cw-launcher.cw-busy:active{ background: color-mix(in srgb, #ff6900 88%, #000000 12%); }

/* =========================================================
   Jivo visibility + stacking (don’t use display:none)
   ========================================================= */

/* Keep Jivo above launcher */
jdiv{
  z-index: 2147483647 !important;
  transition: opacity .15s ease, transform .15s ease;
}

/* Hidden (minimized state) - invisible + not clickable, but still "alive" */
html.jivo-hidden jdiv{
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translate3d(0, 120px, 0) !important;
}

/* =========================================================
   Mobile (icon-only) — keep FACE visible
   ========================================================= */
@media (max-width: 520px){
  #my-cw-launcher{
    width: 72px;
    height: 72px;
    padding: 0;
    gap: 0;
    justify-content: center;

    font-size: 0;
    line-height: 0;
  }

  /* Hide ONLY the text label */
  #my-cw-launcher .cw-label{
    display: none !important;
  }

  /* Keep avatar visible */
  #my-cw-launcher .cw-avatar{
    display: block !important;
  }

  #my-cw-launcher img{
    width: 60px;
    height: 60px;
  }
}

@media (prefers-reduced-motion: reduce){
  #my-cw-launcher{ transition: none; }
  jdiv{ transition: none; }
}

