/* ==========================================================================
   genxbuy.com - Products Listing Page Styles
   Strict adherence to brand colors: #000000, #FFFFFF, #3CACF0, #DC2626
   Mobile-First, Responsive Grid, Smooth Infinite Scroll, Clean UI
   ========================================================================== */

@import url('theme.css');

/* Page Background */
body.products-page {
  background-color: #F8FAFC;
}

/* 1. Page Hero / Header Banner */
.products-hero-section {
  background: #FFFFFF;
  border-bottom: 1px solid #EEF2F6;
  padding: 24px 0 20px;
}

.products-hero-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.products-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #64748B;
}

.products-breadcrumb a {
  color: #64748B;
  text-decoration: none;
  transition: color 0.15s ease;
}

.products-breadcrumb a:hover {
  color: #3CACF0;
}

.products-breadcrumb .breadcrumb-separator {
  color: #CBD5E1;
  font-size: 11px;
}

.products-breadcrumb .breadcrumb-current {
  color: #0F172A;
  font-weight: 600;
}

.products-hero-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.products-page-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 28px;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.cat-header-thumb {
  width: 42px;
  height: 42px;
  min-width: 42px;
  object-fit: contain;
  background: transparent;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
}

.products-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  background: #F1F5F9;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #E2E8F0;
}

.products-count-badge .count-highlight {
  color: #3CACF0;
  font-weight: 800;
}

/* 2. Filter & Controls Bar */
.products-controls-bar {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
  position: sticky;
  top: 60px;
  /* Offset below sticky nav bar */
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.products-controls-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
}

/* Controls Layout */
.controls-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.controls-filters-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.filter-select-box {
  min-width: 190px;
  max-width: 250px;
  flex: 1;
}

.controls-sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #64748B;
  white-space: nowrap;
}

/* Search Box */
.catalog-search-wrap {
  position: relative;
  width: 220px;
  flex-shrink: 0;
}

.catalog-search-input {
  width: 100%;
  height: 36px;
  padding: 6px 10px 6px 32px;
  font-size: 12.5px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #F8FAFC;
  color: #0F172A;
  outline: none;
  transition: all 0.2s ease;
}

.catalog-search-input:focus {
  background: #FFFFFF;
  border-color: #3CACF0;
  box-shadow: 0 0 0 3px rgba(60, 172, 240, 0.15);
}

.catalog-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.catalog-search-icon svg {
  width: 14px;
  height: 14px;
}

/* Native Sort Select */
.catalog-select {
  height: 36px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: #334155;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.catalog-select:focus {
  border-color: #3CACF0;
  box-shadow: 0 0 0 3px rgba(60, 172, 240, 0.15);
}

/* Custom Select2 Theme Integration (#3CACF0 Palette) */
.select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single {
  height: 36px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background-color: #F8FAFC;
  display: flex;
  align-items: center;
  padding: 0 10px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.select2-container--default .select2-selection--single:hover {
  border-color: #CBD5E1;
  background-color: #FFFFFF;
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #3CACF0;
  background-color: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(60, 172, 240, 0.16);
  outline: none;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #0F172A;
  font-size: 13px;
  font-weight: 600;
  line-height: 34px;
  padding-left: 0;
  padding-right: 20px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #94A3B8;
  font-weight: 500;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 34px;
  right: 8px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #64748B transparent transparent transparent;
  border-width: 5px 4px 0 4px;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent #3CACF0 transparent;
  border-width: 0 4px 5px 4px;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
  color: #94A3B8;
  font-size: 16px;
  margin-right: 18px;
  line-height: 34px;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
  color: #DC2626;
}

/* Select2 Dropdown Popup */
.select2-dropdown {
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  background: #FFFFFF;
  overflow: hidden;
  margin-top: 4px;
  z-index: 1050;
}

.select2-container--default .select2-search--dropdown {
  padding: 8px;
  border-bottom: 1px solid #F1F5F9;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  outline: none;
  background: #F8FAFC;
  transition: all 0.2s ease;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: #3CACF0;
  background: #FFFFFF;
  box-shadow: 0 0 0 2px rgba(60, 172, 240, 0.15);
}

.select2-results__options {
  max-height: 240px;
  padding: 4px 0;
}

.select2-container--default .select2-results__option {
  font-size: 13px;
  padding: 8px 14px;
  color: #334155;
  transition: all 0.15s ease;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #3CACF0 !important;
  color: #FFFFFF !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: #EBF5FB;
  color: #0369A1;
  font-weight: 700;
}

/* Active Filter Tags Row */
.active-filters-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed #E2E8F0;
  margin-top: 10px;
}

.active-filter-label {
  font-size: 11.5px;
  color: #64748B;
  font-weight: 600;
}

.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: #0F172A;
  background: #EBF7E3;
  border: 1px solid #CDEAB6;
  padding: 3px 8px;
  border-radius: 6px;
  text-decoration: none;
}

.active-tag-remove {
  color: #558B2F;
  font-size: 14px;
  line-height: 1;
  font-weight: bold;
}

.btn-clear-all-filters {
  font-size: 11.5px;
  font-weight: 600;
  color: #DC2626;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 6px;
}

/* 3. Main Catalog Content Area */
.products-catalog-section {
  width: 100%;
  padding: 32px 0 60px;
}

.products-catalog-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Products Grid */
.products-infinite-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* Product Card Styling (Identical to Homepage Showcase for consistency) */
.product-card {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: #3CACF0;
  box-shadow: 0 14px 28px -6px rgba(0, 0, 0, 0.09), 0 4px 10px -2px rgba(0, 0, 0, 0.03);
}

.product-card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #F8FAFC;
  overflow: hidden;
  border-bottom: 1px solid #F1F5F9;
}

.product-card-img-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

.product-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .product-card-img {
  transform: scale(1.05);
}

.product-card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #CBD5E1;
}

.product-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 2;
  pointer-events: none;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  line-height: 1.2;
}

.badge-discount {
  background: #DC2626;
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.badge-featured {
  background: #F59E0B;
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.product-card-condition-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.75);
  color: #FFFFFF;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 2px 7px;
  border-radius: 6px;
  z-index: 2;
}

.product-card-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.product-card-brand {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748B;
  letter-spacing: 0.6px;
}

.product-card-stock-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #059669;
}

.stock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
}

.product-card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: #0F172A;
  margin: 0 0 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.product-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.product-card-title a:hover {
  color: #3CACF0;
}

.product-spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.spec-chip {
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  background: #F1F5F9;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.product-card-price-wrap {
  margin-top: auto;
  margin-bottom: 10px;
}

.price-main-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.price-current {
  font-size: 17px;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.3px;
}

.price-regular {
  font-size: 13px;
  color: #94A3B8;
  text-decoration: line-through;
  font-weight: 500;
}

.price-saved-tag {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #15803D;
  margin-top: 2px;
}

.product-warranty-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: #64748B;
  margin-bottom: 12px;
}

.product-warranty-line svg {
  color: #3CACF0;
  flex-shrink: 0;
}

.product-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.btn-card-view {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #0F172A;
  color: #FFFFFF;
  border: 1px solid #0F172A;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  height: 34px;
}

.btn-card-view:hover {
  background: #3CACF0;
  border-color: #3CACF0;
  color: #000000;
}

.btn-card-wa {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EBF7E3;
  color: #25D366;
  border: 1px solid #D6F0C5;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-card-wa:hover {
  background: #25D366;
  color: #FFFFFF;
  border-color: #25D366;
}

/* 4. Infinite Scroll Sentinel, Loader & End States */
.infinite-scroll-sentinel {
  height: 20px;
  width: 100%;
  pointer-events: none;
}

.infinite-scroll-loader {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 0;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
}

.infinite-scroll-loader.is-visible {
  display: flex;
}

.loader-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #E2E8F0;
  border-top-color: #3CACF0;
  border-radius: 50%;
  animation: spinLoader 0.75s linear infinite;
}

@keyframes spinLoader {
  to {
    transform: rotate(360deg);
  }
}

.infinite-scroll-retry {
  display: none;
  text-align: center;
  padding: 24px 20px;
}

.retry-msg {
  font-size: 13px;
  color: #EF4444;
  margin-bottom: 10px;
  font-weight: 500;
}

.btn-infinite-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0F172A;
  color: #FFFFFF;
  border: 1px solid #0F172A;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-infinite-retry:hover {
  background: #3CACF0;
  color: #000000;
  border-color: #3CACF0;
}

.infinite-scroll-end {
  display: none;
  text-align: center;
  padding: 36px 20px;
  color: #64748B;
  font-size: 14px;
  font-weight: 500;
}

.infinite-scroll-end.is-visible {
  display: block;
}

.infinite-scroll-end-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  padding: 10px 20px;
  border-radius: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.infinite-scroll-end-box svg {
  color: #3CACF0;
}

/* Empty State (When no products match filters) */
.products-empty-state {
  display: none;
  text-align: center;
  padding: 60px 20px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  max-width: 500px;
  margin: 0 auto;
}

.products-empty-state.is-visible {
  display: block;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: #F1F5F9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 8px 0;
}

.empty-state-desc {
  font-size: 13.5px;
  color: #64748B;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0F172A;
  color: #FFFFFF;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease;
}

.btn-reset-filters:hover {
  background: #3CACF0;
  color: #000000;
}

/* 5. Responsive Breakpoints */
@media (max-width: 1200px) {
  .products-infinite-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (max-width: 900px) {
  .controls-main-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .controls-actions-row {
    justify-content: space-between;
    width: 100%;
  }

  .catalog-search-wrap {
    flex: 1;
    min-width: 160px;
  }
}

@media (max-width: 800px) {
  .products-infinite-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .products-hero-section {
    padding: 16px 0 14px;
  }

  .products-hero-container {
    padding: 0 14px;
  }

  .products-page-title {
    font-size: 22px;
  }

  .products-controls-bar {
    top: 50px;
  }

  .products-controls-container {
    padding: 10px 14px;
  }

  .products-catalog-section {
    padding: 18px 0 40px;
  }

  .products-catalog-container {
    padding: 0 12px;
  }

  .products-infinite-grid {
    gap: 10px;
  }

  .product-card {
    border-radius: 10px;
  }

  .product-card-body {
    padding: 10px 10px 12px;
  }

  .product-card-title {
    font-size: 13px;
    min-height: 34px;
    margin-bottom: 6px;
  }

  .price-current {
    font-size: 15px;
  }

  .price-regular {
    font-size: 11.5px;
  }

  .spec-chip {
    font-size: 10px;
    padding: 1px 5px;
  }

  .product-warranty-line {
    display: none;
  }

  .btn-card-view {
    font-size: 11.5px;
    height: 30px;
    padding: 4px 8px;
  }

  .btn-card-wa {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }
}