/* Popover component styles */

/* Base popover styles */
.popover {
  @apply origin-(--trigger-anchor-point) bg-overlay p-0 text-sm;
  border-radius: min(32px, var(--radius-3xl));
  box-shadow: var(--shadow-overlay);

  /* Entering animations */
  &[data-entering="true"] {
    @apply animate-in duration-150 ease-smooth fade-in-0 zoom-in-90;

    /* Placement-specific translations */
    &[data-placement="top"] {
      @apply slide-in-from-bottom-1;
    }

    &[data-placement="bottom"] {
      @apply slide-in-from-top-1;
    }

    &[data-placement="left"] {
      @apply slide-in-from-right-1;
    }

    &[data-placement="right"] {
      @apply slide-in-from-left-1;
    }
  }

  /* Exiting animations */
  &[data-exiting="true"] {
    @apply animate-out duration-100 ease-smooth zoom-out-95 fade-out;
  }

  &[data-exiting="true"],
  &[data-entering="true"] {
    @apply transition-[opacity,transform] will-change-[opacity,transform];
  }

  /* Arrow styling */
  & [data-slot="popover-overlay-arrow"] {
    fill: var(--overlay);
  }

  /* Arrow rotation based on placement */
  &[data-placement="bottom"] [data-slot="popover-overlay-arrow"] {
    rotate: 180deg;
  }

  &[data-placement="left"] [data-slot="popover-overlay-arrow"] {
    rotate: -90deg;
  }

  &[data-placement="right"] [data-slot="popover-overlay-arrow"] {
    rotate: 90deg;
  }
}

/* Popover dialog */
.popover__dialog {
  @apply p-4 outline-none;
}

/* Popover heading */
.popover__heading {
  @apply font-medium;
}

/* Popover trigger */
.popover__trigger {
  @apply inline-block;

  /**
   * Transitions
   * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
   */
  transition:
    color 150ms var(--ease-smooth),
    background-color 150ms var(--ease-smooth),
    box-shadow 150ms var(--ease-out);
  @apply motion-reduce:transition-none;

  cursor: var(--cursor-interactive);

  /* Focus state */
  &:focus-visible:not(:focus),
  &[data-focus-visible="true"] {
    @apply status-focused;
  }

  /* Disabled state */
  &:disabled,
  &[aria-disabled="true"] {
    @apply status-disabled;
  }
}
