/**
 * Skeleton Loaders - Content Loading States
 * Provides visual feedback while content is loading
 */

/* Base skeleton style */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  overflow: hidden;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Skeleton variants */

.skeleton-card {
  width: 100%;
  height: 400px;
  border-radius: 8px;
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  display: block;
}

.skeleton-text.large {
  height: 20px;
}

.skeleton-text.small {
  height: 12px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 16px;
  display: block;
}

.skeleton-subtitle {
  height: 20px;
  width: 80%;
  margin-bottom: 12px;
  display: block;
}

.skeleton-avatar {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  display: inline-block;
}

.skeleton-avatar.small {
  width: 48px;
  height: 48px;
}

.skeleton-avatar.large {
  width: 200px;
  height: 200px;
}

.skeleton-image {
  width: 100%;
  height: 240px;
  border-radius: 8px;
  display: block;
}

.skeleton-button {
  height: 40px;
  width: 120px;
  border-radius: 6px;
  display: inline-block;
}

.skeleton-badge {
  height: 24px;
  width: 80px;
  border-radius: 4px;
  display: inline-block;
}

.skeleton-table-cell {
  height: 16px;
  width: 100%;
  margin-bottom: 12px;
  display: block;
}

.skeleton-bar {
  height: 8px;
  width: 100%;
  border-radius: 4px;
  margin-bottom: 8px;
  display: block;
}

/* Skeleton container for complex layouts */
.skeleton-container {
  display: grid;
  gap: var(--spacing-md);
}

.skeleton-container.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.skeleton-container.three-col {
  grid-template-columns: repeat(3, 1fr);
}

/* Skeleton for table rows */
.skeleton-row {
  display: flex;
  gap: var(--spacing-base);
  margin-bottom: 12px;
}

.skeleton-row .skeleton-cell {
  flex: 1;
  height: 40px;
  border-radius: 4px;
}

/* Pulsing animation variant */
.skeleton.pulse {
  animation: pulse-shimmer 1.5s ease-in-out infinite;
}

@keyframes pulse-shimmer {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* Loading state overlay */
.loading-overlay {
  position: relative;
  pointer-events: none;
}

.loading-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.05);
  border-radius: inherit;
  z-index: 10;
}

/* Skeleton list */
.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-base);
}

.skeleton-list-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--spacing-base);
  padding: var(--spacing-base);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.skeleton-list-item .skeleton-avatar {
  grid-row: 1 / 3;
}

.skeleton-list-item .skeleton-title {
  margin-bottom: 4px;
  width: 40%;
}

.skeleton-list-item .skeleton-text {
  margin-bottom: 0;
  width: 60%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .skeleton-container.two-col {
    grid-template-columns: 1fr;
  }

  .skeleton-container.three-col {
    grid-template-columns: repeat(2, 1fr);
  }

  .skeleton-title {
    width: 100%;
  }

  .skeleton-subtitle {
    width: 100%;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .skeleton {
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.08) 25%,
      rgba(255, 255, 255, 0.15) 50%,
      rgba(255, 255, 255, 0.08) 75%
    );
  }

  .skeleton-list-item {
    background: rgba(255, 255, 255, 0.03);
  }

  .loading-overlay::after {
    background: rgba(0, 0, 0, 0.1);
  }
}

/* Accessibility - respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: rgba(255, 255, 255, 0.08);
  }

  .skeleton.pulse {
    animation: none;
    opacity: 0.8;
  }
}
