/* ===================================================================
   LEEFHub – Media Library & Programs (Frontend)
   -------------------------------------------------------------------
   Contains:
   • Media grid
   • Program grid
   • Netflix-style horizontal scroll rows
   • Single video program layout
   • 16:9 video player
   • Divi/Elementor compatibility fixes
=================================================================== */
.leefhub-media-single__description{
  padding-top:12px;
}


/* ===================================================================
   1. GLOBAL CONTAINERS
=================================================================== */
.leefhub-container,
.leefhub-single-wrapper,
.leefhub-media-programs,
.leefhub-media-collections,
.leefhub-media-gallery {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}


/* ===================================================================
   2. UNIVERSAL 16:9 THUMBNAIL
=================================================================== */
.media-thumb,
.program-cover,
.program-cover-large-wrapper,
.program-video-card .media-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
  background: #000;
  border-radius: 12px;
  display: block;
}

.media-thumb img,
.program-cover img,
.program-video-card .media-thumb img,
.program-cover-large-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* ===================================================================
   3. VIDEO LIBRARY – RESPONSIVE GRID
=================================================================== */
.leefhub-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

@media (max-width: 900px) {
  .leefhub-media-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}
@media (max-width: 600px) {
  .leefhub-media-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
@media (max-width: 480px) {
  .leefhub-media-grid {
    grid-template-columns: 1fr;
  }
}

.media-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 8px;
  transition: 0.2s;
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);

  display: flex;
  justify-content: center;
  align-items: center;

  opacity: 0;
  transition: 0.25s;
}

.media-thumb:hover .play-overlay {
  opacity: 1;
}

.media-title {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 8px;
}



/* ===================================================================
   4. NETFLIX-STYLE COLLECTION ROWS (always scrollable)
=================================================================== */

/* Wrapper must not clip scrollbar */
.leefhub-collection-wrapper {
  width: 100%;
  position: relative;
  overflow: hidden !important;

  display: flex;
  align-items: center;
}

/* Horizontal scroll row */
.leefhub-collection-row {
  width: 100%;
  display: flex;
  gap: 12px;

  overflow-x: scroll !important;
  overflow-y: hidden !important;

  padding-bottom: 16px; 
  scroll-behavior: smooth;

  -webkit-overflow-scrolling: touch;
}

/* Force overflow even when too few items */
@media (min-width: 768px) {
  .leefhub-collection-row::after {
    content: "";
    flex: 0 0 120px;
  }
}

/* Scrollbar styling */
@media (min-width: 768px) {
  .leefhub-collection-row {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0,0,0,0.45) rgba(0,0,0,0.12) !important;
  }

  .leefhub-collection-row::-webkit-scrollbar {
    height: 10px !important;
  }
  .leefhub-collection-row::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.12) !important;
    border-radius: 6px;
  }
  .leefhub-collection-row::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.45) !important;
    border-radius: 6px;
  }
}

/* MOBILE: hide scrollbar */
@media (max-width: 767px) {
  .leefhub-collection-row {
    scrollbar-width: none !important;
  }
  .leefhub-collection-row::-webkit-scrollbar {
    display: none !important;
  }
}



/* ===================================================================
   5. NETFLIX RESPONSIVE SIZING
=================================================================== */
.leefhub-collection-row .media-thumb {
  min-width: 240px;
  flex-shrink: 0;
  border-radius: 12px;
}

@media (min-width: 1301px) {
  .leefhub-collection-row .media-thumb {
    flex: 0 0 calc((100% - 36px) / 4.5);
  }
}
@media (max-width: 1300px) and (min-width: 1101px) {
  .leefhub-collection-row .media-thumb {
    flex: 0 0 calc((100% - 24px) / 3.5);
  }
}
@media (max-width: 1100px) and (min-width: 769px) {
  .leefhub-collection-row .media-thumb {
    flex: 0 0 calc((100% - 12px) / 2.5);
  }
}
@media (max-width: 768px) and (min-width: 521px) {
  .leefhub-collection-row .media-thumb {
    flex: 0 0 calc((100% - 12px) / 1.8);
  }
}
@media (max-width: 520px) and (min-width: 421px) {
  .leefhub-collection-row .media-thumb {
    flex: 0 0 70%;
  }
}
@media (max-width: 420px) {
  .leefhub-collection-row .media-thumb {
    flex: 0 0 100%;
  }
}



/* ===================================================================
   6. PROGRAM GRID
=================================================================== */
.leefhub-programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

@media (max-width: 768px) {
  .leefhub-programs-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.leefhub-program-card {
  background: #fff;
  border: 2px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  transition: 0.25s;
}

.leefhub-program-card:hover {
  transform: translateY(-4px);
  border-color: var(--lh-primary);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.program-info {
  padding: 14px 16px;
}

.program-title {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0 0 6px;
}

.program-desc {
  font-size: 0.9em;
  color: #666;
  margin: 0;
  line-height: 1.4;
}



/* ===================================================================
   7. PROGRAM SINGLE PAGE
=================================================================== */
.program-header {
  margin-bottom: 32px;
  text-align: center;
}

.program-cover-large-wrapper {
  max-width: 900px;
  margin: 0 auto 20px;
  border-radius: 12px;
}

.program-meta {
  max-width: 800px;
  margin: 0 auto;
}

/* ===================================================================
   7A. PROGRAM SINGLE – CARD LAYOUT FIX
=================================================================== */

.leefhub-program-card-full {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  border: 1px solid #eee;
  box-shadow: 0 3px 12px rgba(0,0,0,0.05);

  display: flex;
  flex-direction: column;
  gap: 22px;
  box-sizing: border-box;
}

.leefhub-back-btn {
  display: inline-block;
  margin-bottom: 12px;

  background: var(--lh-primary);
  color: var(--lh-text-contrast);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: 0.2s ease;
}

.leefhub-back-btn:hover {
  background: var(--lh-primary-hover);
  transform: translateY(-1px);
}

/* Program Cover Image */
.program-cover-wrapper-small {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
}

.program-cover-img {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  aspect-ratio: 16/9;
  display: block;
}

/* Program Title */
.program-title-main {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  padding-top: 10px;
}

/* Program Description */
.program-description-full {
  /* max-width: 650px; */
  margin: 0 auto;
  text-align: center;
  color: #555;
  line-height: 1.6;
  font-size: 1.1rem;
}

/* ===================================================================
   PROGRAM SINGLE – VIDEO LIST ROWS
=================================================================== */

.program-video-list-rows {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 18px;
}

/* Each video row */
.program-video-row {
  display: flex;
  gap: 16px;

  padding: 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #eee;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);

  text-decoration: none !important;
  color: inherit !important;

  transition: 0.2s ease;
}

.program-video-row:hover {
  transform: translateY(-2px);
  border-color: var(--lh-primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}

/* Thumbnail */
.row-thumb {
  width: 180px;
  flex-shrink: 0;
}

.row-thumb img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
}

/* Info */
.row-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.row-info h3 {
  margin: 0 0 6px 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.row-info p {
  margin: 0;
  color: #666;
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 90%;
}

/* MOBILE */
@media (max-width: 600px) {
  .program-video-row {
    flex-direction: column;
  }

  .row-thumb {
    width: 100%;
  }

  .row-thumb img {
    height: 160px;
  }
}

/* ===================================================================
   8. VIDEO PLAYER (responsive 16:9)
=================================================================== */
.media-player {
  width: 100%;
}

.media-aspect {
  width: 100%;
  aspect-ratio: 16 / 9;

  background: #000;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.media-aspect video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: 100%;
  height: 100%;
  object-fit: contain;
}



/* ===================================================================
   9. BUILDER COMPATIBILITY
=================================================================== */

/* Divi Sections wrap shortcodes in <p> — remove */
.et_pb_text_inner p > .leefhub-root {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Full-width override */
.et_pb_text_inner .leefhub-root,
.et_pb_module .leefhub-root,
.et_pb_column .leefhub-root,
.et_pb_row .leefhub-root {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
}

/* Ensure rows scroll */
.leefhub-root .leefhub-collection-row {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Ensure grids break properly */
.leefhub-root .leefhub-media-grid,
.leefhub-root .leefhub-collection-row,
.leefhub-root .leefhub-programs-grid {
  width: 100% !important;
}

/* ===================================================================
   MEDIA FILTER BAR — Subtle Minimal Style
=================================================================== */

.leefhub-filter-bar,
.leefhub-media-filters {
  width: 100%;
  padding: 6px 0 12px;
  margin: 12px 0 24px;
  
  display: flex;
  align-items: flex-end;
  gap: 22px;
  flex-wrap: wrap;

  border-bottom: 1px solid var(--lh-border);
}

/* Filter Group */
.lh-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  flex: 1;
}

/* Label */
.lh-filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--lh-text-muted);
  letter-spacing: 0.2px;
}

/* Select — subtle */
.lh-filter-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 100%;
  padding: 8px 34px 8px 12px;
  background: var(--lh-bg);
  border-radius: 6px;
  border: 1px solid var(--lh-border);

  font-size: 0.9rem;
  color: var(--lh-text);

  transition: border-color .15s ease, box-shadow .15s ease;
}

/* Hover/Focus — extremely subtle */
.lh-filter-select:hover {
  border-color: var(--lh-primary);
}

.lh-filter-select:focus {
  border-color: var(--lh-primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--lh-primary-hover)22;
}

/* Custom arrow */
.lh-filter-group {
  position: relative;
}

.lh-filter-group select.lh-filter-select {
  padding-right: 38px;
}

.lh-filter-group select.lh-filter-select::-ms-expand {
  display: none;
}

.lh-filter-group::after {
  content: "▾";
  position: absolute;
  right: 12px;
  bottom: 13px;
  pointer-events: none;
  color: var(--lh-text-muted);
  font-size: 0.95rem;
}

/* MOBILE — single column */
@media (max-width: 768px) {
  .leefhub-filter-bar,
  .leefhub-media-filters {
    gap: 14px;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 16px;
  }

  .lh-filter-group {
    min-width: 100%;
  }
}

/* Tablet: split filters into 2 columns */
@media (max-width: 1024px) and (min-width: 769px) {
  .leefhub-filter-bar,
  .leefhub-media-filters {
    gap: 18px;
    flex-wrap: wrap;
  }

  .lh-filter-group {
    flex: 1 1 calc(50% - 18px);
    min-width: 220px;
  }
}

/* ===============================================================
   LEEFHub – Tablet Responsiveness (768px–1200px)
   Fixes layouts on iPad portrait/landscape and mid-size tablets
================================================================ */

/* 1. Container spacing for tablet */
@media (max-width: 1200px) and (min-width: 769px) {
  .leefhub-container {
    padding-left: 20px;
    padding-right: 20px;
    max-width: 100% !important; /* ensures no horizontal overflow */
  }
}

/* 2. Media grid – better column count on tablet */
@media (max-width: 1024px) and (min-width: 769px) {
  .leefhub-media-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
  }
}

/* 3. Filter bar – fix squished dropdowns on tablet */
@media (max-width: 1024px) and (min-width: 769px) {
  .leefhub-filter-bar,
  .leefhub-media-filters {
    flex-wrap: wrap;
    gap: 18px;
  }

  .lh-filter-group {
    flex: 1 1 calc(50% - 18px); /* two per row */
    min-width: 240px;
  }
}

/* 4. Netflix rows – tablet cards too large unless resized */
@media (max-width: 1024px) and (min-width: 769px) {
  .leefhub-collection-row .media-thumb {
    flex: 0 0 calc((100% - 40px) / 3); /* ~3 cards across */
    max-height: 200px;
  }
}

/* 5. Prevent tablet horizontal scroll issues */
@media (max-width: 1200px) and (min-width: 769px) {
  .leefhub-container,
  .leefhub-media-gallery,
  .leefhub-media-collections {
    overflow-x: hidden !important;
  }
}
