.lesson-slider-wrapper {
  position: relative;
  overflow: hidden;
}

.lesson-slider {
  /*
  display: flex;
  gap: 16px;
  overflow-x: scroll;
  scroll-behavior: smooth;
  padding: 2px 0;
  scrollbar-width: none;
  margin: 0 40px;
  border-radius: 10px;
  */
}
.lesson-slider::-webkit-scrollbar {
  display: none;
}

section.lesson-group {
  margin-left: -30px;
  margin-right: -30px;
  padding-left: 30px;
  padding-right: 30px;
  position: relative;
}

.lesson-card {
  /* flex: 0 0 420px; */
  background-color: rgb(249, 249, 249);
  box-shadow: rgba(0, 0, 0, 0.2) 0px 3px 6px;
  border-radius: 12px;
  padding: 16px 32px 0;
  transition: transform 0.2s ease;
  min-height: 350px;
}

.lesson-card .lesson-tile .title {
  font-weight: bold;
  font-size: 18px;
}
.lesson-card:hover {
  /* transform: translateY(-3px); */
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  padding: 0;
}
.slider-btn:hover,
.slider-btn:focus {
  background: #f2f2f2;
}
.slider-btn.prev {
  left: 6px;
}
.slider-btn.next {
  right: 6px;
}
.lesson-title {
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.lesson-group {
  margin-bottom: 60px;
}

.video-icon {
  opacity: 1;
  position: absolute;
  z-index: 2;
  bottom: 6px;
  right: 0;
}

a {
  color: #000;
}

/* Header	 */
.wp-block-group {
  margin-top: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* 
           =========================================================
           1. MASTER THEME BREAKOUT
           ========================================================= 
         */
#lesson-search {
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  padding: 0 64px !important; /* FLUID WIDTH */
  box-sizing: border-box;
  overflow-x: hidden;
}

#lesson-filter-bar {
  background: transparent;
  padding: 0;
  z-index: 10;
}

/* 
           =========================================================
           2. LARGE DESKTOP DEFAULT (> 1600px)
           =========================================================
        */
@media (min-width: 1600px) {
  .top-header {
    display: flex;
    /* grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); */
    align-items: center;
    width: 100%;
    gap: 20px;
    position: relative;
    padding: 15px 0; /* Padding inside the grey strip */
    margin-bottom: 25px; /* Spacings below strip before cards */
  }

  /* The Full-Bleed Grey Banner Background via Pseudo Element */
  .top-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background-color: #fafbfc; /* Matches the Mockup background */
    border-bottom: 1px solid #e0e0e0;
    z-index: -1;
  }

  .device-types-wrapper {
    grid-column: 1 / 2;
  }
  .filter-and-button-group {
    grid-column: 2 / 3;
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .device-types {
    justify-content: flex-start;
  } /* Left aligned Desktop */
}

#lesson-filter-form {
  font-size: 14px;
  width: 100%;
}

.lesson-tiles-container {
  width: 100%;
  box-sizing: border-box;
  display: grid;
  gap: 25px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.lesson-tiles-container a {
  text-decoration: none;
}

.lesson-tiles-container .lesson-tile .title {
  font-size: 18px;
  font-weight: bold;
}

.lesson-tiles-container .lesson-tile {
  background-color: rgb(249, 249, 249);
  box-shadow: rgba(0, 0, 0, 0.2) 0px 3px 6px;
  min-height: 350px;
  padding: 16px 32px;
  border-radius: 14px;
  position: relative;
  height: 100%;
  box-sizing: border-box;
}
.lesson-card .lesson-tile {
  height: 100%;
}
.lesson-tiles-container .lesson-tile .grades,
.lesson-card .grades {
  display: flex;
  gap: 4px;
  color: rgb(72, 48, 143);
  font-size: 14px;
  position: absolute;
  bottom: 20px;
  width: 90%;
}
.lesson-tiles-container .lesson-tile .title {
  color: #000;
}

/* ------------------------------------------------------------------
           THE PILL: Matches the stadium-border screenshot identically
        ------------------------------------------------------------------ */
.lesson-filter-wrapper {
  display: flex;
  gap: 2px;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-radius: 50px;
  border: 1px solid #e0e0e0;
  width: max-content !important;
  margin: 0;
  padding: 4px 0px;
}

.lesson-filter-wrapper.active {
  background-color: #fff;
  border-radius: 50px;
}

.lesson-filter-wrapper .lesson-filter {
  font-weight: 600;
  color: #000;
  padding: 4px 20px;
  cursor: pointer;
  position: relative;
  white-space: nowrap; /* Prevents text from breaking lines */
}

.lesson-filter-wrapper .lesson-filter:not(:first-child) {
  border-left: 1px solid #e0e0e0;
}

.lesson-filter-wrapper .lesson-filter.active {
  border-radius: 32px;
  background-color: #fafbfd; /* Very subtle highlight */
  padding: 8px 20px;
}

.lesson-filter-wrapper .lesson-filter.search-keyword {
  padding-right: 8px; /* Tighter padding for search icon side */
}

.lesson-filter-wrapper .lesson-filter .sub-label {
  font-size: 12px;
  font-weight: normal;
  display: none;
}

.lesson-filter-wrapper.active .sub-label {
  display: block;
}

.lesson-filter.search-keyword.active .main-label {
  /* display: none; */
}

/* ===============================================================
           FIXED: DROPDOWN POPUPS SAFELY ESCAPE THE NOWRAP PROPERTY
           =============================================================== */
.lesson-filter-wrapper .filter-options,
.lesson-filter-wrapper .lesson-keyword-wrapper {
  display: none;
  position: absolute;
  top: 60px;
  left: 0;
  background-color: #fff;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 15px;
  padding: 20px;
  width: 320px; /* Restored safe spatial width */
  border-radius: 12px;
  z-index: 99;
  white-space: normal; /* THIS STOPS THE HORIZONTAL SPILLING! */
  cursor: default; /* Reverts button cursor for proper checkbox clicking */
}

.lesson-filter-wrapper .lesson-keyword-wrapper {
  width: 450px;
}

.lesson-filter-wrapper .lesson-filter.active .filter-options {
  display: block;
}

.lesson-filter-wrapper .lesson-filter.active .filter-options.options-ozo_subject {
  display: flex;
  flex-direction: column;
}

.lesson-filter-wrapper
  .lesson-filter.active.search-keyword
  .lesson-keyword-wrapper {
  display: flex; /* Overrides block for fluid column layout */
  flex-direction: column;
  gap: 4px;
}

.lesson-filter-wrapper .lesson-filter .filter-options .filter-option-label {
  margin-right: 1em;
  display: inline-block;
  font-size: 16px;
  min-width: 40%;
  padding: 5px 0;
  font-weight: 500;
}

.lesson-filter-wrapper
  .lesson-filter
  .filter-options
  .filter-option-label
  input[type="checkbox"] {
  margin-right: 5px;
}

/* ------------------------------------------------------------------
           THE FILTERS BUTTON: Visible everywhere, matched to screenshot
        ------------------------------------------------------------------ */
#open-filter-popup {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e0e0e0;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: #000;
  height: fit-content;
  white-space: nowrap; /* Prevents wrapping */
}

#lesson-filter-popup .popup-header {
  display: flex;
  justify-content: center;
  background-color: rgb(245, 248, 250);
}

#lesson-filter-popup .popup-header h3 {
  margin-block: 12px;
}

#lesson-filter-popup .popup-content {
  padding-inline: 30px;
}

.popup-content .lesson-filter .filter-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-left: 10px;
}

.popup-content .lesson-filter .filter-options .filter-option-label {
  display: flex;
  gap: 8px;
}

.popup-content .lesson-filter .main-label {
  margin-block: 20px;
}

#lesson-filter-popup .popup-footer {
  margin-top: 24px;
  padding: 20px;

  border-top: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-inline: 30px;
}

#lesson-filter-popup .popup-footer .clear-filters {
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
}

#lesson-filter-popup .popup-footer .apply-filters {
  padding: 10px 20px;
  cursor: pointer;
  border: 0px;
  border-radius: 20px;
  background-color: rgb(0, 0, 255);
  color: #fff;
  font-weight: 500;
}

/* Device types */
.device-types {
  display: flex;
  gap: 4px;
  text-align: center;
}

.device-types-wrapper .device-type {
  cursor: pointer;
  width: 100px;
}
.device-type .icon {
  width: 50px;
  cursor: pointer;
}

.device-type .title {
  font-size: 14px;
  font-weight: bold;
  margin-top: 5px;
}

.main-label {
  font-size: 16px;
  font-weight: bold;
  text-transform: capitalize;
}

#selected_options_values {
  display: flex;
  gap: 10px;
}

.selected-option-value {
  background-color: rgb(236, 241, 244);
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
}

.selected-option-value svg {
  cursor: pointer;
}

.lesson-tile .summary {
  color: rgb(149, 171, 185);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;

  padding-top: 12px;
  border-top: 1px solid #888;
  margin-top: 12px;
}

.filter-values-row {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  margin-bottom: 8px;
}

.lesson-title {
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.lesson-group {
  margin-bottom: 60px;
}

/* 
           =========================================================
           3. INTERMEDIATE LAYOUT (1024px to 1599px)
           ========================================================= 
         */
@media (min-width: 1024px) and (max-width: 1599px) {
  .top-header {
    display: flex;
    flex-direction: column-reverse; /* Bottom=Devices, Top=Pills */
    align-items: center; /* PERFECTLY CENTERS BOTH ROWS */
    padding: 0;
  }

  .filter-and-button-group {
    display: flex;
    flex-direction: row;
    gap: 16px;
    padding: 15px 0; /* Padding inside the grey strip */
    width: 100%;
    justify-content: center;
    position: relative; /* Anchors the moving grey strip */
  }

  /* Moves the Full Bleed strip strictly to the filter level */
  .filter-and-button-group::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background-color: #fafbfc;
    border-bottom: 1px solid #e0e0e0;
    z-index: -1;
  }

  /* Reduced spacing pushing away from banner */
  .device-types-wrapper {
    padding: 15px 0 10px 0;
  }

  .device-types {
    flex-wrap: nowrap;
    justify-content: center; /* CENTER ALIGN */
  }

  /* Expands tiles dynamically into a 2-column mobile vibe */
  .lesson-tiles-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 
           =========================================================
           4. UNIVERSAL MOBILE LAYOUT (<1024px)
           ========================================================= 
         */
@media (max-width: 1023px) {
  #lesson-search {
    padding: 0 16px !important; /* Standard spacing for typical phone elements */
  }

  .top-header {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    padding: 0;
  }

  .filter-and-button-group {
    display: flex;
    flex-direction: row; /* Pill + Filter Button */
    flex-wrap: wrap; /* Allows explicit filter button to safely drop underneath Pill if screen is too narrow */
    gap: 10px;
    padding: 15px 0;
    width: 100%;
    justify-content: center;
    position: relative;
  }

  /* Inherits Middle Layout Strip anchors directly to Filter group */
  .filter-and-button-group::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background-color: #fafbfc;
    border-bottom: 1px solid #e0e0e0;
    z-index: -1;
  }

  /* PROTECTING PILL SHAPE ON MOBILE */
  .lesson-filter-wrapper {
    justify-content: center;
    padding: 2px 6px; /* Slightly tighter so it fits easier */
  }
  .lesson-filter-wrapper .lesson-filter {
    padding: 8px 12px; /* Tighter padding for phones */
  }
  .lesson-filter-wrapper .lesson-filter .main-label {
    font-size: 14px; /* Tighter text size for phones */
  }
  .lesson-filter-wrapper .lesson-filter.search-keyword {
    padding-right: 0px;
  }

  .device-types-wrapper {
    padding: 15px 0 10px 0;
  }

  .device-types {
    flex-wrap: wrap; /* Allows wrapping on thin phones */
    justify-content: center !important;
    gap: 12px;
  }
  .device-types .device-type {
    width: calc(33.33% - 12px); /* Scales cleanly across phones 3x3 */
  }

  .lesson-tiles-container {
    grid-template-columns: 1fr; /* Instantly stacks vertically! */
  }

  /* Stops horizontal sliders from overflowing off screen on tight phones */
  .lesson-card {
    flex: 0 0 85vw;
    max-width: 420px;
    min-width: 0;
  }
  .lesson-slider {
    margin: 0;
  }

  .filter-values-row {
    flex-direction: column;
  }

  .lesson-count-container {
    margin-top: 20px;
  }

  .popup-content .lesson-filter .filter-options {
    grid-template-columns: 1fr 1fr;
  }
}

.llh-heart-btn {
  border-radius: 50px;
  width: 28px;
  height: 28px;
  padding: 0 0 0 2px;
}
.llh-save-count {
  padding: 0 !important;
}
.llh-more-btn {
  border: none !important;
  font-size: 26px !important;
  color: green !important;
  font-weight: 800;
}
.video-icon {
  opacity: 1;
  position: absolute;
  z-index: 2;
  bottom: 6px;
  right: 0;
}

.popup-content .switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.popup-content .switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* Slider */
.popup-content .slider {
  position: absolute;
  cursor: pointer;
  background-color: #fff;
  border: 1px solid rgb(199, 199, 204);
  border-radius: 34px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transition: 0.3s;
}

/* Circle */
.popup-content .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: rgb(128, 128, 128);
  border-radius: 50%;
  transition: 0.3s;
}

/* Checked state */
.popup-content .switch input:checked + .slider {
  /* background-color: #4CAF50; */
}

.popup-content .switch input:checked + .slider:before {
  transform: translateX(24px);
}

/* Restored Popup Specific Styles */
.lesson-filter-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.popup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.popup-container {
  position: fixed;
  width: 700px;
  max-width: 90%;
  margin: 80px auto;
  background: #fff;
  border-radius: 12px;
  max-height: 80vh;
  overflow: auto;
  left: 0;
  right: 0;
}

/* ======================================= */
/* NEW LOCAL CSS LOADING SPINNER           */
/* Replaces external gifer.com image       */
/* ======================================= */
.ozo-local-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: rgb(2, 121, 99); /* Ozobot Green */
  animation: ozo-spin 1s ease-in-out infinite;
}
@keyframes ozo-spin {
  to {
    transform: rotate(360deg);
  }
}
