@use 'ui-design-system/src/styles/semantic/index' as *;
.ui-text-button {
  // Reset and base styles
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  outline: none;
  position: relative;
  overflow: hidden;
  
  // Typography
  font-family: $semantic-typography-font-family-sans;
  font-weight: $semantic-typography-font-weight-medium;
  text-align: center;
  text-transform: none;
  letter-spacing: $semantic-typography-letter-spacing-wide;
  white-space: nowrap;
  color: $semantic-color-interactive-primary;
  
  // Interaction states
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  border-radius: $semantic-border-radius-sm;
  
  // Transitions
  transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease-out;
  
  // Size variants
  &--small {
    height: $semantic-spacing-8; // 2rem
    padding: 0 $semantic-spacing-1; // 0.25rem
    font-size: $semantic-typography-font-size-sm;
    line-height: $semantic-typography-line-height-normal;
    min-width: $semantic-spacing-12; // 3rem
  }
  
  &--medium {
    height: $semantic-spacing-10; // 2.5rem
    padding: 0 $semantic-spacing-2; // 0.5rem
    font-size: $semantic-typography-font-size-md;
    line-height: $semantic-typography-line-height-normal;
    min-width: $semantic-spacing-16; // 4rem
  }
  
  &--large {
    height: $semantic-spacing-12; // 3rem
    padding: 0 $semantic-spacing-3; // 0.75rem
    font-size: $semantic-typography-font-size-lg;
    line-height: $semantic-typography-line-height-normal;
    min-width: $semantic-spacing-20; // 5rem
  }
  
  // Hover states
  &:hover:not(:disabled) {
    background-color: rgba($semantic-color-brand-primary, 0.08);
    color: $semantic-color-brand-primary;
  }
  
  &:active:not(:disabled) {
    background-color: rgba($semantic-color-brand-primary, 0.12);
    transform: scale(0.98);
  }
  
  &:focus-visible {
    background-color: rgba($semantic-color-brand-primary, 0.08);
    box-shadow: $semantic-shadow-button-focus;
  }
  
  // States
  &--disabled {
    opacity: $semantic-opacity-disabled;
    cursor: not-allowed;
    pointer-events: none;
  }
  
  &--loading {
    cursor: wait;
    
    .text-button-content {
      opacity: $semantic-opacity-invisible;
    }
  }
  
  // Loader styles
  .text-button-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .text-button-spinner {
    width: $semantic-spacing-3-5; // 0.875rem
    height: $semantic-spacing-3-5; // 0.875rem
    border: $semantic-border-width-2 solid rgba($semantic-color-brand-primary, 0.3); // closest to 1.5px
    border-top: $semantic-border-width-2 solid $semantic-color-brand-primary;
    border-radius: $semantic-border-radius-full;
    animation: spin 1s $semantic-motion-easing-linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  // Ripple effect (basic implementation)
  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba($semantic-color-brand-primary, 0.12) 0%, transparent 70%);
    transform: scale(0);
    opacity: $semantic-opacity-invisible;
    pointer-events: none;
    transition: transform $semantic-motion-duration-normal $semantic-motion-easing-ease, opacity $semantic-motion-duration-normal $semantic-motion-easing-ease;
    border-radius: inherit;
  }
  
  &:active:not(:disabled)::after {
    transform: scale(1);
    opacity: $semantic-opacity-opaque;
    transition: none;
  }
}