/* Tooltip component styles */

/* Base tooltip styles */
.tooltip {
  @apply max-w-xs origin-(--trigger-anchor-point) bg-overlay p-2 text-xs break-all;
  border-radius: min(32px, var(--radius-xl));
  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="overlay-arrow"] {
    @apply stroke-border/40;
    fill: var(--overlay);
  }

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

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

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

/* Tooltip trigger */
.tooltip__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;

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