/**
 * Product Grid Skeleton Loader
 * 产品列表骨架屏加载动画
 */

/* =====================================
   Skeleton Animation
   ===================================== */

@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 0px,
    #f8f8f8 40px,
    #f0f0f0 80px
  );
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite linear;
}

/* =====================================
   Loading State
   ===================================== */

.products-list--loading {
  pointer-events: none;
  opacity: 0.6;
}

/* =====================================
   Skeleton Product Card
   ===================================== */

.skeleton-product-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
}

/* 产品图片骨架 */
.skeleton-product-image {
  width: 100%;
  padding-bottom: 100%; /* 1:1 ratio */
  background: #f0f0f0;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.skeleton-product-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #f0f0f0 0px,
    #f8f8f8 40px,
    #f0f0f0 80px
  );
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite linear;
}

/* 产品分类骨架 */
.skeleton-product-category {
  width: 60%;
  height: 14px;
  background: #f0f0f0;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* 产品标题骨架 */
.skeleton-product-title {
  width: 85%;
  height: 18px;
  background: #f0f0f0;
  border-radius: 4px;
  margin-bottom: 12px;
}

/* 产品价格骨架 */
.skeleton-product-price {
  width: 50%;
  height: 20px;
  background: #f0f0f0;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* 颜色样本骨架 */
.skeleton-product-swatches {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.skeleton-swatch {
  width: 32px;
  height: 32px;
  background: #f0f0f0;
  border-radius: 50%;
}

/* =====================================
   Fade In/Out Effects
   ===================================== */

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* =====================================
   Loading Overlay
   ===================================== */

.products-loading-overlay {
  position: relative;
}

.products-loading-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  z-index: 10;
  display: none;
}

.products-loading-overlay.is-loading::after {
  display: block;
}

/* 加载指示器 */
.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  display: none;
}

.products-loading-overlay.is-loading .loading-spinner {
  display: block;
}

.loading-spinner svg {
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* =====================================
   Responsive
   ===================================== */

@media (max-width: 768px) {
  .skeleton-product-image {
    border-radius: 6px;
  }
  
  .skeleton-swatch {
    width: 28px;
    height: 28px;
  }
  
  .loading-spinner svg {
    width: 40px;
    height: 40px;
  }
}

/* =====================================
   Empty State
   ===================================== */

.products-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.products-empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.products-empty-state h3 {
  font-size: 20px;
  margin-bottom: 8px;
  color: #333;
}

.products-empty-state p {
  font-size: 14px;
  color: #999;
}

.products-empty-state .btn {
  margin-top: 20px;
}
