/**
 * GBblitz - Video Grid & Card Component Stylesheet
 * 
 * Encapsulates the video card grid layout, 25px card windows, 3:2 thumbnail wrappers,
 * hover preview slots, play button overlay, wave tags, designation badges, 2-line clamped titles,
 * click prompt, and empty state.
 */

/* ==========================================================================
   Video Grid & Video Cards (25px Rounded with Perimeter Gradient Glow)
   ========================================================================== */

.video-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

/* Base Card (Main Window: #161a1e, 25px Rounded Corners) */
.video-card {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  transition: 
    opacity 0.42s cubic-bezier(0.2, 0.8, 0.2, 1), 
    transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1), 
    border-color var(--transition-normal), 
    box-shadow var(--transition-normal);
  outline: none;
  z-index: 1;
}

/* Revealed State: Faded in & Grown to Regular Size as Scrolled into View */
.video-card.is-revealed {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Signature Googlebook Gradient Perimeter Glow on Hover */
.video-card.is-revealed:hover,
.video-card.is-revealed:focus-visible,
.video-card.is-revealed.is-playing {
  transform: translateY(-5px) scale(1);
  border-color: rgba(49, 134, 255, 0.55);
  box-shadow: 
    0 20px 45px -10px rgba(0, 0, 0, 0.95),
    -4px -2px 28px -4px rgba(49, 134, 255, 0.35),
    4px 6px 32px -4px rgba(255, 70, 65, 0.35);
  z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .video-card {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    pointer-events: auto !important;
  }
}

/* Highlighted & Winner Cards */
.card-highlight {
  border-color: rgba(49, 134, 255, 0.3);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8), -2px -2px 18px -4px rgba(49, 134, 255, 0.2);
}

.card-winner {
  border-color: rgba(255, 204, 0, 0.3);
}

.card-winner:hover {
  border-color: rgba(255, 204, 0, 0.65);
  box-shadow: 
    0 20px 45px -10px rgba(0, 0, 0, 0.95),
    -4px -2px 28px -4px rgba(49, 134, 255, 0.3),
    4px 6px 32px -4px rgba(255, 204, 0, 0.45);
}

/* Card Thumbnail Wrapper - Always uniform horizontal 3:2 aspect ratio (matching Highlighted Videos carousel) */
.video-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #07090c;
  overflow: hidden;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

/* Thumbnail image fills 3:2 window edge-to-edge (no black bars, matching carousel) */
.video-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  transition: transform var(--transition-smooth), opacity var(--transition-normal);
}

.video-card:hover .video-thumb-img {
  transform: scale(1.02);
}

/* For portrait videos, center framing cleanly in the 3:2 container */
.video-card.is-portrait .video-thumb-img {
  object-position: center 25%;
}

.video-card.is-portrait:hover .video-thumb-img {
  transform: scale(1.02);
}

.video-card.is-playing .video-thumb-img {
  opacity: 0.85;
}

/* Hover Preview iFrame Slot - Fit width seamlessly into preview window */
.preview-iframe-slot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
  background: transparent;
  opacity: 0;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Transparent shield over preview video to maintain parent mouse tracking on top of playing video */
.preview-iframe-slot::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  background: transparent;
}

/* Video Preview iFrame - Landscape default fits the 3:2 viewport width */
.video-preview-iframe {
  position: absolute;
  top: -46px;
  left: 50%;
  width: 160%;
  height: calc(160% + 56px);
  transform: translateX(-50%) scale(0.625);
  transform-origin: 50% 0;
  border: none;
  pointer-events: none;
}

/* Portrait Hover Preview iFrame - Centered & scaled to fit 100% width edge-to-edge without black bars */
.video-card.is-portrait .video-preview-iframe {
  position: absolute;
  top: -46px;
  left: 50%;
  width: 160%;
  height: calc(160% + 56px);
  transform: translateX(-50%) scale(1.72) !important;
  transform-origin: 50% 18% !important;
  border: none;
  pointer-events: none;
}

.video-card.is-playing .preview-iframe-slot {
  opacity: 1;
}

.video-card.is-playing .preview-iframe-slot::after {
  pointer-events: auto;
}

.video-card.is-playing .video-thumb-img {
  opacity: 0;
}

.video-card.is-playing .video-play-overlay {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.85);
}

/* Centered Play Button Overlay on Thumbnail */
.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.video-play-btn-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65);
  transition: all var(--transition-fast);
}

.video-card:hover .video-play-btn-circle {
  transform: scale(1.12);
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 0 22px rgba(49, 134, 255, 0.65);
}

.video-play-btn-circle svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}

.video-card.is-playing .video-play-overlay {
  opacity: 0;
  transform: scale(0.8);
}

/* Thumbnail Badges */
.thumb-badges {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
  z-index: 4;
}

/* Wave Pill (Solid Gradient #3387ff to #a9a8ff) */
.wave-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--grad-wave-1, linear-gradient(90deg, #3387ff 0%, #a9a8ff 100%));
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(51, 135, 255, 0.35);
}

/* Designation Badges with Sparse Tertiary Accents */
.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Highlight: Blue Accent */
.badge-highlight {
  background: var(--grad-blue);
  color: #ffffff;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(26, 115, 232, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Winner: Yellow Accent */
.badge-winner {
  background: var(--grad-yellow);
  color: #202124;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(249, 171, 0, 0.4);
}

/* Runner Up: Red/Coral Accent */
.badge-runner-up {
  background: var(--grad-red);
  color: #ffffff;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(234, 67, 53, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Approved: Green Accent */
.badge-approved {
  background: var(--grad-green);
  color: #ffffff;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(52, 168, 83, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.badge-general {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Hover Scrub Bar with Googlebook Gradient */
.hover-scrub-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3.5px;
  background: rgba(255, 255, 255, 0.12);
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 4;
}

.hover-scrub-progress {
  height: 100%;
  width: 0%;
  background: var(--googlebook-gradient);
}

.video-card.is-playing .hover-scrub-bar {
  opacity: 1;
}

/* Card Body */
.video-card-body {
  padding: 0.95rem 0.95rem 1.1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 0.55rem;
}

.video-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta-row {
  display: flex;
  align-items: center;
  margin-top: auto;
  font-size: 0.74rem;
  gap: 0.5rem;
}

.video-wave-tag,
.wave-pill,
.category-pill,
.video-category-tag {
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  background: var(--grad-sentiment, linear-gradient(90deg, #3387ff 0%, #a9a8ff 100%)) !important;
  border: none !important;
  padding: 0.24rem 0.72rem !important;
  border-radius: var(--radius-pill) !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 10px rgba(51, 135, 255, 0.4) !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  display: inline-flex !important;
  align-items: center !important;
}

.video-wave-tag[data-category="Teach-back"],
.video-wave-tag[data-category="TEACH-BACK"],
.video-wave-tag[data-wave="Teach-back"],
.category-pill[data-category="Teach-back"],
.video-category-tag[data-category="Teach-back"] {
  background: var(--grad-teachback, linear-gradient(90deg, #0ebc5f 0%, #78c9ff 100%)) !important;
  box-shadow: 0 2px 10px rgba(14, 188, 95, 0.4) !important;
}

.video-designation-badge {
  font-size: 0.66rem;
  font-weight: 400;
  padding: 0.16rem 0.5rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.video-click-prompt {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.72rem;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.video-card:hover .video-click-prompt {
  color: var(--accent-blue);
  transform: translateX(2px);
}

.video-click-prompt svg {
  width: 14px;
  height: 14px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}
