/* =========================================================
   LEEFHub MEDIA LIBRARY — FRONTEND STYLES
   Organized by feature: Grid, Player, Programs, Collections
========================================================= */

/* ===========================
   General Layout / Typography
=========================== */
.leefhub-collection-block {
  margin-bottom: 40px;
}
.leefhub-collection-title {
  font-size: 1.4em;
  margin-bottom: 10px;
}
.leefhub-meta {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 12px;
}

/* ======================================================
   GRID LAYOUT — MEDIA GALLERY VIEW
====================================================== */
.leefhub-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 40px auto;
  padding: 0 16px;
  width: 100%;
  max-width: 1600px;
  box-sizing: border-box;
}

/* Responsive columns */
@media (min-width: 1024px) {
  .leefhub-media-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .leefhub-media-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
  .leefhub-media-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .leefhub-media-grid { grid-template-columns: 1fr; }
}

/* Card base */
.media-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  text-align: center;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* Thumbnail */
.media-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  transition: transform 0.2s ease;
}
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-thumb:hover { transform: scale(1.03); }

/* Play overlay (hover) */
.media-thumb .play-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.media-thumb:hover .play-overlay { opacity: 1; }
.media-thumb .play-overlay svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}
@media (max-width: 600px) {
  .media-thumb .play-overlay { display: none; }
}

/* ======================================================
   SINGLE MEDIA PAGE — VIDEO PLAYER
====================================================== */
.leefhub-media-single {
  width: 100%;
  margin: 20px auto;
  padding: 0 16px;
  box-sizing: border-box;
}
.leefhub-media-single h2 {
  margin-bottom: 15px;
  font-size: 1.5em;
  line-height: 1.3;
}
.leefhub-media-single video {
  width: 100%;
  border-radius: 6px;
  display: block;
  margin-bottom: 15px;
}
.leefhub-media-single .media-description {
  margin-top: 15px;
  font-size: 1em;
  color: #444;
  line-height: 1.5;
}

/* Locked Video State */
.media-aspect.locked {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.leefhub-video-locked__poster {
  width: 100%;
  border-radius: 6px;
}
.leefhub-video-locked__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.leefhub-video-locked__icon {
  font-size: 3rem;
  color: #fff;
}
.leefhub-video-locked__poster,
.leefhub-video-locked__overlay {
  pointer-events: none;
  user-select: none;
}

/* Locked video purchase notice */
.leefhub-media-single__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 1.5rem;
}
.leefhub-video-buttons { margin-left: 10px; }

/* Back Button */
.leefhub-back-btn {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 500;
  color: #0073aa;
  text-decoration: none;
  transition: color 0.2s ease;
}
.leefhub-back-btn:hover {
  color: #005177;
  text-decoration: underline;
}

/* ======================================================
   GLOBAL BUTTON STYLES
====================================================== */
.button {
  display: inline-block;
  padding: 8px 16px;
  background-color: #007bff;
  color: #fff;
  border-radius: 5px;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s ease;
}
.button:hover { background-color: #0056b3; }

/* ======================================================
   PROGRAMS — GRID + DETAIL VIEW
====================================================== */

/* Programs Grid */
.leefhub-programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.leefhub-program-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.leefhub-program-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.leefhub-program-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}
.program-info {
  padding: 12px 16px 16px;
}
.program-title {
  font-size: 1.1em;
  margin: 0 0 8px;
}
.program-title a {
  text-decoration: none;
  color: #222;
}
.program-title a:hover { text-decoration: underline; }
.program-desc {
  color: #666;
  font-size: 0.9em;
  margin: 0;
}

/* Program Detail Header */
.program-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.program-desc {
  font-size: 15px;
  color: #555;
  max-width: 700px;
}

/* Program Video List */
.leefhub-program-video-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}
.program-video-item {
  display: flex;
  gap: 20px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.video-thumb { flex: 0 0 200px; }
.video-thumb img {
  width: 200px;
  height: auto;
  border-radius: 6px;
  object-fit: cover;
}
.video-meta { flex: 1; }
.video-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.video-title a {
  text-decoration: none;
  color: #222;
}
.video-desc {
  color: #555;
  font-size: 14px;
  line-height: 1.5;
}

/* ======================================================
   Responsive Fix — Program Video List
====================================================== */
@media (max-width: 900px) {
  .program-video-item {
    flex-direction: column; /* ✅ Stack thumbnail + text */
    align-items: flex-start;
  }

  .video-thumb {
    flex: none;
    width: 100%;
  }

  .video-thumb img {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: cover;
    border-radius: 8px;
  }

  .video-meta {
    width: 100%;
    padding-top: 10px;
  }

  .video-title {
    font-size: 1rem;
  }

  .video-desc {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .program-video-item {
    padding: 12px;
    gap: 12px;
  }

  .video-thumb img {
    max-height: 220px;
  }

  .video-title {
    font-size: 0.95rem;
  }
}

/* ======================================================
   Responsive Fix — Program Header
====================================================== */
@media (max-width: 900px) {
  .program-header {
    flex-direction: column; /* ✅ stack image + description */
    align-items: flex-start;
  }

  .program-header img {
    width: 100%;
    height: auto;
    border-radius: 10px;
  }

  .program-desc {
    max-width: 100%;
    margin-top: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
  }
}

/* ======================================================
   COLLECTION ROWS — “Netflix” Horizontal Scroll
====================================================== */
.leefhub-collection-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.leefhub-collection-row {
  flex: 1;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.leefhub-collection-row .media-thumb {
  flex: 0 0 220px;
  height: 124px;
}
.leefhub-collection-row .media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scroll arrows */
.leefhub-scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--leefhub-btn-bg, #0073aa);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
  z-index: 2;
}
.leefhub-scroll-arrow.left { left: -18px; }
.leefhub-scroll-arrow.right { right: -18px; }
.leefhub-scroll-arrow:hover { background: var(--leefhub-btn-hover, #005f8d); }
.leefhub-scroll-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}
@media (max-width: 600px) {
  .leefhub-scroll-arrow { display: none; }
}

/* ======================================================
   PAGINATION (Global)
====================================================== */
.leefhub-pagination {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  gap: 8px;
  flex-wrap: wrap;
}
.leefhub-pagination .page-numbers {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  background: var(--leefhub-btn-bg, #0073aa);
  color: var(--leefhub-btn-text, #fff);
  transition: background 0.2s ease;
}
.leefhub-pagination .page-numbers:hover {
  background: var(--leefhub-btn-hover, #005f8d);
}
.leefhub-pagination .page-numbers.current {
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ======================================================
   Back Button (Global Inheritance)
====================================================== */

/* Wrapper above player box */
.leefhub-back-wrapper {
  width: 100%;
  max-width: 900px;
  margin: 0 auto 20px;
  padding: 0 16px;
  box-sizing: border-box;
}

/* Inherit global button palette */
.leefhub-back-btn {
  background: var(--leefhub-btn-bg, #0073aa);
  color: var(--leefhub-btn-text, #fff);
  border: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  padding: 8px 16px;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s ease, color 0.2s ease;
}

.leefhub-back-btn:hover {
  background: var(--leefhub-btn-hover, #005f8d);
  color: var(--leefhub-btn-text, #fff);
  text-decoration: none;
}

/* Keep program cover images in 16:9 aspect ratio */
.leefhub-program-card .program-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9; /* magic line */
  overflow: hidden;
  border-radius: 12px;
  background-color: #000; /* fallback background while loading */
}

.leefhub-program-card .program-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
