/* =============================================
   Video Gallery — Frontend Styles
   ============================================= */

:root {
  --vg-bg: #0e0e0e;
  --vg-accent: #ffffff;
  --vg-radius: 10px;
  --vg-gap: 10px;
  --vg-caption-bg: rgba(0,0,0,0.65);
}

/* ── WRAPPER ── */
.vg-gallery {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--vg-bg);
  padding: 16px;
  border-radius: var(--vg-radius);
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* ── DARK THEME (default) ── */
.vg-theme-dark { --vg-text: #fff; --vg-sub: rgba(255,255,255,.55); --vg-card-bg: #1a1a1a; }
.vg-theme-light { --vg-bg: #f4f4f4; --vg-text: #111; --vg-sub: rgba(0,0,0,.5); --vg-card-bg: #fff; }
@media (prefers-color-scheme: dark)  { .vg-theme-auto { --vg-bg: #0e0e0e; --vg-text: #fff;  --vg-sub: rgba(255,255,255,.55); --vg-card-bg: #1a1a1a; } }
@media (prefers-color-scheme: light) { .vg-theme-auto { --vg-bg: #f4f4f4; --vg-text: #111;  --vg-sub: rgba(0,0,0,.5);        --vg-card-bg: #fff; } }

/* ── GRID ── */
.vg-grid {
  display: grid;
  gap: var(--vg-gap);
  width: 100%;
}

/* ── MASONRY ── */
.vg-masonry {
  display: block;
  column-gap: var(--vg-gap);
}
.vg-masonry .vg-thumb {
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: var(--vg-gap);
  aspect-ratio: unset !important;
  height: auto;
}
.vg-masonry .vg-thumb .vg-thumb-img,
.vg-masonry .vg-thumb .vg-thumb-video {
  height: auto;
  aspect-ratio: unset;
}

/* ── THUMB ── */
.vg-thumb {
  position: relative;
  background: var(--vg-card-bg, #1a1a1a);
  border-radius: var(--vg-radius);
  overflow: hidden;
  cursor: pointer;
  display: block;
  outline: none;
}

.vg-thumb-img,
.vg-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* ── HOVER EFFECTS ── */
.vg-hover-zoom .vg-thumb:hover .vg-thumb-img,
.vg-hover-zoom .vg-thumb:focus .vg-thumb-img {
  transform: scale(1.06);
  transition: transform 0.35s ease;
}
.vg-hover-zoom .vg-thumb .vg-thumb-img { transition: transform 0.35s ease; }

.vg-hover-fade .vg-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.25s;
  border-radius: inherit;
  pointer-events: none;
}
.vg-hover-fade .vg-thumb:hover::after { background: rgba(0,0,0,.35); }

.vg-hover-slide .vg-caption { transform: translateY(100%); transition: transform 0.3s ease; }
.vg-hover-slide .vg-thumb:hover .vg-caption { transform: translateY(0); }

/* ── PLAY BUTTON ── */
.vg-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.vg-thumb:hover .vg-play-btn,
.vg-thumb:focus .vg-play-btn { opacity: 1; }

.vg-play-btn svg { width: 44px; height: 44px; }

.vg-play-circle { background: none; }
.vg-play-circle svg {
  background: rgba(0,0,0,.55);
  border-radius: 50%;
  padding: 12px;
  fill: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.5));
}
.vg-play-square svg {
  background: var(--vg-accent, #fff);
  border-radius: 6px;
  padding: 10px;
  fill: #000;
}
.vg-play-minimal svg {
  fill: rgba(255,255,255,.9);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
}

/* ── SOURCE BADGE ── */
.vg-source-badge {
  position: absolute;
  top: 7px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1.4;
  letter-spacing: .04em;
  pointer-events: none;
}
.vg-source-youtube { background: #ff0000; color: #fff; }
.vg-source-vimeo   { background: #1ab7ea; color: #fff; }
.vg-source-direct  { display: none; }

/* ── CAPTION ── */
.vg-caption {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  line-height: 1.3;
  padding: 6px 10px;
}
.vg-caption-below {
  position: relative;
  background: transparent;
  color: var(--vg-text, #fff);
  margin-top: 4px;
  display: block;
}
.vg-caption-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--vg-caption-bg);
  padding: 10px 10px 8px;
}
.vg-caption-hover {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--vg-caption-bg);
  padding: 10px 10px 8px;
  opacity: 0;
  transition: opacity 0.25s;
}
.vg-thumb:hover .vg-caption-hover,
.vg-thumb:focus .vg-caption-hover { opacity: 1; }

/* ── SLIDER ── */
.vg-slider-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--vg-radius);
}
.vg-slider {
  display: flex;
  gap: var(--vg-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.vg-slider::-webkit-scrollbar { display: none; }
.vg-slider .vg-thumb {
  flex-shrink: 0;
  width: 200px;
  scroll-snap-align: start;
}
.vg-slider-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 8px 0 2px;
}
.vg-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  padding: 0;
}
.vg-dot.active { background: var(--vg-accent, #fff); }

/* ── PLAYLIST ── */
.vg-playlist-wrap {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
  align-items: start;
}
@media (max-width: 640px) {
  .vg-playlist-wrap { grid-template-columns: 1fr; }
}
.vg-playlist-main {
  border-radius: var(--vg-radius);
  overflow: hidden;
}
.vg-playlist-list {
  max-height: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
}
.vg-playlist-item {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  padding: 6px;
  border-radius: calc(var(--vg-radius) - 2px);
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.vg-playlist-item:hover,
.vg-playlist-item.active { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }
.vg-plist-thumb {
  width: 60px;
  flex-shrink: 0;
  border-radius: 5px;
  overflow: hidden;
  aspect-ratio: 9/16;
}
.vg-plist-thumb img, .vg-plist-thumb video { width: 100%; height: 100%; object-fit: cover; }
.vg-plist-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.vg-plist-num { font-size: 11px; color: var(--vg-sub, rgba(255,255,255,.5)); }
.vg-plist-caption {
  font-size: 13px;
  font-weight: 500;
  color: var(--vg-text, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vg-source-label {
  font-size: 11px;
  color: var(--vg-sub, rgba(255,255,255,.45));
  text-transform: capitalize;
}

/* ── FEATURED ── */
.vg-featured-wrap { display: flex; flex-direction: column; gap: 10px; }
.vg-featured-main { border-radius: var(--vg-radius); overflow: hidden; }
.vg-featured-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}
.vg-featured-thumbs .vg-thumb-small { width: 100%; }

/* ── HORIZONTAL SCROLL ── */
.vg-horizontal-scroll {
  display: flex;
  gap: var(--vg-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 6px;
}
.vg-horizontal-scroll .vg-thumb {
  flex-shrink: 0;
  width: 180px;
  scroll-snap-align: start;
}

/* ── PLAYER AREA ── */
.vg-player-area {
  width: 100%;
  background: #000;
  border-radius: var(--vg-radius);
  overflow: hidden;
}
.vg-player-inner {
  width: 100%;
  aspect-ratio: 9/16;
}
.vg-player-inner video,
.vg-player-inner iframe { width: 100%; height: 100%; object-fit: contain; border: none; display: block; }
.vg-player-caption {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--vg-text, #fff);
  background: var(--vg-card-bg, #111);
}

/* ── PAGINATION ── */
.vg-pagination { margin-top: 14px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.vg-page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  color: var(--vg-text, #fff);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,.15);
  transition: background 0.15s;
}
.vg-page-btn.active,
.vg-page-btn:hover { background: var(--vg-accent, #fff); color: #000; }

.vg-loadmore-btn {
  all: unset;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 10px 24px !important;
  border-radius: calc(var(--vg-radius) - 2px) !important;
  background: rgba(255,255,255,.1) !important;
  border: 1.5px solid rgba(255,255,255,.2) !important;
  color: var(--vg-text, #fff) !important;
  font-size: 14px !important;
  cursor: pointer !important;
  transition: background 0.15s !important;
}
.vg-loadmore-btn:hover { background: rgba(255,255,255,.2) !important; }

.vg-loading-spinner {
  display: flex;
  justify-content: center;
  padding: 12px;
}
.vg-loading-spinner span {
  width: 26px; height: 26px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--vg-accent, #fff);
  border-radius: 50%;
  animation: vg-spin 0.7s linear infinite;
}
@keyframes vg-spin { to { transform: rotate(360deg); } }

/* ── ERROR ── */
.vg-error { color: #c00; font-size: 13px; padding: 8px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .vg-gallery { padding: 10px; }
  .vg-popup-modal { width: calc(100% - 100px) !important; }
  .vg-slider .vg-thumb { width: 150px; }
  .vg-playlist-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .vg-nav { width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important; }
  .vg-popup-modal { width: calc(100% - 84px) !important; }
  .vg-slider .vg-thumb { width: 120px; }
}
