/**
 * Skeleton Loader Styles
 * ======================
 * 
 * Provides skeleton placeholder styles for loading states.
 * Matches final content layout to prevent CLS (Cumulative Layout Shift).
 */

/* Base skeleton animation */
@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes skeleton-shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Base skeleton class */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 2000px 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: skeleton-shimmer 1.5s infinite;
}

/* Skeleton container */
.skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Product card skeleton */
.skeleton-product-card {
  width: 100%;
  height: 400px;
  border-radius: 8px;
  overflow: hidden;
}

.skeleton-product-image {
  width: 100%;
  height: 250px;
  margin-bottom: 1rem;
}

.skeleton-product-title {
  width: 80%;
  height: 20px;
  margin-bottom: 0.5rem;
}

.skeleton-product-price {
  width: 40%;
  height: 24px;
  margin-bottom: 0.5rem;
}

.skeleton-product-button {
  width: 100%;
  height: 40px;
  border-radius: 4px;
}

/* Table row skeleton */
.skeleton-table-row {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.skeleton-table-cell {
  flex: 1;
  height: 16px;
  margin: 0 0.5rem;
}

.skeleton-table-cell:nth-child(1) {
  width: 50px;
  flex: 0 0 50px;
}

.skeleton-table-cell:nth-child(2) {
  flex: 2;
}

.skeleton-table-cell:nth-child(3) {
  flex: 1;
}

.skeleton-table-cell:nth-child(4) {
  width: 100px;
  flex: 0 0 100px;
}

/* List item skeleton */
.skeleton-list-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.skeleton-list-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-right: 1rem;
  flex-shrink: 0;
}

.skeleton-list-content {
  flex: 1;
}

.skeleton-list-title {
  width: 60%;
  height: 16px;
  margin-bottom: 0.5rem;
}

.skeleton-list-subtitle {
  width: 40%;
  height: 12px;
}

/* Dashboard card skeleton */
.skeleton-dashboard-card {
  padding: 1.5rem;
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.skeleton-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.skeleton-card-title {
  width: 40%;
  height: 20px;
}

.skeleton-card-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.skeleton-card-value {
  width: 60%;
  height: 32px;
  margin-bottom: 0.5rem;
}

.skeleton-card-label {
  width: 30%;
  height: 14px;
}

/* Chart skeleton */
.skeleton-chart {
  width: 100%;
  height: 300px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.skeleton-chart::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.05) 0%,
    transparent 100%
  );
}

/* Text skeleton */
.skeleton-text {
  height: 16px;
  margin-bottom: 0.5rem;
}

.skeleton-text-line {
  height: 16px;
  margin-bottom: 0.5rem;
}

.skeleton-text-line:last-child {
  width: 60%;
  margin-bottom: 0;
}

/* Image skeleton */
.skeleton-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
}

/* Button skeleton */
.skeleton-button {
  width: 120px;
  height: 40px;
  border-radius: 4px;
}

.skeleton-button-small {
  width: 80px;
  height: 32px;
  border-radius: 4px;
}

/* Form skeleton */
.skeleton-form-group {
  margin-bottom: 1.5rem;
}

.skeleton-form-label {
  width: 30%;
  height: 14px;
  margin-bottom: 0.5rem;
}

.skeleton-form-input {
  width: 100%;
  height: 40px;
  border-radius: 4px;
}

/* Grid skeleton */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.skeleton-grid-item {
  height: 300px;
  border-radius: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .skeleton-product-card {
    height: 350px;
  }

  .skeleton-product-image {
    height: 200px;
  }

  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }

  .skeleton-grid-item {
    height: 250px;
  }

  .skeleton-table-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .skeleton-table-cell {
    width: 100% !important;
    flex: 1 !important;
    margin: 0.25rem 0;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .skeleton {
    background: linear-gradient(
      90deg,
      #2a2a2a 25%,
      #3a3a3a 50%,
      #2a2a2a 75%
    );
    background-size: 2000px 100%;
  }

  .skeleton-table-row {
    border-bottom-color: #404040;
  }

  .skeleton-list-item {
    border-bottom-color: #404040;
  }
}
