/* =========================================
   UIverse — Trending Page Styles
   ========================================= */

/* ═══════════════════════════════════════════
   TRENDING HERO
   ═══════════════════════════════════════════ */

.trending-hero {
  position: relative;
  padding: calc(var(--header-height) + 48px) 24px 0;
  overflow: hidden;
}

.trending-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.trending-hero__gradient {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.25;
}

.trending-hero__gradient--1 {
  width: 500px;
  height: 500px;
  background: #ef4444;
  top: -200px;
  left: -100px;
  animation: floatBlob 12s ease-in-out infinite;
}

.trending-hero__gradient--2 {
  width: 400px;
  height: 400px;
  background: #f97316;
  top: -100px;
  right: -100px;
  animation: floatBlob 15s ease-in-out infinite reverse;
}

.trending-hero__gradient--3 {
  width: 350px;
  height: 350px;
  background: var(--color-gradient-1);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: floatBlob 10s ease-in-out infinite;
  opacity: 0.15;
}

.trending-hero__content {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
}

.trending-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.2);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.15); }
  50% { box-shadow: 0 0 20px 4px rgba(249, 115, 22, 0.1); }
}

.trending-hero__title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 900;
  letter-spacing: -1px;
  text-align: center;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 30%, #f97316 70%, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.trending-hero__subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 1rem;
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ═══════════════════════════════════════════
   ANALYTICS STAT CARDS
   ═══════════════════════════════════════════ */

.trending-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 900px;
  margin: 0 auto 32px;
}

.trending-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.trending-stat:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.trending-stat__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.trending-stat__icon--views {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.trending-stat__icon--likes {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.trending-stat__icon--copies {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.trending-stat__icon--total {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}

.trending-stat__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trending-stat__number {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.5px;
}

.trending-stat__label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ═══════════════════════════════════════════
   CATEGORY FILTERS
   ═══════════════════════════════════════════ */

.trending-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  padding-bottom: 24px;
  border-bottom: none;
  position: relative;
}
.trending-filters::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  width: 80%;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.08) 30%, rgba(255,255,255,0.08) 70%, transparent);
}

.trending-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-family);
}

.trending-filter:hover {
  color: var(--color-text);
  background: rgba(249, 115, 22, 0.06);
  border-color: rgba(249, 115, 22, 0.2);
}

.trending-filter.active {
  color: #fff;
  background: linear-gradient(135deg, #f97316, #ef4444);
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(249, 115, 22, 0.3);
}

.trending-filter i {
  font-size: 0.75rem;
}

/* ═══════════════════════════════════════════
   TRENDING GRID
   ═══════════════════════════════════════════ */

.trending-grid-section {
  padding: 32px 24px 60px;
}

.trending-grid-container {
  max-width: 1400px;
  margin: 0 auto;
}

.trending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Trending Card */
.trending-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  animation: cardFadeIn 0.4s ease forwards;
  opacity: 0;
  transform: translateY(20px);
  position: relative;
}

@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.trending-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3), 0 0 60px rgba(249, 115, 22, 0.06);
  transform: translateY(-4px);
}

/* Rank Badge */
.trending-card__rank {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 50%;
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.trending-card__rank--gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.4);
}

.trending-card__rank--silver {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  box-shadow: 0 2px 12px rgba(148, 163, 184, 0.3);
}

.trending-card__rank--bronze {
  background: linear-gradient(135deg, #d97706, #92400e);
  box-shadow: 0 2px 12px rgba(217, 119, 6, 0.3);
}

.trending-card__rank--default {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.75rem;
}

/* Preview */
.trending-card__preview {
  position: relative;
  height: 220px;
  background: var(--color-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: none;
}

.trending-card__preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
  background: var(--color-bg);
  transition: transform 0.3s ease;
}

.trending-card:hover .trending-card__preview-iframe {
  pointer-events: auto;
}

.trending-card__preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Body */
.trending-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.trending-card__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trending-card__desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer */
.trending-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: none;
}

.trending-card__category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.trending-card__stats {
  display: flex;
  align-items: center;
  gap: 14px;
}

.trending-card__stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.trending-card__stat i {
  font-size: 0.7rem;
}

/* Skeleton */
.trending-card--skeleton {
  animation: none;
  opacity: 1;
  transform: none;
}

.trending-card--skeleton .trending-card__preview {
  background: linear-gradient(90deg, var(--color-bg-card) 25%, var(--color-bg-card-hover) 50%, var(--color-bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--color-bg-card) 25%, var(--color-bg-card-hover) 50%, var(--color-bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-line--short { width: 60%; }
.skeleton-line--long { width: 90%; }

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */

.trending-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--color-text-muted);
}

.trending-empty i {
  font-size: 3.5rem;
  margin-bottom: 20px;
  opacity: 0.3;
  color: #f97316;
}

.trending-empty h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
  .trending-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .trending-hero__title {
    font-size: 1.6rem;
  }

  .trending-card__rank {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .trending-stats {
    grid-template-columns: 1fr;
  }

  .trending-grid {
    grid-template-columns: 1fr;
  }
}
