/* BioStudio AI — mobile floating overlays (sync HUD, toasts, AI FABs) */

/* ---- Draggable floating chrome ---- */
.mobile-floating {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-floating-dragging {
  opacity: 0.92;
  z-index: 10050 !important;
  transition: none !important;
}

.mobile-float-handle {
  cursor: grab;
  touch-action: none;
}

.mobile-float-handle:active {
  cursor: grabbing;
}

.mobile-toast-grip {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(60, 60, 67, 0.25);
  margin: 0 auto 6px;
}

/* ---- Sync HUD: top-right default on mobile ---- */
#os.shell-mobile .sync-hud-anchor {
  right: auto;
  bottom: auto;
  left: auto;
  top: auto;
  width: auto !important;
  max-width: none !important;
  overflow: visible;
  border-radius: 0;
}

#os.shell-mobile .sync-hud {
  right: auto;
  bottom: auto;
  left: auto;
  top: auto;
  min-width: 0;
  max-width: min(280px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
  margin-left: 0;
}

#os.shell-mobile .sync-hud-compact {
  display: none !important;
}

#os.shell-mobile .sync-hud-drag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 4px;
  cursor: grab;
  touch-action: none;
}

#os.shell-mobile .sync-hud-grip {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

#os.shell-mobile .sync-hud-collapse {
  margin-left: auto;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #e8eaf0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

#os.shell-mobile .sync-hud-body {
  padding: 0 12px 10px;
}

#os.shell-mobile .sync-hud.collapsed .sync-hud-body {
  display: none;
}

#os.shell-mobile .sync-hud.collapsed {
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 44px;
  border-radius: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#os.shell-mobile .sync-hud.collapsed .sync-hud-drag,
#os.shell-mobile .sync-hud.collapsed .sync-hud-body {
  display: none;
}

#os.shell-mobile .sync-hud.collapsed::after {
  content: "☁";
  font-size: 18px;
}

#os.shell-mobile .sync-hud.collapsed.show::after {
  opacity: 1;
}

/* ---- Toasts: top banner stack ---- */
#os.shell-mobile .toast-layer {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 12px;
  right: 12px;
  bottom: auto;
  width: auto;
  max-width: none;
  align-items: stretch;
  z-index: 9600;
  pointer-events: none;
}

#os.shell-mobile .toast-layer.mobile-toast-float {
  pointer-events: auto;
  width: min(340px, calc(100vw - 24px));
  right: auto;
}

#os.shell-mobile .toast {
  width: 100%;
  max-width: none;
  transform: translateY(-130%);
  pointer-events: auto;
}

#os.shell-mobile .toast.show {
  transform: translateY(0);
}

/* ---- AI FABs: bottom-left above tab bar ---- */
#os.shell-mobile .studio-ai-fab,
#os.shell-mobile .eln-ai-fab,
#os.shell-mobile .ad-ai-fab {
  right: auto !important;
  left: 16px;
  bottom: calc(var(--ios-tab-h, 49px) + 12px) !important;
  z-index: 50;
}

#os.shell-mobile .studio-ai-panel {
  display: none !important;
}

#os.shell-mobile .studio-ai-host.mobile-ai-sheet-open .studio-ai-fab {
  display: none;
}

/* ELN chat window on mobile — full width sheet style */
#os.shell-mobile .eln-aiwin {
  left: 8px !important;
  right: 8px !important;
  bottom: calc(var(--ios-tab-h, 49px) + 8px) !important;
  width: auto !important;
  max-width: none;
  min-width: 0;
}

/* ---- Content safe-area / overflow guards ---- */
#os.shell-mobile .mobile-stack-body .window-body,
#os.shell-mobile .mobile-apps-pane {
  padding-bottom: 4px;
  max-width: 100vw;
  overflow-x: hidden;
}

#os.shell-mobile .app,
#os.shell-mobile .studio,
#os.shell-mobile .org-platform-app {
  min-width: 0;
  max-width: 100%;
}

#os.shell-mobile .window-body {
  scroll-padding-bottom: calc(var(--ios-tab-h, 49px) + 72px);
}
