// Skeleton component - Loading placeholders

/**
 * @section Skeleton Base
 */

/** @public Base skeleton with shimmer animation */
.skeleton {
  position: relative;
  background-color: hsl(var(--muted));
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 1rem;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      hsl(var(--muted-foreground) / 0.1) 20%,
      hsl(var(--muted-foreground) / 0.2) 50%,
      hsl(var(--muted-foreground) / 0.1) 80%,
      transparent 100%
    );
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
  }

  /**
   * @section Skeleton Variants
   */

  /** @public Text line skeleton - 100% width */
  &.skeleton-text {
    width: 100%;
    height: 1em;
    margin-bottom: 0.5em;

    &:last-child {
      width: 80%;
    }
  }

  /** @public Title skeleton - 50% width */
  &.skeleton-title {
    width: 50%;
    height: 1.75em;
    margin-bottom: 1em;
  }

  /** @public Avatar skeleton - circle 3rem */
  &.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;

    &.skeleton-sm {
      width: 2rem;
      height: 2rem;
    }

    &.skeleton-lg {
      width: 4rem;
      height: 4rem;
    }
  }

  /** @public Button skeleton - 5rem x 2.5rem */
  &.skeleton-button {
    width: 5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
  }

  /** @public Card skeleton - 200px height */
  &.skeleton-card {
    width: 100%;
    height: 200px;
    border-radius: var(--radius-lg);
  }

  /** @public Image skeleton - 16:9 aspect ratio */
  &.skeleton-image {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; // 16:9 aspect ratio
    border-radius: var(--radius-md);
  }
}

// Animations
@keyframes skeleton-shimmer {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(100%);
  }
}
