/* ---------------------------------------------------------------------------
 * videosgen.css — MuseBox catalog page (/videosGen)
 *
 * Every card renders as two equal halves:
 *   [ cover (posterUrl) ] [ video (videoUrl) ]
 * with the sync button floating on top of the seam between them, so it
 * overlaps both halves instead of taking a column of its own.
 * ------------------------------------------------------------------------- */

/* --- Grid ---------------------------------------------------------------- */
.vg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 2rem;
  margin: 3rem 0;
}

/* --- Card ---------------------------------------------------------------- */
.vg-card {
  background: #13163f;
  border: 1px solid transparent;
  border-radius: 1.125rem;
  padding: 1.25rem;
  transition: box-shadow 0.3s ease;
}

.vg-card:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.dark .vg-card {
  border-color: #404660;
  background: #13163f;
}

/* --- Split layout: cover | video, sync overlapping both ------------------- */
/* The wrapper holds the link, the sync button and the CTA overlay, so the
   button can sit on the seam without being nested inside the anchor. */
.vg-split-wrap {
  position: relative;
}

.vg-split {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
  border-radius: 0.75rem;
  background: #0d0f2e;
  cursor: pointer;
}

.vg-split__panel {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #0d0f2e;
}

.vg-split__panel img,
.vg-split__panel video {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The sync button sits on the seam, overlapping both halves. */
.vg-split__sync {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
}

.vg-sync {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 9999px;
  background: rgba(19, 22, 63, 0.94);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.vg-sync:hover {
  background: #6366f1;
  border-color: transparent;
  transform: scale(1.08);
}

.vg-sync:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.vg-sync i {
  display: block;
}

/* Call-to-action overlay across the whole split, telling that the card opens
   the creation page. */
.vg-split__cta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
  background: linear-gradient(to top, rgba(13, 16, 45, 0.92), rgba(13, 16, 45, 0));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.65;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.vg-split:hover .vg-split__cta,
.vg-split:focus-visible .vg-split__cta {
  opacity: 1;
}

/* Touch devices never fire :hover, so keep the affordance visible there. */
@media (hover: none) {
  .vg-split__cta {
    opacity: 1;
  }
}

/* The title is a second entry point to the same page. */
.vg-card__title a {
  color: inherit;
  text-decoration: none;
}

.vg-card__title a:hover {
  color: #a5b4fc;
}

/* The sync glyph spins while the preview plays and stands still when paused.
   The icon itself is never swapped out. */
.vg-card:not(.is-paused) .vg-sync i {
  animation: vg-sync-spin 2.4s linear infinite;
}

.vg-card.is-paused .vg-sync i {
  opacity: 0.75;
}

@keyframes vg-sync-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vg-card:not(.is-paused) .vg-sync i {
    animation: none;
  }
}

/* Fallback for browsers without aspect-ratio support. */
@supports not (aspect-ratio: 9 / 16) {
  .vg-split__panel {
    height: 0;
    padding-bottom: 177.78%;
  }
}

/* Placeholder shown when a row has no cover and no video. */
.vg-empty {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(148, 163, 184, 0.45);
  font-size: 1.75rem;
}

/* --- Card meta ------------------------------------------------------------ */
.vg-card__meta {
  margin-top: 0.9rem;
}

.vg-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.vg-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vg-badge--duo {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}

.vg-badge--length {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}

.vg-badge--category {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  text-transform: none;
}

.vg-badge--tag {
  background: rgba(244, 114, 182, 0.14);
  color: #f9a8d4;
  text-transform: none;
}

/* Highlights the chip that matches the filter currently applied. */
.vg-badge.is-match {
  background: rgba(99, 102, 241, 0.45);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.vg-card__title {
  margin: 0;
  color: #e2e8f0;
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.vg-card__sub {
  margin-top: 0.25rem;
  color: #94a3b8;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.vg-card__id {
  margin-top: 0.2rem;
  color: rgba(148, 163, 184, 0.6);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

/* --- Filters -------------------------------------------------------------- */
.vg-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.75rem 0;
}

.vg-filter {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 9999px;
  padding: 0.4rem 1rem;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.vg-filter:hover {
  background: #6366f1;
  border-color: transparent;
  color: #fff;
}

.vg-filter.is-active {
  background: #6366f1;
  border-color: transparent;
  color: #fff;
}

.vg-filter-divider {
  width: 1px;
  height: 1.25rem;
  background: rgba(148, 163, 184, 0.3);
}

/* --- Tag filter row ------------------------------------------------------- */
.vg-filters--tags {
  max-height: 9.5rem;
  overflow-y: auto;
  padding: 0.75rem 0.25rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
}

.vg-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vg-filter--tag {
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 500;
}

/* --- Active filter chips --------------------------------------------------- */
.vg-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0.5rem;
}

.vg-active__label {
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vg-active__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(99, 102, 241, 0.55);
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.16);
  padding: 0.25rem 0.75rem;
  color: #e2e8f0;
  font-size: 0.8rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.vg-active__chip:hover {
  background: rgba(99, 102, 241, 0.32);
  border-color: transparent;
}

.vg-active__chip-kind {
  color: #a5b4fc;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vg-active__chip i {
  color: #a5b4fc;
  font-size: 0.7rem;
}

.vg-active__clear {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.vg-active__clear:hover {
  color: #fff;
}

.vg-active__warning {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 9999px;
  background: rgba(239, 68, 68, 0.14);
  padding: 0.25rem 0.85rem;
  color: #fca5a5;
  font-size: 0.8rem;
}

/* --- Empty state ---------------------------------------------------------- */
.vg-empty-state {
  padding: 4rem 1rem;
  text-align: center;
  color: #94a3b8;
}

.vg-error-details {
  max-width: 42rem;
  margin: 1.25rem auto 0;
  text-align: left;
}

.vg-error-details summary {
  cursor: pointer;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.vg-error-details summary:hover {
  color: #fff;
}

.vg-error-details pre {
  margin-top: 0.75rem;
  overflow-x: auto;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.9rem 1rem;
  color: #fca5a5;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 1024px) {
  .vg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .vg-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 2rem 0;
  }

  .vg-card {
    padding: 0.9375rem;
  }

  .vg-sync {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 0.75rem;
  }
}
