.filter-panel-container {
  position: relative;
  width: 100%;
  height: 70vh;
  left: 0px;
  top: 0px;
  background-color: white;
  margin-top: 20px;
  overflow-x: hidden;
}

.filter-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  z-index: 20;
}

.filters-open {
  overflow: hidden;
}

.filters-open .filter-panel-container {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 30;
  margin-top: 0;
  padding: 0 0 0;
  height: 100vh;
  min-height: -webkit-fill-available;
  box-shadow: 0 14px 50px rgba(15, 23, 42, 0.25);
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.filters-open .filter-panel-backdrop {
  display: block;
}

.filters-open .page-header-right,
.filters-open #grid-view,
.filters-open #card-view,
.filters-open #list-view,
.filters-open .pagination-container,
.filters-open .pagination-mobile-container {
  display: none !important;
}

.filter-panel-container .main-area,
.filter-panel-container .filter-scroll {
  width: 100%;
  height: auto;
  overflow: visible;
}

.filters-open .filter-panel-container .main-area,
.filters-open .filter-panel-container .filter-scroll {
  flex: 1;
  height: auto;
  overflow-y: auto;
  padding: 96px 0 calc(200px + env(safe-area-inset-bottom, 0px)); /* top space for fixed header; bottom for footer */
  scrollbar-gutter: stable;
  min-height: 0;
  overscroll-behavior: contain;
}

.filters-open .filter-panel-container .filter-panel-heading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem 2rem 0.5rem;
  background: #ffffff;
  align-items: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  z-index: 10;
}

.filter-panel-container .filter-panel-heading {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0rem;
  margin-top: 0px;
}

.filter-panel-filters {
  padding: 1rem 2rem;
}

.filter-panel-container .filter-category-name {
  background-color: #f5f7fa;
  padding: 10px 15px;
  border-radius: 2px;
}

.filter-panel-container .filter-category-items {
  padding: 20px 0px;
  display: flex;
  flex-direction: row;
  border-bottom: 1px solid lightgray;
}

.filter-panel-container .filter-category-items span {
  margin-right: 40px;
  padding-left: 15px;
  width: 120px;
  flex-shrink: 0;
  white-space: nowrap;

}

.filter-panel-container .filter-category-items .filter-item {
  padding: 5px;
  background-color: #fafafa;
  border: 1px solid lightgray;
  border-radius: 3px;
  cursor: pointer;
}

/* Hover state */
.filter-panel-container .filter-category-items .filter-item:hover {
  background-color: #cfcfcf;
  border-color: #5f5f5f;
  color: #5f5f5f;
}

/* Selected state */
.filter-panel-container .filter-category-items .filter-item.selected {
  background-color: #010101;
  color: white;
  border-color: #888888;
}

.filter-panel-container .action-buttons {
  display: flex;
  flex-direction: row;
  justify-content: end;
  padding: 1rem 0rem;
  gap: 10px;
  border-top: 1px solid lightgray;
}

.filters-open .filter-panel-container .action-buttons {
  position: fixed;
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom, 0px);
  background: #ffffff;
  padding: 0.6rem 2rem;
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  margin-left: 0;
  margin-right: 0;
  width: auto;
}

@media only screen and (max-width: 1000px) {

  .filter-panel-container .main-area {
    width: 100%;
    height: 60vh;
    overflow-y: scroll;
    margin-top: 0;
    overflow-x: hidden;
  }

  .filter-panel-container .filter-panel-heading {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1rem;
    margin-top: 0;
  }

  .filter-panel-filters {
    padding: 1rem 1rem;
  }

  .filter-panel-container .filter-category-items {
    padding: 20px 0px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-bottom: 1px solid lightgray;
  }

  .filter-panel-container .action-buttons {
    display: flex;
    flex-direction: row;
    justify-content: end;
    padding: 1rem 1rem;
    gap: 10px;
    border-top: 1px solid lightgray;
  }

  .filters-open .filter-panel-container {
    padding: 1rem;
    flex-direction: column;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100vh;
  }

  .filters-open .filter-panel-container .main-area {
    padding-right: 12px;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    min-height: 0;
  }

  .filters-open .filter-panel-container .action-buttons {
    left: 1rem;
    right: 1rem;
    padding: 0.6rem 0;
    padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }

  .filter-panel-container .filter-category-items span {
    width: auto;
    min-width: 140px;
    white-space: nowrap;
  }
}
