/* AI footer bar — fixed above page chrome, offset past UnifiedSidebar */
.ai-footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
}

@media (min-width: 1024px) {
  .ai-footer-bar {
    left: var(--sidebar-width-expanded, 240px);
  }

  .unified-sidebar.collapsed ~ .content-container .ai-footer-bar,
  .main-content-wrapper:has(.unified-sidebar.collapsed) .ai-footer-bar {
    left: var(--sidebar-width-collapsed, 64px);
  }
}

/* Event overview pages add an inner nav (Pro In-House / Pro Independent) */
.ai-footer-host--event-overview {
  --ai-footer-extra-left: 210px;
}

@media (min-width: 1024px) {
  /* When the secondary event-overview nav is collapsed (~52px), shrink the
     footer's extra-left offset to match so it doesn't leave a ~158px gap.
     Both the primary-expanded and primary-collapsed rules below read this
     custom property, so the primary-collapse handling is preserved. */
  .ai-footer-host--event-overview:has(.secondary-event-nav--collapsed) {
    --ai-footer-extra-left: 52px;
  }

  .ai-footer-host--event-overview .ai-footer-bar {
    left: calc(var(--sidebar-width-expanded, 240px) + var(--ai-footer-extra-left, 210px));
  }

  .main-content-wrapper:has(.unified-sidebar.collapsed) .ai-footer-host--event-overview .ai-footer-bar {
    left: calc(var(--sidebar-width-collapsed, 64px) + var(--ai-footer-extra-left, 210px));
  }
}

/* Chat panel sits above footer bar but below image lightbox */
.ai-chat-panel {
  position: fixed;
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  bottom: 80px;
  right: 20px;
  width: min(570px, calc(100vw - 40px));
  height: 70vh;
  max-height: calc(100vh - 140px);
  border-radius: 16px;
  border: 1px solid var(--n-200);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
}

@media (min-width: 1024px) {
  .ai-footer-host--event-overview .ai-chat-panel {
    right: max(20px, calc((100vw - var(--sidebar-width-expanded, 240px) - var(--ai-footer-extra-left, 210px) - 570px) / 2));
  }
}

/* Drag + resize (desktop). Header is the drag handle; corner handle resizes. */
.ai-chat-drag { cursor: grab; touch-action: none; }
.ai-chat-drag.is-grabbing { cursor: grabbing; }
.ai-chat-resize {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  opacity: 0.55;
  touch-action: none;
  z-index: 2;
}
.ai-chat-resize:hover { opacity: 0.9; }
/* Dragging on touch devices isn't offered; the mobile sheet is used there instead. */
@media (max-width: 1023px) {
  .ai-chat-resize { display: none; }
  .ai-chat-drag { cursor: default; }
}
