/* ==========================================================================
   VisionCourse - Video Waterfall / Grid Layout
   - Fluid Edge-to-Edge with Equal Margin: Left & Right spacing matches Top spacing (28px)
   - Eliminates excessive side margins so cards expand prominently
   - Strictly 3 items in the first row on desktop (repeat(3, 1fr))
   - On hover: Soft background frame encloses video, title & attachment (YouTube style)
   - No attachments = attachment element completely hidden
   ========================================================================== */

.waterfall-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 28px 28px 90px;
  box-sizing: border-box;
}

/* Strictly 3 items per row on desktop */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 36px 28px;
  align-items: start;
  width: 100%;
}

@media (max-width: 1100px) {
  .waterfall-container {
    padding: 20px 20px 70px;
  }
  .video-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 28px 20px;
  }
}

@media (max-width: 680px) {
  .waterfall-container {
    padding: 16px 16px 60px;
  }
  .video-grid {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }
}

/* ================= Video Item ================= */
/* Normal state: transparent canvas;
   On hover: Soft background box encloses the video thumbnail, title, and attachment together (YouTube style) */
.video-item {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  padding: 14px;
  border-radius: 18px;
  background: transparent;
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  margin: -14px; /* preserves natural grid spacing while allowing hover padding frame */
  text-decoration: none;
}

.video-item:hover {
  background: #f2f2f5;
  border-color: rgba(0, 0, 0, 0.05);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

[data-theme="dark"] .video-item:hover {
  background: #1c1c1f;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}

/* Video Thumbnail Container (Strictly 16:9) */
.video-poster-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background-color: transparent;
  margin-bottom: 14px;
}

.video-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  transition: transform var(--transition-medium);
}

.video-item:hover .video-poster {
  transform: scale(1.02);
}

/* Centered Subtle Frosted Play Button */
.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0;
  transition: all var(--transition-fast);
}

.video-play-overlay svg {
  width: 26px;
  height: 26px;
  margin-left: 2px;
  fill: currentColor;
}

.video-item:hover .video-play-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Duration Badge (Bottom Right Minimalist Pill) */
.video-duration-pill {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  font-family: SF Pro Text, -apple-system, sans-serif;
  padding: 3px 9px;
  border-radius: 5px;
  letter-spacing: 0.04em;
}

/* ================= Video Meta Row ================= */
.video-info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 0 2px;
  background: transparent;
  border: none;
}

/* Left Title Column */
.video-title-col {
  flex: 1;
  min-width: 0;
}

.video-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-fast);
}

.video-item:hover .video-title {
  color: var(--text-accent);
}

/* Right Attachment Download Action (Rendered ONLY if video has attachments) */
.video-attachment-action {
  flex-shrink: 0;
  margin-top: 2px;
}

.video-attachment-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-blue);
  background: var(--accent-blue-subtle);
  padding: 4px 11px;
  border-radius: 6px;
  display: inline-block;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.video-item:hover .video-attachment-link {
  background: var(--accent-blue);
  color: #ffffff;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 100px 20px;
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--text-muted);
}
