/* Catalog Page Specific Styles */

.main {
  padding-top: 4rem;
}

.page-header {
  padding: 2rem 0;
}

.page-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .page-title {
    font-size: 3rem;
  }
}

.page-subtitle {
  color: var(--muted-foreground);
  margin-top: 0.5rem;
}

.content-layout {
  display: flex;
  gap: 2rem;
  padding-bottom: 4rem;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 18rem;
  flex-shrink: 0;
  display: none;
}

.sidebar-inner {
  padding-right: 1rem;
}

@media (min-width: 768px) {
  .sidebar {
    display: block;
  }
}


.sidebar-title {
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.filter-section {
  margin-bottom: 1.5rem;
}

.filter-label {
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.filter-label .unit-sup {
  font-size: 0.65em;
  line-height: 0;
}

.range-inputs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.range-inputs input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--background);
}

.range-inputs input:focus {
  outline: none;
  border-color: var(--primary);
}

.range-inputs span {
  color: var(--muted-foreground);
}

/* Badge Filters */
.badge-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.badge-filter:hover {
  color: var(--foreground);
  border-color: var(--foreground);
}

.badge-filter.active {
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
}

.filter-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
}

.badge-emoji {
  font-size: 1rem;
  line-height: 1;
}

/* Card Badges (overlaid on image) */
.car-badges-row {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.375rem;
  z-index: 1;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 9999px;
  border: none;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.card-badge.badge-green {
  color: #fff;
  background: rgba(5, 150, 105, 0.8);
}

.card-badge.badge-amber {
  color: #fff;
  background: rgba(217, 119, 6, 0.8);
}

.card-badge.badge-blue {
  color: #fff;
  background: rgba(37, 99, 235, 0.8);
}

.card-badge.badge-purple {
  color: #fff;
  background: rgba(124, 58, 237, 0.8);
}

.checkbox-group {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.checkbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 0.5rem 0;
}

.checkbox-header h3 {
  font-weight: 500;
}

.checkbox-count {
  font-size: 0.75rem;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.checkbox-list {
  margin-top: 0.5rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  margin: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.checkbox-item:hover {
  background: var(--muted);
}

.checkbox-item input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.checkbox-item span {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Main content */
.main-content {
  flex: 1;
  min-width: 0;
}

/* Override common.css .car-grid breakpoints when sidebar is present */
.main-content .car-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .main-content .car-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .main-content .car-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.no-results {
  text-align: center;
  padding: 4rem 0;
}

.no-results p {
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}

/* Mobile filters */
.mobile-filter-btn {
  display: flex;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .mobile-filter-btn {
    display: none;
  }
}

.mobile-filters-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.mobile-filters-overlay.open {
  display: block;
}

.mobile-filters-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.mobile-filters-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20rem;
  background: var(--background);
  padding: 1.5rem;
  overflow-y: auto;
  border-left: 1px solid var(--border);
}

.mobile-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.mobile-filters-header h2 {
  font-weight: 500;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted-foreground);
}

/* Pagination */
.paging {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  padding: 3rem 0;
}

.paging-info {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* SEO pagination: visible to crawlers, hidden from JS users */
.js-infinite-scroll .paging-seo {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Infinite scroll */
#infinite-scroll-sentinel {
  height: 1px;
}

.infinite-scroll-loader {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.infinite-scroll-loader .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--foreground);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.infinite-scroll-end {
  text-align: center;
  padding: 2rem 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Scroll to top button */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  transform: translateY(12px);
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: var(--muted);
}

.catalog-progress-counter {
  position: fixed;
  right: calc(2rem + 44px + 0.5rem);
  bottom: 2.2rem;
  transform: translateY(12px);
  width: 156px;
  height: 32px;
  overflow: hidden;
  z-index: 90;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--background);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.catalog-progress-counter-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0;
  background: rgba(16, 185, 129, 0.28);
  transition: width 0.25s ease;
}

.catalog-progress-counter-label {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  text-align: center;
  line-height: 30px;
  font-size: 0.8125rem;
  color: var(--foreground);
  white-space: nowrap;
}

.catalog-progress-counter.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .scroll-top-btn {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
  }

  .catalog-progress-counter {
    right: calc(1.25rem + 40px + 0.5rem);
    bottom: 1.25rem;
    width: 140px;
    height: 30px;
  }

  .catalog-progress-counter-label {
    line-height: 28px;
    font-size: 0.75rem;
  }
}
