html {
  scrollbar-gutter: stable;
}

#catalogTabs {
  list-style-type: none !important;
}

#filters {
  width: 260px;
  min-width: 240px;
  flex-shrink: 0;
}

#necs-catalog {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 1rem;
  width: 100%;
  padding-right: .3rem;
}

#ShowFiltersSmall {
  display: none;
}

#necs-main {
  display: flex;
  flex-direction: row;
}

/* override if theme restricts width */
#necs-catalog-full-width {
  width: 95vw !important;
  max-width: 95vw !important;
  margin-left: calc(-0.5 * (95vw - 100%));
  margin-right: calc(-0.5 * (95vw - 100%));
  box-sizing: border-box;
}

#necs-no-results {
    display: none;
  }

.necs-catalog-layout {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
}

.label-over-border {
  position: relative;
  display: block;
}

.label-over-border label {
  position: absolute;
  top: -1rem;
  left: 0.75rem;
  padding: 0 !important;
  background: var(--bs-body-bg, #fff);
  pointer-events: none;
  height: 18px !important;
  font-size: 0.8rem !important;
}

.card-img-top {
  height: 220px;
  object-fit: contain;
  padding: 10px;
}

.vertical-btn {
  height: 550px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.necs-catalog-card {
  flex: 1 1 calc(25% - 1rem);
  min-width: 220px;
  max-width: 280px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.necs-catalog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.necs-catalog-brand-img,
.necs-catalog-class-img {
  max-height: 130px;
  object-fit: contain;
}

.necs-catalog-item-img-container {
  min-height: 120px;
}

.necs-catalog-item-img {
  max-height: 140px;
  object-fit: contain;
}

.necs-table-img {
  max-height: 40px;
  object-fit: contain;
}

/* --- RESPONSIVE STYLES --- */
@media (max-width: 1200px) {
  #ShowFiltersSmall {
    display: none;
  }

  #necs-main {
    display: flex;
    flex-direction: row;
  }

  .necs-catalog-card {
    flex: 1 1 calc(33.333% - 1rem);
  }
}

@media (max-width: 992px) {
  #filters {
    width: 100% !important;
    min-width: 100% !important;
  }

  #showFilters {
    display: none;
  }

  #ShowFiltersSmall {
    display: block;
  }

  #necs-catalog {
    order: 2;
    width: 100%;
    flex: 1 1 100%;
    justify-content: center;
  }

  #necs-main {
    display: flex;
    flex-direction: column;
  }

  .necs-catalog-layout {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
  }

  .necs-catalog-card {
    flex: 1 1 calc(50% - 1rem);
  }

  .label-over-border label {
    font-size: 0.75rem !important;
  }

  .nav-tabs .nav-link {
    font-size: 1rem !important;
  }
}

@media (max-width: 576px) {

  #showFilters {
    display: none;
  }

  #ShowFiltersSmall {
    display: block;
  }

  #necs-main {
    display: flex;
    flex-direction: column;
  }

  .necs-catalog-card {
    flex: 1 1 100%;
  }

  .label-over-border label {
    font-size: 0.7rem !important;
  }

}

#mobileTabDropdown {
  order: -1;
  margin: 0.5rem;
}

@media (max-width: 767.98px) {
  nav .d-flex.justify-content-between {
    flex-direction: column;
    align-items: stretch !important;
  }
  
  #mobileTabDropdown {
    width: 100%;
    margin: 0 0 0.5rem 0;
  }
  
  #mobileTabDropdown .dropdown-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  #mobileTabDropdown .dropdown-toggle::after {
    margin-left: auto;
  }
  
  nav .d-flex.align-items-center.flex-wrap.gap-3 {
    order: 1;
    justify-content: space-between;
    width: 100%;
  }
}

#necs-catalog .table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#necs-catalog .table-responsive table {
  min-width: 700px;
}

@media (max-width: 768px) {
  #necs-catalog .table-responsive {
    margin: 0 -12px;
    padding: 0 12px;
    width: calc(100% + 24px);
  }
}
/* --- END RESPONSIVE STYLES --- */

/* --- STICKY HEADER --- */

/* When sticky is DISABLED - explicitly override any theme sticky styles */
.necs-catalog-wrapper:not(.necs-sticky-enabled) > nav {
  position: static !important;
  top: auto !important;
}

.necs-catalog-wrapper:not(.necs-sticky-enabled) #filters > div,
.necs-catalog-wrapper:not(.necs-sticky-enabled) #showFilters,
.necs-catalog-wrapper:not(.necs-sticky-enabled) .table-responsive thead th {
  position: static !important;
  top: auto !important;
}

@media (min-width: 992px) {
  .necs-sticky-enabled > nav {
    position: -webkit-sticky;
    position: sticky;
    top: 32px; 
    z-index: 100;
    background-color: #fff;
  }

  body:not(.admin-bar) .necs-sticky-enabled > nav {
    top: 0;
  }

  .necs-sticky-enabled #filters > div {
    position: -webkit-sticky;
    position: sticky;
    top: 130px; 
  }

  body:not(.admin-bar) .necs-sticky-enabled #filters > div {
    top: 80px; 
  }

  .necs-sticky-enabled #showFilters {
    position: -webkit-sticky;
    position: sticky;
    top: 130px;
    align-self: flex-start;
  }

  body:not(.admin-bar) .necs-sticky-enabled #showFilters {
    top: 80px;
  }

  .necs-sticky-enabled .table-responsive {
    overflow-x: visible !important;
    overflow-y: visible !important;
  }

  .necs-sticky-enabled #necs-catalog {
    overflow: visible !important;
  }

  .necs-sticky-enabled #necs-main > main {
    overflow: visible !important;
  }

  .necs-sticky-enabled .table-responsive thead th {
    position: -webkit-sticky;
    position: sticky;
    top: 113px;
    background-color: #f8f9fa !important;
  }

  body:not(.admin-bar) .necs-sticky-enabled .table-responsive thead th {
    top: 68px;
  }
}

/* --- END STICKY HEADER --- */
/* Ensure modal displays above backdrop when theme has older Bootstrap */
#itemDetailsModal {
  z-index: 1060 !important;
}

#itemDetailsModal .modal-dialog {
  z-index: 1061 !important;
  pointer-events: auto;
}

#itemDetailsModal .modal-content {
  z-index: 1062 !important;
  pointer-events: auto;
}

.modal-backdrop {
  z-index: 1055 !important;
}

#itemDetailsModal.show {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#itemDetailsModal.show .modal-dialog {
  transform: none !important;
  opacity: 1 !important;
}
/* --- END MODAL FIX --- */

