/* Video Browser */
.video-browser-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-grid-wrapper {
  position: relative;
}

.post-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(265px, 100%), 1fr));
  gap: 12px;
  user-select: none;
  transform: translateZ(0);
  opacity: 0;
  transition: opacity 0.2s ease-in;
  will-change: opacity;
}

.post-grid.loaded {
  opacity: 1;
}

/* Layout Variants (driven by data-layout attribute set by PHP/JS) */

.post-grid[data-layout="compact"],
.post-grid[data-layout="grid"] {
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
}

/* Compact: smaller text, hide stats bar */
.post-grid[data-layout="compact"] .vid-info-con {
  font-size: 14px;
}

.post-grid[data-layout="compact"] .vid-subline,
.post-grid[data-layout="compact"] .vid-avatar {
  display: none;
}

/* Grid: hide entire info panel */
.post-grid[data-layout="grid"] .vid-info-con {
  display: none;
}

/* Grid: square thumbnails */
.post-grid[data-layout="grid"] .featured-image {
  aspect-ratio: 1 / 1;
}

/* Skeleton Loader */
.post-grid-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    #1e1e2e 0%,
    #2a2a3a 20%,
    #1e1e2e 40%,
    #1e1e2e 100%
  );
  background-size: 200% 100%;
  border-radius: 10px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  animation:
    skeleton-shimmer 1.5s ease-in-out infinite,
    skeleton-fadein 0.2s ease-in 0.4s forwards;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes skeleton-fadein {
  to {
    opacity: 1;
  }
}

.grid-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1;
  content-visibility: auto;
  contain-intrinsic-size: auto 250px;
}

/* Grid Item Full Bleed */
.grid-item.full-bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: none;
}

.grid-item.full-bleed .featured-image {
  border-radius: 0;
}

.grid-item.full-bleed .vid-info-con,
.grid-item.full-bleed .vid-manage-bar {
  margin: 0 10px;
}

.post-grid:has(.grid-item.full-bleed) {
  overflow: visible;
}

/* labels */
.vid-labels {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vid-label {
  box-sizing: border-box;
  background: #0000006e;
  padding: 4px 5px;
  border-radius: 5px;
  font-size: 12px;
  z-index: 12;
}

.vid-label.new {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.vid-label.time {
  position: absolute;
  bottom: 6px;
  right: 6px;
  border: none;
  background: #00000087;
  color: rgba(255, 255, 255, 0.9);
}

.featured-image {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.4);
}

.front-img,
.back-img {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.front-img {
  z-index: 8;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.front-img.img-loaded {
  opacity: 1;
}

.back-img {
  z-index: 5;
  filter: blur(4px) brightness(20%);
  transform: scale(1.1);
}

.featured-image video {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.featured-image video.video-active {
  opacity: 1;
}

.post-content {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  line-height: 1.2;
}

.vid-info-con {
  display: flex;
  gap: 10px;
  font-size: 16px;
  z-index: 5;
}

.vid-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
}

.vid-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vid-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.vid-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.vid-title,
.vid-title a {
  font-family: var(--font-head);
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  box-orient: vertical;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vid-subline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

.vid-creator {
  color: rgba(255, 255, 255, 0.8);
}

/* Mute Button */
.mute-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  box-sizing: border-box;
  width: 38px;
  height: 38px;
  cursor: pointer;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 20%);
  background: rgb(0 0 0 / 50%);
  padding: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
}

.mute-btn-press {
  animation: vbMutePress 0.18s ease-out;
}

@keyframes vbMutePress {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.8);
  }
  100% {
    transform: scale(1);
  }
}

.show-mute-btn {
  opacity: 0.6;
  pointer-events: auto;
}

/* --- ACTION BAR --- */

.vb-actionbar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 12px;
  z-index: 100;
  max-width: 576px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.3s ease;
}

.vb-actionbar.vb-actionbar-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-120%);
}

.vb-actionbar-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.vb-search-wrap {
  box-sizing: border-box;
  flex: 1;
  min-width: 120px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 12px;
  background: #05060a;
  border: 1px solid rgba(200, 212, 235, 0.16);
  transition: border-color 0.2s ease;
}

.vb-search-wrap:focus-within {
  border-color: #6aaad8;
}

.vb-search-input {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
}

.vb-search-submits {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.vb-search-btn {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 30px;
  flex-shrink: 0;
  cursor: pointer;
}

.vb-search-btn img {
  pointer-events: none;
  opacity: 0.6;
}

.vb-search-clear {
  display: none;
}

.vb-search-clear.visible {
  display: flex;
}

.vb-search-clear img {
  width: 12px;
  height: 12px;
}

.vb-search-submit img {
  width: 18px;
  height: 18px;
}

.vb-actionbar-actions {
  display: flex;
  gap: 10px;
}

.vb-filter-btn {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  height: 40px;
  font-size: 16px;
  font-weight: 500;
  padding: 5px 10px;
  background: #2a2d3a;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}

.vb-filter-btn img {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

/* Action Bar Windows */
.vb-status {
  display: block;
  width: fit-content;
  margin-top: 10px;
  background: #2a2d3a;
  box-shadow: 0 2px 8px rgb(0 0 0 / 60%);
  border-radius: 10px;
  padding: 3px 10px;
}

.vb-filter-panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: #2a2d3a;
  box-shadow: 0 2px 8px rgb(0 0 0 / 60%);
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  width: 100%;
  max-width: 700px;
  opacity: 0;
  padding: 12px;
  gap: 12px;
  border-radius: 12px;
  pointer-events: none;
  visibility: hidden;
  transform: translateX(-50%);
  transition:
    opacity 0.15s ease,
    visibility 0.15s ease;
  z-index: 50;
}

.vb-filter-panel.show {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  animation: filter-panel-pop 0.2s ease forwards;
}

@keyframes filter-panel-pop {
  0% {
    transform: translateX(-50%) scale(0.92);
  }
  60% {
    transform: translateX(-50%) scale(1.03);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

.vb-filter-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.vb-filter-section h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  color: rgb(255 255 255 / 80%);
}

.vb-filter-section h1 img {
  height: 16px;
  width: 16px;
  opacity: .6;
}

.vb-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.vb-options a {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 36px;
  border-radius: 12px;
  background: #20222c;
  font-size: 16px;
  cursor: pointer;
  border: 1px solid #3b3e50;
  color: #ced4dc;
}

.vb-options a.vb-option-selected {
  background: #141a35ad;
  color: #6bb0ff;
  border-color: #6bb0ff;
}

.topbar-line {
  width: 100%;
  height: 1px;
  background: #4d57737d;
}

.video-item a,
.video-item a:hover,
.video-item a:focus {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #ffffffc9;
}

.video-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 8px;
  background: #00000054;
}

.video-name {
  position: relative;
  z-index: 1;
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- TAG BOX --- */
.tag-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  flex-wrap: wrap;
}

.tag-box span {
  color: #f4f5f6;
}

.tag {
  background: #272d3a;
  color: #ffffffc4;
  border-radius: 8px;
  padding: 3px 8px;
  border: 2px solid #000000e8;
}

/* Chunk Loader */
.vb-chunk-loader-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 0;
}

.vb-chunk-loader {
  display: flex;
  gap: 8px;
  font-size: 0;
}

.vb-chunk-loader:before,
.vb-chunk-loader:after {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background-color: #ffffffb5;
  animation: vbChunkBounce 0.6s infinite alternate ease-in-out;
}

.vb-chunk-loader:after {
  animation-delay: 0.3s;
}

@keyframes vbChunkBounce {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(20px);
  }
}

/* NO VIDEOS FOUND */
.no-videos {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  background: #232633;
  border: 1px solid #394056;
  border-radius: 8px;
}

a.reset-search,
a.reset-search:hover,
a.reset-search:focus {
  background: #0000003d;
  color: #77c4ffd9;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #77c4ffd9;
  box-shadow: 0px 2px 4px #00000069;
}

/* Back-navigation restore flash */
@keyframes vb-item-flash {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  40%  { opacity: 0; }
  60%  { opacity: 1; }
  80%  { opacity: 0; }
  100% { opacity: 0; }
}

.grid-item-highlight::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgb(255 255 255 / 20%);
  border-radius: 10px;
  pointer-events: none;
  z-index: 20;
  animation: vb-item-flash 1s ease forwards;
}
