/* ==========================================================================
   MotionSites AI — Template Gallery Hub (Kho Template Website)
   Unified 4-Column Grid with In-Grid Spotlight Expansion (2x2 = 4 Cards Span)
   ========================================================================== */

/* ---------------- Hero Section ---------------- */
:root {
  --circle-diameter: 2860px;
  --card-w: 560px;
  --card-h: 315px; /* Exact 16:9 Aspect Ratio */
  --perspective-dist: 1260px;
}

.gallery-hero {
  position: relative;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 48px 32px 0px;
  text-align: center;
  overflow: hidden;
}

@media (min-width: 768px) {
  .gallery-hero {
    padding: 60px 32px 0px;
  }
}

.gallery-headline {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.34;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.gradient-glow-text {
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 50%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gallery-tagline {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--text-muted);
  max-width: 860px;
  margin: 0 auto;
  line-height: 1.6;
}

.gallery-hero .hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  position: relative;
  z-index: 10;
}

/* ==========================================================================
   FRAMER EXACT 3D CYLINDER GALLERY (Exact DOM & Geometry Math)
   ========================================================================== */
.framer-wf0kvx {
  align-content: center;
  align-items: center;
  display: flex;
  flex: none;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 10px;
  height: 660px;
  justify-content: flex-start;
  left: 50%;
  overflow: hidden;
  padding: 0;
  position: relative;
  transform: translateX(-50%);
  width: 100vw;
  max-width: 1680px;
  margin-top: -150px; /* Sits closely right under CTA buttons */
  margin-bottom: -130px; /* Pulls catalog section up close to cylinder cards */
  z-index: 1;
  mask: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgb(0, 0, 0) 19.7213%, rgb(0, 0, 0) 80%, rgba(0, 0, 0, 0) 100%);
  -webkit-mask: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgb(0, 0, 0) 19.7213%, rgb(0, 0, 0) 80%, rgba(0, 0, 0, 0) 100%);
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

.framer-ux3tlg-container {
  flex: none;
  height: 100%;
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.framer-SrCqw.framer-n7oh7a {
  align-content: center;
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  height: 100%;
  justify-content: center;
  overflow: visible;
  padding: 0;
  position: relative;
  width: 100%;
}

/* 3D Slider Container */
.framer-18sfqik {
  align-content: center;
  align-items: center;
  display: flex;
  flex: 1 0 0px;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0px;
  height: min-content;
  justify-content: center;
  overflow: visible;
  padding: 0;
  position: relative;
  transform-style: preserve-3d;
  width: 1px;
  will-change: transform;
}

/* 3D Circle */
.framer-1j38ets {
  align-content: center;
  align-items: center;
  display: flex;
  flex: 1 0 0px;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0px;
  height: min-content;
  justify-content: center;
  overflow: visible;
  padding: 0;
  position: relative;
  transform-style: preserve-3d;
  width: 1px;
}

/* 6 Diameter Bars (2 cards each = 12 cards total) */
.framer-jqyyw2 {
  align-content: center;
  align-items: center;
  display: flex;
  flex: none;
  flex-direction: row;
  flex-wrap: nowrap;
  height: var(--card-h);
  justify-content: space-between;
  overflow: visible;
  padding: 0;
  position: relative;
  transform-style: preserve-3d;
  width: var(--circle-diameter);
  pointer-events: none;
}

.framer-ybx3e6, .framer-bfxn5x, .framer-80t3x0, .framer-ce9hg6, .framer-f1eujk {
  align-content: center;
  align-items: center;
  display: flex;
  flex: none;
  flex-direction: row;
  flex-wrap: nowrap;
  height: var(--card-h);
  justify-content: space-between;
  left: calc(50% - var(--circle-diameter) / 2);
  top: calc(50% - var(--card-h) / 2);
  overflow: visible;
  padding: 0;
  position: absolute;
  transform-style: preserve-3d;
  width: var(--circle-diameter);
  z-index: 1;
  pointer-events: none;
}

/* 16:9 Video Cards in Framer cylinder */
.framer-card-wrapper {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  flex: none;
  height: var(--card-h);
  width: var(--card-w);
  overflow: hidden;
  position: relative;
  border-radius: 20px;
  background: #0f121d;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 25px 50px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  box-sizing: border-box;
  pointer-events: auto;
  cursor: pointer;
  transform-origin: center center;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.framer-card-wrapper:hover {
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 32px 64px -10px rgba(59, 130, 246, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.framer-card-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  background: #060810;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.framer-card-wrapper:hover video {
  transform: scale(1.06);
}

/* Gloss reflection on top edge */
.framer-card-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Responsive Scaling for Hero 3D Gallery */
@media (max-width: 1024px) {
  :root {
    --circle-diameter: 2150px;
    --card-w: 420px;
    --card-h: 236.25px;
    --perspective-dist: 960px;
  }
  .framer-wf0kvx {
    height: 520px;
    margin-top: -95px;
    margin-bottom: -80px;
  }
}

@media (max-width: 680px) {
  :root {
    --circle-diameter: 1500px;
    --card-w: 290px;
    --card-h: 163.13px;
    --perspective-dist: 680px;
  }
  .framer-wf0kvx {
    height: 390px;
    margin-top: -40px;
    margin-bottom: -55px;
  }
  .gallery-hero .hero-actions {
    flex-direction: column;
    width: 100%;
    max-width: 300px;
    margin: 20px auto 0;
  }
  .gallery-hero .hero-actions a {
    width: 100%;
    justify-content: center;
  }
}

/* ---------------- Catalog Section ---------------- */
.template-catalog-section {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0px 32px 80px;
}

/* ---------------- Video Grid Container (4 columns on Desktop) ---------------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

@media (min-width: 640px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .video-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}


/* ---------------- Standard Template Card ---------------- */
.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #131316;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s var(--ease-snappy), border-color 0.25s ease, box-shadow 0.25s ease;
  height: 100%;
}

.template-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.85);
}

.template-media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #111114;
  overflow: hidden;
  cursor: pointer;
}

/* Layer 1: Skeleton Loading Layer (shows shimmer + high-tech spinner while loading) */
.template-skeleton-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #141418;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
}

.template-skeleton-layer.is-loaded {
  opacity: 0;
  visibility: hidden;
}

/* Shimmer wave */
.template-skeleton-shimmer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.02) 20%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.02) 80%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: templateSkeletonWave 1.6s infinite ease-in-out;
}

@keyframes templateSkeletonWave {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Center loading spinner ring with glowing neon tip */
.template-skeleton-spinner {
  position: relative;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #60a5fa;
  border-right-color: rgba(96, 165, 250, 0.5);
  animation: templateSkeletonSpin 0.8s linear infinite;
  box-shadow: 0 0 16px rgba(96, 165, 250, 0.25);
}

@keyframes templateSkeletonSpin {
  to { transform: rotate(360deg); }
}

.template-skeleton-label {
  position: relative;
  z-index: 2;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  font-family: inherit;
  user-select: none;
}

/* Layer 2: Static poster image (shows instantly, lightweight ~30-50KB) */
.template-poster-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 2;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.template-poster-layer.is-loaded {
  opacity: 1;
}

/* Layer 3: Video (initially transparent, fades in smoothly when playback starts) */
.template-media-frame video,
.template-video-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.template-media-frame video.is-playing,
.template-video-layer.is-playing {
  opacity: 1;
}

.media-protection-shield {
  position: absolute;
  inset: 0;
  z-index: 4;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.card-tier-badge {
  z-index: 5;
}

.placeholder-icon {
  font-size: 42px;
  opacity: 0.45;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.template-card:hover .placeholder-icon {
  transform: scale(1.12);
  opacity: 0.75;
}

.card-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  letter-spacing: 0.02em;
}

.card-status-badge.live {
  background: rgba(16, 185, 129, 0.25);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.card-status-badge.upcoming {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.65);
}

.template-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #16161a;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 12px;
  margin-top: auto;
}

.template-footer-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.template-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.template-card-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  min-width: 0;
}

.template-category-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

.template-char-badge,
.spotlight-char-pill,
#spotlightCharPill,
#spotlightCharCount,
.spotlight-btn-opentab,
#spotlightOpenLiveBtn {
  display: none !important;
}

.template-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.btn-card-favorite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.72);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  flex-shrink: 0;
}

.btn-card-favorite:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-card-favorite:active {
  transform: scale(0.94);
}

.btn-card-favorite .card-heart-icon {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), fill 0.2s ease, stroke 0.2s ease;
  flex-shrink: 0;
}

.btn-card-favorite.is-liked {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: #f43f5e;
}

.btn-card-favorite.is-liked .card-heart-icon {
  fill: #f43f5e;
  stroke: #f43f5e;
  transform: scale(1.15);
}

.btn-card-favorite .card-like-count {
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.btn-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: #0c0c0c;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--ease-snappy);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.btn-preview-pill:hover {
  background: #f4f4f5;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.25);
}

.btn-disabled-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  font-size: 11.5px;
  font-weight: 600;
  cursor: not-allowed;
  flex-shrink: 0;
}

/* ==========================================================================
   IN-GRID SPOTLIGHT BOARD (Phóng lớn tại chỗ, chiếm 3 cột x 2 hàng trên Desktop)
   ========================================================================== */
.template-spotlight-board {
  grid-column: span 1;
  grid-row: auto;
  background: #141417;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(59, 130, 246, 0.18);
  will-change: transform, opacity;
}

@media (min-width: 640px) {
  .template-spotlight-board {
    grid-column: 1 / -1;
    grid-row: auto;
    flex-direction: row;
    height: 520px;
  }
}

@media (min-width: 1024px) {
  .template-spotlight-board {
    grid-column: span 2;
    grid-row: span 2;
    flex-direction: row;
    height: 100%;
    min-height: 500px;
  }
}

@media (min-width: 1280px) {
  .template-spotlight-board {
    grid-column: span 3;
    grid-row: span 2;
    flex-direction: row;
    height: 100%;
    min-height: 440px;
    max-height: 485px;
  }
}

.template-spotlight-board.hidden {
  display: none !important;
}


/* Hiệu ứng viền xung nhịp xác định vị trí thẻ card khi thu nhỏ quay lại */
@keyframes cardReturnPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7), 0 8px 30px rgba(0, 0, 0, 0.5);
    border-color: rgba(96, 165, 250, 0.9);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4), 0 12px 36px rgba(59, 130, 246, 0.25);
    border-color: rgba(96, 165, 250, 1);
  }
  100% {
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.08);
  }
}

.template-card.card-return-pulse {
  animation: cardReturnPulse 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Cột bên trái: Khung lớn xem trước */
.spotlight-preview-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000000;
  position: relative;
  min-width: 0;
}

/* Nút quay lại bo tròn nổi đè trực tiếp lên góc trên bên trái khung demo giống ảnh mẫu */
.spotlight-btn-back {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(18, 18, 22, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.spotlight-btn-back:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.08);
}

.spotlight-btn-back:active {
  transform: scale(0.95);
}

.spotlight-btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.spotlight-btn-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.spotlight-btn-close:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #ffffff;
}

.spotlight-viewport {
  flex: 1;
  position: relative;
  background: #000000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.spotlight-video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000000;
  display: block;
}

/* Mã nhận diện template mờ và nhỏ ở sidebar (#tpl-01, #tpl-02) */
.spotlight-template-code {
  font-family: 'JetBrains Mono', monospace, ui-monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.32);
  background: transparent;
  border: none;
  padding: 0;
  user-select: none;
  line-height: 1;
}

.spotlight-video.hidden {
  display: none !important;
}

.spotlight-poster-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000000;
  z-index: 1;
}

.spotlight-poster-fallback.hidden {
  display: none !important;
}

.spotlight-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotlight-placeholder.hidden {
  display: none !important;
}

.spotlight-picon {
  font-size: 48px;
  opacity: 0.6;
}

.spotlight-sidebar {
  width: 100%;
  background: #17171a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

@media (min-width: 1024px) {
  .spotlight-sidebar {
    width: 250px;
    flex-shrink: 0;
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding: 18px 16px;
  }
}

@media (min-width: 1280px) {
  .spotlight-sidebar {
    width: 260px;
    padding: 20px 18px;
  }
}

.spotlight-header-meta {
  display: flex;
  flex-direction: column;
}

.spotlight-title-group {
  display: flex;
  flex-direction: column;
}

.spotlight-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.spotlight-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 1.5px 6.5px;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  width: fit-content;
}

.spotlight-type-badge.fullsite {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.spotlight-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.spotlight-category {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
  font-weight: 400;
  line-height: 1.3;
}

/* Stats Bar: Likes & Prompt Char Count */
.spotlight-stats-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.spotlight-likes-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.spotlight-likes-bar:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
}

.spotlight-likes-bar:active {
  transform: scale(0.96);
}

.spotlight-likes-bar.is-liked {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: #f43f5e;
}

.spotlight-likes-bar.is-liked .spotlight-heart-icon {
  fill: #f43f5e;
  stroke: #f43f5e;
  transform: scale(1.15);
}

.spotlight-heart-icon {
  stroke: currentColor;
  fill: none;
  width: 14px;
  height: 14px;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), fill 0.2s ease, stroke 0.2s ease;
  flex-shrink: 0;
}

.spotlight-likes-label {
  color: inherit;
  opacity: 0.8;
}



/* Spotlight Action Buttons Group (Prompt + Source Code) */
.spotlight-actions-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  margin-top: 2px;
}

.spotlight-btn-copyprompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px 16px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #0c0c0c;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.spotlight-btn-copyprompt:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 255, 255, 0.22);
}

.spotlight-btn-copyprompt:active {
  transform: translateY(0);
}

/* Secondary Button: Copy source code */
.spotlight-btn-copysource {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 8px 16px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.spotlight-btn-copysource:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.26);
  color: #ffffff;
  transform: translateY(-1px);
}

.spotlight-btn-copysource:active {
  transform: translateY(0);
}

/* Tertiary Button: Open dedicated live tab */


/* Sponsored Section */
.spotlight-sponsored-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.spotlight-sponsored-label {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.spotlight-sponsor-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-decoration: none;
  padding: 4px 0;
  transition: opacity 0.2s ease;
}

.spotlight-sponsor-item:hover {
  opacity: 0.85;
}

.sponsor-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.75);
  flex-shrink: 0;
  margin-top: 1px;
}

.sponsor-icon-box svg {
  width: 13px;
  height: 13px;
}

.sponsor-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sponsor-title-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sponsor-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.sponsor-arrow {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.sponsor-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.48);
  line-height: 1.4;
  margin-top: 2px;
  white-space: normal;
  word-break: break-word;
}

/* Fullscreen mode for spotlight board */
.template-spotlight-board:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
  max-width: 100vw;
  z-index: 99999;
}


/* ==========================================================================
   PHONE LAYOUT (< 768px) — dense 2-column gallery + stacked spotlight.
   Desktop rules above are untouched.
   ========================================================================== */
@media (max-width: 767px) {
  /* Hero: compact so the grid starts near the top */
  .gallery-hero { padding: 18px 14px 6px; }
  .gallery-headline {
    font-size: clamp(1.25rem, 6.4vw, 1.6rem);
    line-height: 1.35;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
  }
  .gallery-tagline {
    font-size: 13px;
    line-height: 1.5;
  }

  .gallery-hero .hero-actions {
    margin-top: 14px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .gallery-hero .hero-btn {
    padding: 9px 18px;
    font-size: 13px;
  }

  .template-catalog-section { padding: 10px 10px 48px; }

  /* Grid: always at least 2 columns */
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  /* Cards */
  .template-card {
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  }
  .template-card:hover { transform: none; }
  .template-media-frame { aspect-ratio: 4 / 3; }
  .template-card-footer {
    padding: 7px 8px;
    gap: 6px;
  }
  .template-name { font-size: 11.5px; }
  .template-card-actions {
    gap: 4px;
  }
  .btn-card-favorite {
    height: 26px;
    padding: 0 6px;
    font-size: 10px;
    gap: 3px;
  }
  .btn-card-favorite .card-heart-icon {
    width: 11.5px;
    height: 11.5px;
  }

  /* Preview pill becomes a compact round arrow button */
  .btn-preview-pill {
    width: 26px;
    height: 26px;
    padding: 0;
    gap: 0;
    justify-content: center;
    font-size: 12px;
    box-shadow: none;
  }
  .btn-preview-pill span:first-child { display: none; }
  .btn-preview-pill:hover { transform: none; }
  .btn-disabled-pill { padding: 4px 7px; font-size: 9.5px; }
  .card-status-badge { top: 6px; right: 6px; font-size: 9px; padding: 2px 6px; }

  /* Spotlight: full-width row, preview on top, compact actions below */
  .template-spotlight-board {
    grid-column: 1 / -1;
    border-radius: 14px;
    scroll-margin-top: 90px;
  }
  .spotlight-preview-wrap {
    flex: none;
    aspect-ratio: 4 / 5;
    max-height: 64vh;
    width: 100%;
  }
  .spotlight-btn-back {
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
  }
  .spotlight-btn-back svg { width: 15px; height: 15px; }

  .spotlight-sidebar {
    padding: 10px 12px 12px;
    gap: 8px;
    overflow: visible;
  }
  .spotlight-badge-row { margin-bottom: 4px; }
  .spotlight-title { font-size: 14px; }
  .spotlight-category { font-size: 10.5px; }
  .spotlight-likes-bar { font-size: 10.5px; }
  .template-card-meta-line {
    gap: 4px;
    margin-top: 1px;
  }

  /* Actions group: buttons stacked nicely */
  .spotlight-actions-group {
    flex-direction: column;
    gap: 6px;
  }
  .spotlight-btn-copyprompt,
  .spotlight-btn-copysource {
    width: 100%;
    padding: 8px 10px;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .spotlight-btn-copysource span { overflow: hidden; text-overflow: ellipsis; }

  /* Sponsors in two columns */
  .spotlight-sponsored-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    margin-top: 2px;
    padding-top: 8px;
  }
  .spotlight-sponsored-label { grid-column: 1 / -1; font-size: 9px; }
  .sponsor-title { font-size: 10.5px; }
  .sponsor-desc { font-size: 9.5px; }

  /* Any extra info blocks in the sidebar (description, specs) stay small */
  .spotlight-sidebar p { font-size: 11px; line-height: 1.45; }
}

/* Very narrow phones (<= 360px): tighten further but keep 2 columns */
@media (max-width: 360px) {
  .video-grid { gap: 6px; }
  .template-catalog-section { padding: 8px 6px 40px; }
  .template-name { font-size: 10.5px; }
  .template-category-sub { font-size: 9px; }
  .btn-preview-pill { width: 22px; height: 22px; font-size: 11px; }
}


/* Tier Badges (PRO Golden Crown Icon) */
.card-tier-badge,
.template-tier-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  user-select: none;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.template-card:hover .card-tier-badge.badge-pro,
.template-card:hover .template-tier-badge.tier-pro {
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 12px rgba(245, 158, 11, 0.35);
}

.card-tier-badge.badge-pro,
.template-tier-badge.tier-pro {
  background: rgba(18, 16, 10, 0.78);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), 0 0 10px rgba(245, 158, 11, 0.22);
}

.card-tier-badge.badge-pro svg,
.template-tier-badge.tier-pro svg {
  width: 13px;
  height: 13px;
  display: block;
  fill: currentColor;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* Hide any free badge completely */
.card-tier-badge.badge-free,
.template-tier-badge.tier-free {
  display: none !important;
}

@media (max-width: 767px) {
  .card-tier-badge,
  .template-tier-badge {
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
  }
  .card-tier-badge.badge-pro svg,
  .template-tier-badge.tier-pro svg {
}

/* Saved item navigation highlight */
.template-card.saved-target-highlight {
  outline: 2px solid #3b82f6 !important;
  outline-offset: 4px;
  box-shadow: 0 0 35px rgba(59, 130, 246, 0.6) !important;
  transform: translateY(-4px) scale(1.02);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}
