hikari-components 0.2.1

Core UI components (40+) for the Hikari design system
// Use theme variables with namespace to avoid conflicts
@use 'variables' as vars;
@use 'mixins' as mix;

// ============================================
// Hikari Tooltip Component -  Styling
// Features: Portal-based rendering, card-like appearance, smooth animations
// ============================================

// ============================================
// Tooltip Wrapper (trigger container)
// ============================================

.hi-tooltip-wrapper {
  display: inline-block;
  position: relative;
}

.hi-tooltip-trigger {
  display: inline-block;
}

// ============================================
// Base Tooltip Styles - Card-like appearance
// ============================================

.hi-tooltip {
  // Layout
  position: fixed;
  z-index: 10000;

  // Spacing
  padding: 0.5rem 0.75rem;

  // Typography
  font-family: vars.$hikari-font-family-sans;
  font-size: vars.$hikari-font-size-sm;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--hi-color-text-primary);

  // Appearance - Card-like styling (same as Card component)
  border-radius: vars.$hikari-radius-fui-sm;
  border: 1px solid rgba(226, 232, 240, 0.8);

  // Use theme surface background (not dark)
  background: var(--hi-color-surface);
  backdrop-filter: blur(4px);

  // Subtle shadow (same as Card)
  box-shadow:
    0 1px 3px var(--hi-black-10, rgba(0, 0, 0, 0.08)),
    0 0 0 1px rgba(241, 245, 249, 0.5) inset;

  // No pointer events - tooltip should not be interactive
  pointer-events: none;

  // Position for arrow
  position: relative;

  // Animation - smooth fade + scale
  opacity: 0;
  transform: scale(0.95);
  transition:
    opacity 150ms ease-out,
    transform 150ms ease-out;

  // Arrow (pseudo-element)
  &::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 5px solid transparent;
  }
}

// ============================================
// Visible State - animated entrance
// ============================================

.hi-tooltip-visible {
  opacity: 1;
  transform: scale(1);
}

// ============================================
// Arrow Positions
// ============================================

// Top
.hi-tooltip-top {
  &::before {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: rgba(226, 232, 240, 0.8);
  }
}

// Bottom
.hi-tooltip-bottom {
  &::before {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: rgba(226, 232, 240, 0.8);
  }
}

// Left
.hi-tooltip-left {
  &::before {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: rgba(226, 232, 240, 0.8);
  }
}

// Right
.hi-tooltip-right {
  &::before {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: rgba(226, 232, 240, 0.8);
  }
}

// ============================================
// Tooltip Content
// ============================================

.hi-tooltip-content {
  position: relative;
  z-index: 1;
}

// ============================================
// Size Variants
// ============================================

.hi-tooltip-sm {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 3px;

  &::before {
    border-width: 4px;
  }
}

.hi-tooltip-md {
  padding: 0.5rem 0.75rem;
  font-size: vars.$hikari-font-size-sm;
  border-radius: vars.$hikari-radius-fui-sm;
}

.hi-tooltip-lg {
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  border-radius: vars.$hikari-radius-fui-md;

  &::before {
    border-width: 6px;
  }
}

// ============================================
// Color Variants (optional)
// ============================================

// Primary (Pink)
.hi-tooltip-primary {
  border-color: rgba(238, 162, 164, 0.5);
  box-shadow:
    0 1px 3px var(--hi-black-10, rgba(0, 0, 0, 0.08)),
    0 0 12px rgba(238, 162, 164, 0.2),
    0 0 0 1px rgba(238, 162, 164, 0.3) inset;
}

// Success (Green)
.hi-tooltip-success {
  border-color: rgba(14, 184, 64, 0.5);
  box-shadow:
    0 1px 3px var(--hi-black-10, rgba(0, 0, 0, 0.08)),
    0 0 12px rgba(14, 184, 64, 0.2),
    0 0 0 1px rgba(14, 184, 64, 0.3) inset;
}

// Warning (Yellow)
.hi-tooltip-warning {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow:
    0 1px 3px var(--hi-black-10, rgba(0, 0, 0, 0.08)),
    0 0 12px rgba(245, 158, 11, 0.2),
    0 0 0 1px rgba(245, 158, 11, 0.3) inset;
}

// Error (Red)
.hi-tooltip-error {
  border-color: rgba(255, 76, 0, 0.5);
  box-shadow:
    0 1px 3px var(--hi-black-10, rgba(0, 0, 0, 0.08)),
    0 0 12px rgba(255, 76, 0, 0.2),
    0 0 0 1px rgba(255, 76, 0, 0.3) inset;
}

// ============================================
// With Icon
// ============================================

.hi-tooltip-with-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  .hi-tooltip-icon {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;

    svg {
      width: 100%;
      height: 100%;
    }
  }
}

// ============================================
// Multiline Tooltip
// ============================================

.hi-tooltip-multiline {
  white-space: normal;
  max-width: 250px;
}

// ============================================
// Rich Content Tooltip
// ============================================

.hi-tooltip-rich {
  white-space: normal;
  max-width: 300px;

  .hi-tooltip-title {
    margin: 0 0 0.25rem 0;
    font-size: vars.$hikari-font-size-sm;
    font-weight: 600;
    color: var(--hi-color-text-primary);
  }

  .hi-tooltip-content {
    margin: 0;
    font-size: vars.$hikari-font-size-sm;
    color: var(--hi-color-text-secondary);
    line-height: 1.5;
  }
}

// ============================================
// Animation Variants (placement-based)
// ============================================

// Top - slide up + fade
.hi-tooltip-top {
  transform-origin: bottom center;

  &.hi-tooltip-visible {
    transform: scale(1) translateY(0);
  }

  &:not(.hi-tooltip-visible) {
    transform: scale(0.95) translateY(4px);
  }
}

// Bottom - slide down + fade
.hi-tooltip-bottom {
  transform-origin: top center;

  &.hi-tooltip-visible {
    transform: scale(1) translateY(0);
  }

  &:not(.hi-tooltip-visible) {
    transform: scale(0.95) translateY(-4px);
  }
}

// Left - slide left + fade
.hi-tooltip-left {
  transform-origin: right center;

  &.hi-tooltip-visible {
    transform: scale(1) translateX(0);
  }

  &:not(.hi-tooltip-visible) {
    transform: scale(0.95) translateX(4px);
  }
}

// Right - slide right + fade
.hi-tooltip-right {
  transform-origin: left center;

  &.hi-tooltip-visible {
    transform: scale(1) translateX(0);
  }

  &:not(.hi-tooltip-visible) {
    transform: scale(0.95) translateX(-4px);
  }
}