/* ============================================
   SKELETON SCREENS - Tacticbase
   Плейсхолдеры для загружаемого контента
   ============================================ */

/* Базовая анимация skeleton */
@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.08) 40px,
    rgba(255, 255, 255, 0.04) 80px
  );
  background-size: 468px 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 4px;
}

[data-theme='light'] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.06) 0px,
    rgba(0, 0, 0, 0.12) 40px,
    rgba(0, 0, 0, 0.06) 80px
  );
  background-size: 468px 100%;
}

/* Скрытие скелетонов после загрузки */
.content-loaded .skeleton,
.content-loaded [class*="skeleton-"] {
  display: none !important;
}

/* Skeleton для карточек статей */
.skeleton-article-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  min-height: 360px;
}

.skeleton-article-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.08) 40px,
    rgba(255, 255, 255, 0.04) 80px
  );
  background-size: 468px 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-article-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-badge {
  width: 60px;
  height: 20px;
  border-radius: 3px;
}

.skeleton-title {
  width: 100%;
  height: 24px;
  border-radius: 4px;
}

.skeleton-title.short {
  width: 80%;
}

.skeleton-text {
  width: 100%;
  height: 16px;
  border-radius: 4px;
}

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

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

/* Skeleton для hero секции */
.skeleton-hero {
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skeleton-hero-content {
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.skeleton-hero-title {
  width: 80%;
  height: 48px;
  border-radius: 8px;
}

.skeleton-hero-subtitle {
  width: 60%;
  height: 24px;
  border-radius: 4px;
}

.skeleton-search-bar {
  width: 100%;
  height: 56px;
  border-radius: 8px;
}

/* Skeleton для Trade Up калькулятора */
.skeleton-tradeup-slot {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton-tradeup-slot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0px,
    rgba(255, 255, 255, 0.05) 40px,
    transparent 80px
  );
  background-size: 468px 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-tradeup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

/* Skeleton для списка скинов */
.skeleton-skin-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.skeleton-skin-item {
  height: 72px;
  background: var(--surface-2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.skeleton-skin-icon {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  flex-shrink: 0;
}

.skeleton-skin-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-skin-name {
  width: 70%;
  height: 16px;
  border-radius: 3px;
}

.skeleton-skin-price {
  width: 40%;
  height: 14px;
  border-radius: 3px;
}

/* Skeleton для профиля */
.skeleton-profile-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.skeleton-avatar {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  flex-shrink: 0;
}

.skeleton-profile-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-username {
  width: 150px;
  height: 20px;
  border-radius: 4px;
}

.skeleton-profile-meta {
  width: 100px;
  height: 14px;
  border-radius: 3px;
}

/* Skeleton для favorites списка */
.skeleton-favorite-item {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.skeleton-favorite-title {
  width: 60%;
  height: 18px;
  border-radius: 4px;
}

.skeleton-favorite-details {
  display: flex;
  gap: 12px;
}

.skeleton-favorite-detail {
  width: 80px;
  height: 16px;
  border-radius: 3px;
}

/* Grid layouts для skeleton */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin: 32px 0;
}

.skeleton-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 32px 0;
}

.skeleton-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 32px 0;
}

/* Responsive skeleton grids */
@media (max-width: 768px) {
  .skeleton-grid,
  .skeleton-grid-2,
  .skeleton-grid-3 {
    grid-template-columns: 1fr;
  }

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

/* Skeleton для категорий */
.skeleton-category-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 24px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.skeleton-category-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.skeleton-category-title {
  width: 70%;
  height: 20px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-category-desc {
  width: 90%;
  height: 14px;
  border-radius: 3px;
}

/* Skeleton для таблиц данных */
.skeleton-table {
  width: 100%;
  border-collapse: collapse;
}

.skeleton-table-row {
  height: 48px;
  border-bottom: 1px solid var(--line);
}

.skeleton-table-cell {
  padding: 12px;
}

.skeleton-table-text {
  height: 16px;
  border-radius: 3px;
}

/* Плавное появление контента */
.fade-in-content {
  animation: fadeInContent 0.4s ease-out forwards;
}

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

/* Accessibility - уменьшение анимации */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: skeleton-pulse 2s ease-in-out infinite;
  }

  .skeleton-article-image,
  .skeleton-tradeup-slot::before {
    animation: skeleton-pulse 2s ease-in-out infinite;
  }

  .fade-in-content {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
