/* Spacex-NFT 骨架屏加载样式 */

/* 骨架屏基础样式 */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

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

/* 骨架屏 - 文本 */
.skeleton-text {
  height: 16px;
  margin: 8px 0;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.long {
  width: 100%;
}

/* 骨架屏 - 圆形 */
.skeleton-circle {
  border-radius: 50%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

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

.skeleton-avatar.xlarge {
  width: 120px;
  height: 120px;
}

/* 骨架屏 - 卡片 */
.skeleton-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.skeleton-card-image {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.skeleton-card-title {
  height: 20px;
  width: 80%;
  margin-bottom: 8px;
}

.skeleton-card-content {
  height: 14px;
  width: 100%;
  margin: 4px 0;
}

.skeleton-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.skeleton-card-price {
  width: 80px;
  height: 20px;
}

.skeleton-card-button {
  width: 60px;
  height: 32px;
  border-radius: 16px;
}

/* 骨架屏 - 列表项 */
.skeleton-list-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: white;
  margin: 8px 0;
  border-radius: 8px;
}

.skeleton-list-item .skeleton-avatar {
  margin-right: 12px;
  flex-shrink: 0;
}

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

.skeleton-list-item .skeleton-text {
  margin: 4px 0;
}

/* 骨架屏 - 网格布局 */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px;
}

.skeleton-grid-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.skeleton-grid-item .skeleton-card-image {
  height: 150px;
  margin-bottom: 0;
}

.skeleton-grid-item .skeleton-card-content {
  padding: 12px;
}

/* 骨架屏 - 轮播图 */
.skeleton-carousel {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  margin-bottom: 16px;
}

/* 骨架屏 - 导航栏 */
.skeleton-nav {
  display: flex;
  justify-content: space-around;
  padding: 16px;
  background: white;
  margin-bottom: 12px;
}

.skeleton-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.skeleton-nav-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-nav-text {
  width: 40px;
  height: 12px;
}

/* 骨架屏 - 个人中心 */
.skeleton-profile {
  display: flex;
  align-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.skeleton-profile .skeleton-avatar {
  margin-right: 16px;
  background: rgba(255, 255, 255, 0.3);
}

.skeleton-profile .skeleton-text {
  background: rgba(255, 255, 255, 0.3);
}

/* 骨架屏 - 统计数据 */
.skeleton-stats {
  display: flex;
  justify-content: space-around;
  padding: 16px;
  background: white;
  margin: 12px 0;
}

.skeleton-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.skeleton-stat-value {
  width: 40px;
  height: 24px;
}

.skeleton-stat-label {
  width: 30px;
  height: 12px;
}

/* 骨架屏 - 钱包卡片 */
.skeleton-wallet {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 24px;
  margin: 16px;
  color: white;
}

.skeleton-wallet-balance {
  width: 120px;
  height: 32px;
  margin: 16px 0;
  background: rgba(255, 255, 255, 0.3);
}

.skeleton-wallet-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.skeleton-wallet-action {
  flex: 1;
  height: 40px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.3);
}

/* 骨架屏 - 详情页 */
.skeleton-detail {
  padding: 16px;
}

.skeleton-detail-image {
  width: 100%;
  height: 375px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.skeleton-detail-title {
  height: 24px;
  width: 80%;
  margin-bottom: 8px;
}

.skeleton-detail-series {
  height: 16px;
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-detail-info {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}

.skeleton-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.skeleton-detail-row:last-child {
  border-bottom: none;
}

.skeleton-detail-label {
  width: 60px;
  height: 14px;
}

.skeleton-detail-value {
  width: 100px;
  height: 14px;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  .skeleton {
    background: linear-gradient(
      90deg,
      #2d2d2d 25%,
      #3d3d3d 50%,
      #2d2d2d 75%
    );
  }
}

/* 骨架屏容器 */
.skeleton-container {
  padding: 16px;
}

/* 加载更多指示器 */
.load-more-indicator {
  text-align: center;
  padding: 20px;
  color: #6b7280;
  font-size: 14px;
}

.load-more-indicator .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* 空状态样式 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-title {
  font-size: 16px;
  margin-bottom: 8px;
  color: #6b7280;
}

.empty-state-description {
  font-size: 14px;
  color: #9ca3af;
}

/* 刷新控件 */
.refresh-control {
  text-align: center;
  padding: 12px;
  color: #6b7280;
  font-size: 13px;
}

.refresh-control .icon {
  display: inline-block;
  margin-right: 6px;
}

/* 下拉刷新动画 */
@keyframes pullRefresh {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(0);
  }
}

/* 页面过渡动画 */
.page-transition {
  animation: pageIn 0.3s ease;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 卡片进入动画 */
.card-enter {
  animation: cardEnter 0.4s ease;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 淡入动画 */
.fade-in {
  animation: fadeIn 0.3s ease;
}

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

/* 滑动进入动画 */
.slide-in-left {
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========== 懒加载样式 ========== */

/* 懒加载图片占位符 */
img[data-src] {
  background-color: #f0f0f0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23d0d0d0' d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E");
  background-size: 48px 48px;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.3s ease;
}

/* 懒加载完成 */
img.lazy-loaded {
  background-image: none;
  background-color: transparent;
}

/* 懒加载错误 */
img.lazy-error {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff6b6b' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
  background-size: 48px 48px;
  background-position: center;
  background-repeat: no-repeat;
}

/* 懒加载背景 */
.lazy-bg {
  background-color: #f0f0f0;
  transition: background-image 0.3s ease;
}

.lazy-bg-loaded {
  background-color: transparent;
}

/* 图片加载动画 */
.image-loading {
  position: relative;
  overflow: hidden;
}

.image-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    left: 100%;
  }
}
