/* VideoVault WP — Public Styles */
.vvw-wrapper,
.vvw-playlist-wrapper {
  --vvw-gap: 16px;
  --vvw-radius: 8px;
  --vvw-overlay: rgba(0, 0, 0, 0.46);
  --vvw-play-size: 52px;
  --vvw-lb-bg: rgba(0, 0, 0, 0.95);
  --vvw-btn-bg: #cc0000;
  --vvw-btn-hover: #a80000;
  --vvw-speed: 0.28s;
  --vvw-ratio: 56.25%;
}

/* ── Grid ─────────────────────────────────────────────────────────── */
.vvw-grid {
  display: grid;
  gap: var(--vvw-gap);
}

.vvw-cols-1 { grid-template-columns: 1fr; }
.vvw-cols-2 { grid-template-columns: repeat(2, 1fr); }
.vvw-cols-3 { grid-template-columns: repeat(3, 1fr); }
.vvw-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Video Card ───────────────────────────────────────────────────── */
.vvw-item {
  position: relative;
  margin: 0;
  border-radius: var(--vvw-radius);
  overflow: hidden;
  background: #111;
  display: flex;
  flex-direction: column;
}

.vvw-item-link {
  display: block;
  text-decoration: none;
  outline-offset: 2px;
}

/* Responsive ratio box */
.vvw-thumb-wrapper {
  position: relative;
  overflow: hidden;
  background: #222;
  border-radius: var(--vvw-radius) var(--vvw-radius) 0 0;
}

.vvw-thumb-wrapper::before {
  content: '';
  display: block;
  padding-top: var(--vvw-ratio);
}

.vvw-thumb-img,
.vvw-thumb-placeholder {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--vvw-speed) ease;
}

.vvw-thumb-placeholder {
  background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
}

.vvw-item-link:hover .vvw-thumb-img {
  transform: scale(1.04);
}

/* Play overlay */
.vvw-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--vvw-overlay);
  opacity: 0;
  transition: opacity var(--vvw-speed) ease;
  pointer-events: none;
}

.vvw-item-link:hover .vvw-play-overlay,
.vvw-item-link:focus-visible .vvw-play-overlay {
  opacity: 1;
}

.vvw-play-icon {
  width: var(--vvw-play-size);
  height: var(--vvw-play-size);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--vvw-btn-bg);
  font-size: 1.4rem;
  padding-left: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,.45);
  transition: transform var(--vvw-speed) ease;
}

.vvw-item-link:hover .vvw-play-icon {
  transform: scale(1.1);
}

/* Card caption */
.vvw-card-caption {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
  flex: 1;
}

.vvw-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #222;
  display: block;
  line-height: 1.3;
}

.vvw-card-excerpt {
  font-size: 0.78rem;
  color: #777;
  display: block;
  line-height: 1.4;
}

/* ── Load More ────────────────────────────────────────────────────── */
.vvw-load-more-wrapper {
  text-align: center;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.vvw-load-more-btn {
  background: var(--vvw-btn-bg);
  color: #fff;
  border: none;
  padding: 12px 36px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.22s ease;
  font-family: inherit;
}

.vvw-load-more-btn:hover { background: var(--vvw-btn-hover); }
.vvw-load-more-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.vvw-spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid rgba(204, 0, 0, 0.25);
  border-top-color: var(--vvw-btn-bg);
  border-radius: 50%;
  animation: vvw-spin 0.75s linear infinite;
}

@keyframes vvw-spin { to { transform: rotate(360deg); } }

.vvw-no-videos {
  text-align: center;
  color: #777;
  padding: 40px 20px;
  grid-column: 1 / -1;
}

/* ── Video Lightbox ───────────────────────────────────────────────── */
.vvw-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: var(--vvw-lb-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.vvw-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.vvw-lb-inner {
  position: relative;
  width: min(90vw, 960px);
}

.vvw-lb-iframe-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}

.vvw-lb-iframe-wrapper::before {
  content: '';
  display: block;
  padding-top: var(--vvw-ratio, 56.25%);
}

.vvw-lb-iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

.vvw-lb-title {
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  margin-top: 12px;
  font-size: 0.95rem;
  font-weight: 600;
}

.vvw-lb-close {
  position: absolute;
  top: -44px; right: 0;
  width: 36px; height: 36px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.vvw-lb-close:hover { background: rgba(255, 255, 255, 0.28); }

/* ── Playlist Layout ──────────────────────────────────────────────── */
.vvw-playlist-wrapper {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  border: 1px solid #ddd;
  border-radius: var(--vvw-radius);
  overflow: hidden;
  background: #fff;
}

.vvw-playlist-player {
  border-right: 1px solid #e5e5e5;
}

.vvw-playlist-iframe-wrapper {
  position: relative;
  background: #000;
  overflow: hidden;
}

.vvw-playlist-iframe-wrapper::before {
  content: '';
  display: block;
  padding-top: var(--vvw-ratio, 56.25%);
}

.vvw-playlist-iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

.vvw-playlist-info {
  padding: 14px 16px;
  border-top: 1px solid #f0f0f0;
}

.vvw-pl-current-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  color: #222;
}

.vvw-pl-current-desc {
  margin: 0;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.5;
}

/* Playlist sidebar */
.vvw-playlist-list {
  overflow-y: auto;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: #fafafa;
}

.vvw-pl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid #efefef;
  cursor: pointer;
  transition: background 0.18s ease;
  color: inherit;
  font-family: inherit;
}

.vvw-pl-item:hover { background: #f0f4f8; }

.vvw-pl-item.is-active {
  background: #e8f0fe;
  border-left: 3px solid #1a73e8;
}

.vvw-pl-thumb {
  position: relative;
  flex: 0 0 80px;
  height: 52px;
  border-radius: 4px;
  overflow: hidden;
  background: #222;
}

.vvw-pl-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vvw-pl-play,
.vvw-pl-now-playing {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 0.9rem;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}

.vvw-pl-meta {
  flex: 1;
  min-width: 0;
}

.vvw-pl-num {
  display: block;
  font-size: 0.7rem;
  color: #999;
  margin-bottom: 3px;
}

.vvw-pl-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: #333;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .vvw-cols-4 { grid-template-columns: repeat(3, 1fr); }
  .vvw-playlist-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .vvw-playlist-player { border-right: none; border-bottom: 1px solid #e5e5e5; }
  .vvw-playlist-list { max-height: 280px; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .vvw-pl-item { flex-direction: column; min-width: 110px; border-bottom: none; border-right: 1px solid #efefef; }
  .vvw-pl-item.is-active { border-left: none; border-top: 3px solid #1a73e8; }
  .vvw-pl-thumb { flex: none; width: 100%; height: 60px; }
  .vvw-pl-meta { display: none; }
}

@media (max-width: 600px) {
  .vvw-cols-3,
  .vvw-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
  .vvw-cols-2,
  .vvw-cols-3,
  .vvw-cols-4 { grid-template-columns: 1fr; }
}
