@use 'ui-design-system/src/styles/semantic/index' as *;

.ui-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  transition: all 150ms cubic-bezier(0, 0, 0.2, 1);
  position: relative;

  // Size variants
  &--small {
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    min-height: 1.125rem;

    &.ui-status-badge--with-icon .ui-status-badge__icon {
      font-size: 0.625rem;
    }

    &.ui-status-badge--with-dot .ui-status-badge__dot {
      width: 0.375rem;
      height: 0.375rem;
    }
  }

  &--medium {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    min-height: 1.25rem;

    &.ui-status-badge--with-icon .ui-status-badge__icon {
      font-size: 0.75rem;
    }

    &.ui-status-badge--with-dot .ui-status-badge__dot {
      width: 0.5rem;
      height: 0.5rem;
    }
  }

  &--large {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-height: 1.5rem;

    &.ui-status-badge--with-icon .ui-status-badge__icon {
      font-size: 0.875rem;
    }

    &.ui-status-badge--with-dot .ui-status-badge__dot {
      width: 0.625rem;
      height: 0.625rem;
    }
  }

  // Shape variants
  &--rounded {
    border-radius: 0.25rem;
  }

  &--pill {
    border-radius: 9999px;
  }

  &--square {
    border-radius: 0;
  }

  // Style modifiers
  &--uppercase {
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  &--bold {
    font-weight: 700;
  }

  // Success variant
  &--success {
    background: hsl(142, 76%, 90%);
    color: hsl(142, 76%, 25%);
    border: 1px solid hsl(142, 76%, 80%);

    &.ui-status-badge--outlined {
      background: transparent;
      color: hsl(142, 76%, 35%);
      border-color: hsl(142, 76%, 50%);
    }

    .ui-status-badge__dot {
      background: hsl(142, 76%, 45%);
    }
  }

  // Warning variant
  &--warning {
    background: hsl(45, 93%, 88%);
    color: hsl(45, 93%, 25%);
    border: 1px solid hsl(45, 93%, 75%);

    &.ui-status-badge--outlined {
      background: transparent;
      color: hsl(45, 93%, 35%);
      border-color: hsl(45, 93%, 50%);
    }

    .ui-status-badge__dot {
      background: hsl(45, 93%, 45%);
    }
  }

  // Danger variant
  &--danger {
    background: hsl(0, 84%, 90%);
    color: hsl(0, 84%, 25%);
    border: 1px solid hsl(0, 84%, 80%);

    &.ui-status-badge--outlined {
      background: transparent;
      color: hsl(0, 84%, 35%);
      border-color: hsl(0, 84%, 50%);
    }

    .ui-status-badge__dot {
      background: hsl(0, 84%, 45%);
    }
  }

  // Info variant
  &--info {
    background: hsl(207, 90%, 88%);
    color: hsl(207, 90%, 25%);
    border: 1px solid hsl(207, 90%, 75%);

    &.ui-status-badge--outlined {
      background: transparent;
      color: hsl(207, 90%, 35%);
      border-color: hsl(207, 90%, 50%);
    }

    .ui-status-badge__dot {
      background: hsl(207, 90%, 45%);
    }
  }

  // Neutral variant
  &--neutral {
    background: hsl(289, 14%, 90%);
    color: hsl(279, 14%, 25%);
    border: 1px solid hsl(289, 14%, 80%);

    &.ui-status-badge--outlined {
      background: transparent;
      color: hsl(279, 14%, 35%);
      border-color: hsl(289, 14%, 60%);
    }

    .ui-status-badge__dot {
      background: hsl(287, 12%, 47%);
    }
  }

  // Primary variant
  &--primary {
    background: hsl(263, 100%, 88%);
    color: hsl(260, 100%, 25%);
    border: 1px solid hsl(263, 100%, 75%);

    &.ui-status-badge--outlined {
      background: transparent;
      color: hsl(258, 100%, 47%);
      border-color: hsl(258, 100%, 47%);
    }

    .ui-status-badge__dot {
      background: hsl(258, 100%, 47%);
    }
  }

  // Secondary variant
  &--secondary {
    background: hsl(262, 25%, 84%);
    color: hsl(256, 29%, 25%);
    border: 1px solid hsl(262, 25%, 75%);

    &.ui-status-badge--outlined {
      background: transparent;
      color: hsl(258, 29%, 40%);
      border-color: hsl(258, 29%, 40%);
    }

    .ui-status-badge__dot {
      background: hsl(258, 29%, 40%);
    }
  }
}

.ui-status-badge__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.ui-status-badge__dot {
  border-radius: 50%;
  flex-shrink: 0;
}

.ui-status-badge__text {
  flex: 1;
  min-width: 0;
}

// Hover effects for interactive badges (when used in buttons, etc.)
button .ui-status-badge,
a .ui-status-badge,
[role="button"] .ui-status-badge {
  transition: all 150ms cubic-bezier(0, 0, 0.2, 1);

  &:hover {
    transform: scale(1.02);
  }
}

// High contrast mode
@media (prefers-contrast: high) {
  .ui-status-badge {
    border-width: 2px;
    font-weight: 700;

    &--outlined {
      background: buttonface;
      color: buttontext;
      border-color: buttontext;
    }
  }
}

// Reduced motion
@media (prefers-reduced-motion: reduce) {
  .ui-status-badge {
    transition: none;
  }
}