/*
 * Popover: a portalled panel on the popup level (`.dx-popup` supplies size, level and radius). Unpadded: the call site
 * decides its content's inset (Body brings its own gutter, Header its own padding).
 */

@layer dx-components {
  .dx-popover {
    display: flex;
    flex-direction: column;
    gap: var(--dx-gap-size);
    min-width: 12rem;
    max-width: min(24rem, 100vw - 1rem);
    max-height: var(--available-height, none);
    padding: 0;
  }

  /* Fills what Header and Footer leave; its inset gutter is the content's inset, and the thumb sits in it. */
  .dx-popover-body {
    flex: 1 1 auto;
    min-height: 0;
    /* Clipped to the panel's corners: in an unpadded panel the body's content meets the rounded border. */
    border-radius: inherit;
    overflow: hidden;
  }
  /* A body whose content has not mounted yet (a lazily loaded surface) would show the panel collapsed to its border. */
  .dx-popover:has(> .dx-popover-body .dx-scroll-viewport:empty) {
    visibility: hidden;
  }

  /* A trailing CloseTrigger's inset cell ends at the panel's padding edge, like `Field.Header`'s trailing icon-only Button. */
  .dx-popover-header {
    margin: var(--dx-gap-size) var(--dx-gap-size) 0;
    display: flex;
    align-items: center;
    gap: var(--dx-gap-size);
    min-height: var(--dx-block-size);
  }

  .dx-popover-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: var(--dx-font-size);
    line-height: var(--dx-line-height);
    font-weight: 500;
  }

  .dx-popover-description {
    margin: 0;
    color: var(--color-fg-muted);
  }
}
