/* ==========================================================================
   PVS360 / SolarERP — Interactive Draggable Floating Bubbles
   (Customer Support Live Chat & Zoho Books Integration Pill)
   ========================================================================== */

/* Never display floating bubbles on login page or unauthenticated screens */
body:has(input[name="username"]):not(:has(aside)) #pvs-zoho-launcher,
body:has(input[name="username"]):not(:has(aside)) #pvs-livechat-launcher,
body:has(input[type="password"]):not(:has(aside)) #pvs-zoho-launcher,
body:has(input[type="password"]):not(:has(aside)) #pvs-livechat-launcher,
body:has(form button[type="submit"]):not(:has(aside)) #pvs-zoho-launcher,
body:has(form button[type="submit"]):not(:has(aside)) #pvs-livechat-launcher {
  display: none !important;
}

#pvs-zoho-launcher,
#pvs-livechat-launcher {
  cursor: grab !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  touch-action: none !important;
  transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, left, top;
}

#pvs-zoho-launcher *,
#pvs-livechat-launcher * {
  cursor: grab !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Compact dimensions to prevent transparent stretch constraints */
#pvs-livechat-launcher {
  width: 56px !important;
  height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  box-sizing: border-box !important;
  z-index: 9998 !important;
}

#pvs-zoho-launcher {
  width: max-content !important;
  height: max-content !important;
  box-sizing: border-box !important;
  z-index: 9997 !important;
}

/* Fallback default positions before JavaScript applies positioning */
#pvs-livechat-launcher:not([data-pvs-positioned="true"]) {
  bottom: 24px;
  right: 24px;
}

#pvs-zoho-launcher:not([data-pvs-positioned="true"]) {
  bottom: 24px;
  right: 96px;
}

/* Clear bottom/right and allow unrestricted movement once positioned */
#pvs-livechat-launcher[data-pvs-positioned="true"],
#pvs-zoho-launcher[data-pvs-positioned="true"] {
  bottom: auto !important;
  right: auto !important;
  margin: 0 !important;
}

/* Dragging Active State */
#pvs-zoho-launcher.pvs-bubble-dragging,
#pvs-livechat-launcher.pvs-bubble-dragging {
  cursor: grabbing !important;
  transform: scale(1.06) !important;
  box-shadow: 0 25px 40px -8px rgba(0, 0, 0, 0.35), 0 0 24px rgba(245, 158, 11, 0.3) !important;
  z-index: 99999 !important;
  transition: none !important;
}

#pvs-zoho-launcher.pvs-bubble-dragging *,
#pvs-livechat-launcher.pvs-bubble-dragging * {
  cursor: grabbing !important;
}

/* Subtle drag handle indicator on Zoho Books pill */
.pvs-zoho-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  opacity: 0.6;
  margin-right: 2px;
  font-size: 11px;
  letter-spacing: -1.5px;
  cursor: grab;
  transition: opacity 0.2s ease, color 0.2s ease;
}

#pvs-zoho-launcher:hover .pvs-zoho-drag-handle {
  opacity: 1;
  color: #0284c7;
}

/* Subtle drag ring on Live Chat bubble */
#pvs-livechat-launcher button {
  position: relative;
}

#pvs-livechat-launcher:hover {
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.45));
}
