/**
 * PROMPT 255.2 / 255.5 — Floating AI Assistant FAB polish
 * Transparent premium robot · bottom-left default · drag uses has-custom-pos.
 * Badge: hidden unless real unread via data-badge (no placeholder "1").
 * Settings never inside chat panel (255.5).
 */

/* Kill PROMPT 248 forced bottom-RIGHT dock rules */
html body #hp-robot-dock,
html body.home-page-cosmic #hp-robot-dock,
html body.home-page-cosmic .hp-robot-dock,
html body.home-page-cosmic .hp-robot-naked,
body.home-page #hp-robot-dock {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

/* Single visible launcher: transparent Anima (default bottom-LEFT only when NOT dragged) */
html body #mftAsstFab.mft-asst-fab,
html body .mft-asst-fab#mftAsstFab,
html body.home-page-cosmic #mftAsstFab.mft-asst-fab,
html body.home-page-cosmic .mft-asst-fab,
body .mft-asst-fab {
  display: grid !important;
  visibility: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  width: 72px !important;
  height: 72px !important;
  position: fixed !important;
  z-index: 9990 !important;
  border-radius: 50% !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 0 16px rgba(103, 232, 249, 0.32))
    drop-shadow(0 10px 22px rgba(15, 23, 42, 0.14)) !important;
  cursor: grab !important;
  overflow: visible !important;
}

/* Default dock — only without custom drag position */
html body #mftAsstFab.mft-asst-fab:not(.has-custom-pos),
html body .mft-asst-fab#mftAsstFab:not(.has-custom-pos),
html body.home-page-cosmic #mftAsstFab.mft-asst-fab:not(.has-custom-pos),
body .mft-asst-fab:not(.has-custom-pos) {
  left: max(16px, env(safe-area-inset-left, 0px)) !important;
  right: auto !important;
  top: auto !important;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
  inset: auto auto calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)) !important;
}

/* Custom drag position ALWAYS wins (PROMPT 255.5) */
html body #mftAsstFab.mft-asst-fab.has-custom-pos,
html body .mft-asst-fab#mftAsstFab.has-custom-pos,
html body.home-page-cosmic #mftAsstFab.has-custom-pos,
html body .mft-asst-fab.has-custom-pos {
  inset: unset !important;
  right: auto !important;
  bottom: auto !important;
  left: var(--anima-x, 16px) !important;
  top: var(--anima-y, 16px) !important;
  transform: none !important;
}

html body #mftAsstFab.mft-asst-fab:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 26px rgba(103, 232, 249, 0.48))
    drop-shadow(0 0 36px rgba(129, 140, 248, 0.22))
    drop-shadow(0 12px 28px rgba(15, 23, 42, 0.16)) !important;
}

/* Undo hp-asst-fab-hidden if applied */
html body #mftAsstFab.hp-asst-fab-hidden,
html body .mft-asst-fab.hp-asst-fab-hidden {
  opacity: 1 !important;
  pointer-events: auto !important;
  width: 72px !important;
  height: 72px !important;
  overflow: visible !important;
  background: transparent !important;
}

/* Badge: only show for real unread (data-badge numeric > 0). Never for placeholder "1" without product meaning. */
html body #mftAsstFab.mft-asst-fab::after {
  content: none !important;
  display: none !important;
}

/* Panel near bottom-left (unchanged behavior) */
html body #mftAsstPanel.mft-asst-panel,
html body .mft-asst-panel#mftAsstPanel,
html body.home-page-cosmic .mft-asst-panel,
html body .mft-asst-panel:not(.mft-pos-drawer) {
  left: max(12px, env(safe-area-inset-left, 0px)) !important;
  right: auto !important;
  bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
  top: auto !important;
  inset: auto auto calc(110px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)) !important;
  font-family: Vazirmatn, Vazir, Tahoma, system-ui, sans-serif !important;
  direction: rtl;
  z-index: 9991 !important;
  display: none;
}
html body #mftAsstPanel.mft-asst-panel.open,
html body .mft-asst-panel.open {
  display: flex !important;
}

/* Adaptive smart placement wins over fixed bottom-left panel rules */
html body #mftAsstPanel.mft-asst-panel.mft-pos-smart,
html body .mft-asst-panel.mft-pos-smart {
  inset: unset !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
}
/* Kill settings chrome if any leaked into panel */
html body #mftAsstPanel #pe-ai-assistant-prefs-host,
html body #mftAsstPanel .pe-ai-prefs,
html body #mftAsstPanel .pe-ai-prefs-in-assistant {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

#paFab213 {
  display: none !important;
}

@media (max-width: 860px) {
  html body #mftAsstFab.mft-asst-fab:not(.has-custom-pos) {
    width: 56px !important;
    height: 56px !important;
    left: max(12px, env(safe-area-inset-left, 0px)) !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }
  html body #mftAsstPanel.mft-asst-panel:not(.mft-pos-smart) {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    bottom: 0 !important;
    max-height: min(90dvh, 760px) !important;
    border-radius: 24px 24px 0 0 !important;
    inset: auto 0 0 0 !important;
  }
}
