.video-library {
  position: relative;
}
.video-library__container {
  position: relative;
  max-width: 87.5rem;
  margin-inline: auto;
  padding: 6.25rem 0 1.5rem;
}
.video-library__filter-wrapper {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  transform: translateY(-50%);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow:
    0 -4px 20px 0 rgba(0, 0, 0, 0.08),
    0 4px 20px 0 rgba(0, 0, 0, 0.08);
  z-index: 5;
}
.video-library__filter-left {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.video-library__filter-group {
  position: relative;
}
.video-library__filter-group:not(:last-child) {
  margin-right: 1rem;
}
.video-library__filter-trigger {
  display: flex;
  width: 22.25rem;
  height: 3.0625rem;
  padding: 0rem 1rem;
  align-items: center;
  justify-content: space-between;
  border-radius: 0.5rem;
  border: 1px solid rgba(22, 22, 22, 0.1);
  background: #fff;
}
.video-library__filter-trigger-content {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-style: normal;
  line-height: 150%;
  font-family: 'Google Sans';
}
.video-library__filter-trigger-label {
  color: rgba(8, 53, 74, 0.7);
  font-weight: 500;
}
.video-library__filter-trigger-value {
  color: #08354a;
  font-weight: 700;
  margin-left: 0.25rem;
}
.video-library__filter-trigger-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
  transition: transform 0.25s ease;
}
.video-library__filter-trigger-icon svg {
  width: 100%;
  height: 100%;
}
.video-library__filter-group--active .video-library__filter-trigger-icon {
  transform: rotate(180deg);
}
.video-library__filter-popup {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  display: flex;
  width: 29.375rem;
  border-radius: 0.5rem;
  border: 0.4px solid rgba(22, 22, 22, 0.2);
  background: #fff;
  transition: all 0.3s ease-out;
  visibility: hidden;
  opacity: 0;
  overflow: hidden;
  z-index: 10;
}
.video-library__filter-group--active .video-library__filter-popup {
  opacity: 1;
  visibility: visible;
}
.video-library__filter-popup__select-group {
  width: 100%;
  max-height: 50vh;
  overflow-y: auto;
}
.video-library__filter-popup__select-item {
  display: flex;
  width: 100%;
  padding: 0.75rem;
  color: #08354a;
  font-family: 'Google Sans';
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  cursor: pointer;
  background: #fff;
  transition: background 0.2s ease;
}
.video-library__filter-popup__select-item:hover {
  background: #f6f6f6;
}
.video-library__filter-popup__select-item--active {
  background: #f6f6f6;
  font-weight: 600;
}
.video-library__filter-right {
  flex-shrink: 0;
}
.video-library__filter-search {
  display: flex;
  width: 22.25rem;
  height: 3.0625rem;
  padding: 0rem 1rem;
  align-items: center;
  border-radius: 0.5rem;
  background: #f6f6f6;
  overflow: hidden;
}
.video-library__filter-search-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-right: 0.5rem;
}
.video-library__filter-search-icon svg {
  width: 100%;
  height: 100%;
}
.video-library__filter-search-input {
  flex: 1 0 0;
  height: 100%;
  color: rgba(8, 53, 74, 1);
  font-family: 'Google Sans';
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  letter-spacing: -0.0175rem;
  border: 0;
  outline: 0;
  background: transparent;
}
.video-library__filter-search-input::placeholder {
  color: rgba(8, 53, 74, 0.4);
}
.video-library__video-list-wrapper {
  position: relative;
}
.video-library__video-list,
.video-library__video-list-loading {
  row-gap: 2.5rem;
  column-gap: 1.5rem;
  grid-template-columns: repeat(3, 1fr);
}
.video-library__video-list {
  display: grid;
}
.video-library__video-item {
  grid-column: span 1 / span 1;
}
.video-library__video-list-loading {
  display: none;
}
.video-library__video-list-loading.video-library__video-list-loading--active {
  display: grid;
}
.video-library__video-pagination {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 3.75rem;
}
.video-library__no-result {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: rgba(8, 53, 74, 0.7);
  font-family: 'Google Sans';
  font-size: 1rem;
  line-height: 150%;
}

/* ============================================================
   STICKY FILTER – DESKTOP (>= 640px)
   Hiển thị khi scroll qua filter-wrapper gốc, ghim cách bottom 1.5rem.
   Khi gần chạm pagination -> chuyển sang static (hiển thị dưới list).
   ============================================================ */
.video-library__filter-wrapper--sticky {
  position: fixed;
  left: 1.5rem;
  right: 1.5rem;
  top: auto;
  bottom: 1.5rem;
  width: auto;
  max-width: 87.5rem;
  margin-inline: auto;
  /* Ẩn ban đầu: đẩy xuống dưới + mờ đi. Chỉ animate theo trục Y để slide từ dưới lên. */
  transform: translateY(calc(100% + 3rem));
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition:
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.video-library__filter-wrapper--sticky.video-library__filter-wrapper--sticky-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.video-library__filter-wrapper--sticky.video-library__filter-wrapper--sticky-static {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  width: 100%;
  max-width: 100%;
  margin: 4.9375rem 0 0;
  transition: opacity 0.3s ease;
}
.video-library__filter-wrapper--sticky .video-library__filter-search {
  background: #f1f9fc;
}
.video-library__filter-wrapper--sticky .video-library__filter-popup {
  bottom: calc(100% + 0.5rem);
  top: auto;
}

.video-library__filter-mobile {
  display: none;
}
.video-library__filter-mobile--sticky {
  display: none;
}

@media screen and (max-width: 639.98px) {
  .video-library {
    position: relative;
  }
  .video-library__container {
    padding: 1.75rem 1rem 3.0625rem;
  }
  .video-library__filter-wrapper,
  .video-library__filter-wrapper--sticky {
    display: none;
  }
  .video-library__video-list-wrapper {
    position: relative;
  }
  .video-library__video-list,
  .video-library__video-list-loading {
    row-gap: 1rem;
    column-gap: 0rem;
    grid-template-columns: repeat(1, 1fr);
  }
  .video-library__video-pagination {
    margin-top: 1.75rem;
  }

  .video-library__filter-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
  }
  .video-library__filter-search {
    flex: 1 0 0;
    width: auto;
    height: 2.5rem;
    padding: 0 0.75rem;
    border-radius: 0.5rem;
    background: #f6f6f6;
  }
  .video-library__filter-search-icon {
    width: 1rem;
    height: 1rem;
  }
  .video-library__filter-search-input {
    font-size: 0.75rem;
    letter-spacing: -0.015rem;
  }
  .video-library__filter-mobile-group {
    position: relative;
    flex-shrink: 0;
    margin-left: 0.5rem;
  }
  .video-library__filter-mobile-group::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.3s ease-out,
      visibility 0.3s ease-out;
  }
  .video-library__filter-mobile-group--active::before {
    opacity: 1;
    visibility: visible;
  }
  .video-library__filter-mobile-trigger {
    display: flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: #f6f6f6;
    border: 0.5px solid rgba(255, 255, 255, 0.16);
  }
  .video-library__filter-mobile-trigger svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  .video-library__filter-mobile-drawer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background: #fff;
    border-radius: 0.75rem 0.75rem 0 0;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
  }
  .video-library__filter-mobile-group--active .video-library__filter-mobile-drawer {
    transform: translateY(0);
  }
  .video-library__filter-mobile-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    border-bottom: 0.0375rem solid rgba(22, 22, 22, 0.2);
  }
  .video-library__filter-mobile-drawer__title {
    color: #1991c7;
    font-family: 'Google Sans';
    font-size: 1.125rem;
    font-style: normal;
    font-weight: 700;
    line-height: 120%;
    letter-spacing: -0.01125rem;
  }
  .video-library__filter-mobile-drawer__button-close {
    display: flex;
    width: 1.875rem;
    height: 1.875rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(17, 17, 100, 0.1);
    backdrop-filter: blur(27.182817459106445px);
    margin-left: 0.5rem;
    flex-shrink: 0;
  }
  .video-library__filter-mobile-drawer__button-close svg {
    width: 0.75rem;
    height: 0.75rem;
  }
  .video-library__filter-mobile-drawer__content {
    width: 100%;
    padding: 0.75rem 1rem;
    max-height: 50vh;
    overflow-y: auto;
  }
  .video-library__filter-mobile-drawer__select-group:not(:last-child) {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 0.03125rem solid rgba(22, 22, 22, 0.2);
  }
  .video-library__filter-mobile-drawer__select-title {
    color: #08354a;
    font-family: 'Google Sans';
    font-size: 1rem;
    font-style: normal;
    font-weight: 500;
    line-height: 160%;
    margin-bottom: 0.5rem;
  }
  .video-library__filter-mobile-drawer__select-item {
    position: relative;
    padding: 0.75rem;
    background: #fff;
    display: flex;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .video-library__filter-mobile-drawer__select-item:active,
  .video-library__filter-mobile-drawer__select-item--active {
    background: #fff;
  }
  .video-library__filter-mobile-drawer__select-item-radio {
    position: relative;
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    margin-right: 0.625rem;
    border: 1px solid rgb(25, 145, 199, 0.56);
  }
  .video-library__filter-mobile-drawer__select-item-radio::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: rgb(25, 145, 199, 0.56);
    display: none;
  }
  .video-library__filter-mobile-drawer__select-item--active
    .video-library__filter-mobile-drawer__select-item-radio::before {
    display: block;
  }
  .video-library__filter-mobile-drawer__select-text {
    color: #08354a;
    font-family: 'Google Sans';
    font-size: 0.875rem;
    font-style: normal;
    font-weight: 400;
    line-height: 150%;
  }
  .video-library__filter-mobile-drawer__footer {
    padding: 1rem;
    border-top: 0.0375rem solid rgba(22, 22, 22, 0.2);
  }
  .video-library__filter-mobile-drawer__button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    border-radius: 6.25rem;
    border: 1.2px solid #f6f6f6;
    background: #1991c7;
    box-shadow:
      0 0 0 1px #a3e2ff,
      0 0 4px 0 rgba(0, 0, 0, 0.12),
      0 1px 8px 0 rgba(0, 0, 0, 0.1);
  }
  .video-library__filter-mobile-drawer__button-text {
    color: #fff;
    font-family: 'Google Sans';
    font-size: 0.875rem;
    font-style: normal;
    font-weight: 500;
    line-height: 150%;
    text-box-edge: cap alphabetic;
    text-box-trim: trim-both;
    margin-right: 0.5rem;
  }
  .video-library__filter-mobile-drawer__button-icon {
    width: 1rem;
    height: 1rem;
  }
  .video-library__filter-mobile-drawer__button-icon svg {
    width: 100%;
    height: 100%;
  }

  /* ============================================================
     STICKY FILTER – MOBILE (< 640px)
     Hiển thị khi scroll qua filter gốc, ghim cách bottom 3.0625rem.
     ============================================================ */
  .video-library__filter-mobile--sticky {
    position: fixed;
    bottom: 3.0625rem;
    left: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 0;
    box-shadow:
      0 4px 16px rgba(0, 0, 0, 0.12),
      0 1px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(calc(100% + 4rem));
    pointer-events: none;
    opacity: 0;
    transition:
      transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .video-library__filter-mobile--sticky.video-library__filter-mobile--sticky-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .video-library__filter-mobile--sticky.video-library__filter-mobile--sticky-static {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    transform: none;
    pointer-events: auto;
    opacity: 1;
    margin-top: 1.9375rem;
    transition: opacity 0.3s ease;
  }
  .video-library__filter-mobile--sticky .video-library__filter-search {
    flex: 1 0 0;
    height: 2.5rem;
    margin-right: 0.5rem;
    background: #f6f6f6;
    border-radius: 0.5rem;
    padding: 0 0.75rem;
  }
  .video-library__filter-mobile-sticky-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    border: 0.5px solid rgba(255, 255, 255, 0.16);
    background: #f6f6f6;
  }
  .video-library__filter-mobile-sticky-trigger svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}
