/* LISTINGS PAGE */
.listings-page { padding: 32px 0 64px; }
.filter-bar {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 16px 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.filter-bar + .near-me-bar { margin-bottom: 16px; }
.filter-bar + .near-me-bar + .near-me-denied { margin-bottom: 16px; }
.listings-page .near-me-denied { margin-top: 0; margin-bottom: 16px; }
.filter-bar__search { flex: 1; min-width: 200px; position: relative; }
.filter-bar__search input { width:100%; padding: 9px 14px 9px 38px; border: 1.5px solid var(--gray-200); border-radius: var(--r-md); font-size:14px; outline:none; transition: all var(--t-fast); background: var(--surface); }
.filter-bar__search input:focus { border-color: var(--primary); background: var(--white); }
.filter-bar__search-icon { position:absolute; left:11px; top:50%; transform:translateY(-50%); color:var(--gray-400); width:16px; height:16px; pointer-events:none; }
.filter-select { padding: 9px 32px 9px 14px; border: 1.5px solid var(--gray-200); border-radius: var(--r-md); font-size:14px; font-family:var(--font-body); color:var(--dark-2); outline:none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%239CA3AF' d='M5 7L0 2h10z'/%3E%3C/svg%3E") no-repeat right 10px center; appearance:none; cursor:pointer; transition:border-color var(--t-fast); }
.filter-select:focus { border-color:var(--primary); }

.results-meta { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; flex-wrap:wrap; gap:12px; }
.results-meta__count { font-size:14px; color:var(--gray-500); }
.results-meta__count strong { color:var(--dark-2); font-weight:600; }
.active-filters { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.active-filter { display:flex; align-items:center; gap:6px; padding:4px 10px 4px 12px; background:var(--primary-50); color:var(--primary-dark); border-radius:var(--r-full); font-size:12px; font-weight:600; border:1px solid var(--primary-100); }
.active-filter button { display:flex; align-items:center; color:var(--primary-dark); opacity:0.6; cursor:pointer; }
.active-filter button:hover { opacity:1; }

.listings-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:20px; }
.pagination { display:flex; align-items:center; justify-content:center; gap:4px; margin-top:48px; }
.page-btn { width:38px; height:38px; border-radius:var(--r-md); display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:500; color:var(--gray-600); border:1.5px solid var(--border); cursor:pointer; transition:all var(--t-fast); }
.page-btn:hover { border-color:var(--primary); color:var(--primary); }
.page-btn.active { background:var(--primary); border-color:var(--primary); color:var(--white); font-weight:600; }
.page-btn:disabled { opacity:0.4; cursor:not-allowed; }
.page-ellipsis { width:38px; height:38px; display:flex; align-items:center; justify-content:center; color:var(--gray-400); }

.category-pills { display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; margin-bottom:24px; }
.category-pills::-webkit-scrollbar { height:3px; }
.cat-pill { padding:7px 16px; border-radius:var(--r-full); font-size:13px; font-weight:500; border:1.5px solid var(--border); color:var(--gray-600); cursor:pointer; white-space:nowrap; transition:all var(--t-fast); background:var(--white); display:inline-flex; align-items:center; gap:6px; }
.cat-pill svg { width:14px; height:14px; flex-shrink:0; }
.cat-pill:hover { border-color:var(--primary); color:var(--primary); }
.cat-pill.active { background:var(--primary); border-color:var(--primary); color:var(--white); font-weight:600; }

/* SUB-CATEGORY CHIPS — page-specific spacing */
.listings-page .subcategory-chips { margin-bottom: 16px; }

/* FILTER PANEL OVERLAY */
.filter-overlay {
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.filter-overlay.open { opacity: 1; visibility: visible; }

/* FILTER PANEL — sidebar on desktop */
.filter-panel {
  position: fixed; top: 0; right: 0; z-index: 200;
  width: 380px; max-width: 90vw; height: 100vh;
  background: var(--white); box-shadow: -8px 0 32px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.filter-panel.open { transform: translateX(0); }

.filter-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.filter-panel__title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--dark-2); margin: 0;
}
.filter-panel__close {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-md);
  color: var(--gray-500); cursor: pointer;
  transition: all var(--t-fast);
}
.filter-panel__close:hover { background: var(--surface); color: var(--dark-2); }

.filter-panel__body {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 24px;
}
.filter-panel__body::-webkit-scrollbar { width: 4px; }
.filter-panel__body::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }

.filter-panel__footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.filter-panel__footer .btn { flex: 1; justify-content: center; }

/* Filter Group inside panel */
.filter-group { display: flex; flex-direction: column; gap: 10px; }
.filter-group__label {
  font-size: 13px; font-weight: 600; color: var(--dark-2);
  letter-spacing: 0.01em; display: flex; align-items: center; gap: 6px;
}
.filter-group__label svg { width: 14px; height: 14px; color: var(--gray-400); }

.filter-group__row { display: flex; gap: 10px; }
.filter-group__row input,
.filter-group__row select {
  flex: 1; padding: 9px 14px; border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md); font-size: 14px; font-family: var(--font-body);
  color: var(--dark-2); outline: none; background: var(--surface);
  transition: border-color var(--t-fast);
}
.filter-group__row input:focus,
.filter-group__row select:focus { border-color: var(--primary); background: var(--white); }

.filter-group select {
  width: 100%; padding: 9px 32px 9px 14px; border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md); font-size: 14px; font-family: var(--font-body);
  color: var(--dark-2); outline: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%239CA3AF' d='M5 7L0 2h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none; cursor: pointer; transition: border-color var(--t-fast);
}
.filter-group select:focus { border-color: var(--primary); }

/* Checkbox / Radio option group */
.filter-options { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-option {
  padding: 7px 14px; border-radius: var(--r-full); font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--gray-200); color: var(--gray-600); cursor: pointer;
  white-space: nowrap; transition: all var(--t-fast); background: var(--white);
  user-select: none;
}
.filter-option:hover { border-color: var(--primary); color: var(--primary); }
.filter-option.active { background: var(--primary-50); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }

/* Active filter count badge on filter button */
#filterPanelBtn { position: relative; }
.filter-badge {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); color: var(--white);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* VIEW TOGGLE */
.view-toggle {
  display: flex; border: 1.5px solid var(--gray-200); border-radius: var(--r-md);
  overflow: hidden; flex-shrink: 0;
}
.view-toggle__btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; background: var(--white); border: none;
  color: var(--gray-400); cursor: pointer; transition: all var(--t-fast);
}
.view-toggle__btn:not(:last-child) { border-right: 1.5px solid var(--gray-200); }
.view-toggle__btn:hover { color: var(--gray-600); background: var(--gray-50); }
.view-toggle__btn.active { background: var(--primary); color: var(--white); box-shadow: inset 0 1px 3px rgba(0,0,0,0.15); }
.view-toggle__btn svg { width: 16px; height: 16px; pointer-events: none; }

/* LIST VIEW GRID */
.listings-grid.list-view { grid-template-columns: 1fr; gap: 0; }

/* LIST VIEW CARD */
.listing-card-list {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; background: var(--white);
  border: 1px solid var(--border); border-bottom: none;
  cursor: pointer; transition: background var(--t-fast);
}
.listing-card-list:first-child { border-radius: var(--r-xl) var(--r-xl) 0 0; }
.listing-card-list:last-child { border-bottom: 1px solid var(--border); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.listing-card-list:only-child { border-radius: var(--r-xl); border-bottom: 1px solid var(--border); }
.listing-card-list:hover { background: var(--gray-50); }
.listing-card-list__icon {
  width: 40px; height: 40px; border-radius: var(--r-md); flex-shrink: 0;
  background: var(--primary-50); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.listing-card-list__icon svg { width: 20px; height: 20px; }
.listing-card-list__body { flex: 1; min-width: 0; }
.listing-card-list__title {
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  color: var(--dark-2); line-height: 1.3; margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.listing-card-list__desc {
  font-size: 13px; color: var(--gray-500); line-height: 1.4; margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.listing-card-list__meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.listing-card-list__cat {
  font-size: 12px; font-weight: 600; color: var(--primary);
}
.listing-card-list__loc {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--gray-500);
}
.listing-card-list__loc svg { width: 12px; height: 12px; flex-shrink: 0; color: var(--gray-400); }
.listing-card-list__budget {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--success);
}
.listing-card-list__budget svg { width: 12px; height: 12px; flex-shrink: 0; }
.listing-card-list__time { font-size: 12px; color: var(--gray-400); }
.listing-card-list .listing-card__fav { flex-shrink: 0; }

/* LOAD MORE BUTTON */
.load-more-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 32px; font-size: 14px; font-weight: 600;
  border-radius: var(--r-full); cursor: pointer;
  transition: all var(--t-fast);
}
.load-more-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.load-more-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.load-more-btn svg { flex-shrink: 0; }
.load-more-info { font-weight: 400; opacity: 0.7; font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin-icon { animation: spin 0.8s linear infinite; }

/* SKELETON LOADING CARDS (infinite scroll) */
.skeleton-card { pointer-events: none; }
.skeleton-card .skeleton { display: block; }
.skeleton-card.listing-card { padding: 20px; }
.skeleton-card.listing-card-list { padding: 16px 20px; }

/* CARD ENTER ANIMATION (infinite scroll fade-in) */
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-enter { animation: cardEnter .3s ease-out both; }

/* RESPONSIVE */
@media(max-width:1024px){ .listings-grid { grid-template-columns:repeat(3,1fr); } .listings-grid.list-view { grid-template-columns:1fr; } }
@media(max-width:768px){
  .listings-grid { grid-template-columns:repeat(2,1fr); gap: 16px; }

  /* Category pills — premium horizontal scroll */
  .category-pills {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    gap: 7px; margin-bottom: 20px;
  }
  .category-pills::-webkit-scrollbar { display: none; }
  .cat-pill { scroll-snap-align: start; padding: 8px 14px; }

  /* Subcategory chips — horizontal scroll */
  .listings-page .subcategory-chips {
    overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 14px;
  }
  .listings-page .subcategory-chips::-webkit-scrollbar { display: none; }

  /* Results meta — clear hierarchy */
  .results-meta {
    flex-direction: row; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
  }

  /* View toggle — mobile visible */
  .view-toggle {
    display: flex !important;
    border-radius: var(--r-md);
  }
  .view-toggle__btn { width: 36px; height: 36px; }
  .view-toggle__btn svg { width: 18px; height: 18px; }

  /* Filter bar — touch-friendly */
  .filter-bar { border-radius: var(--r-lg); padding: 14px 16px; }
  .filter-bar__search input { min-height: 44px; font-size: 15px; }
  .filter-select { min-height: 44px; font-size: 15px; }
  .near-me-toggle { min-height: 44px; padding: 10px 16px; }

  /* List view — multi-line titles on mobile */
  .listing-card-list__title {
    white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
  }
  .listing-card-list__desc {
    white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
  }

  /* Load more — mobile: full-width above bottom nav */
  .pagination { margin-top: 32px; padding-bottom: 16px; }
  .load-more-btn {
    width: 100%; justify-content: center;
    padding: 14px 20px; font-size: 15px;
  }

  /* Bottom-sheet mode */
  .filter-panel {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; max-width: 100%; height: auto; max-height: 85vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  }
  .filter-panel.open { transform: translateY(0); }
  .filter-panel__header { padding: 16px 20px; }
  .filter-panel__header::before {
    content: ''; position: absolute; top: 8px; left: 50%;
    transform: translateX(-50%); width: 36px; height: 4px;
    background: var(--gray-200); border-radius: 2px;
  }
  .filter-panel__body { padding: 20px; max-height: 60vh; }
  .filter-panel__footer { padding: 14px 20px; }
  .filter-panel__footer .btn { min-height: 44px; }

  /* Filter options in panel — bigger touch targets */
  .filter-option { padding: 9px 16px; font-size: 14px; }
}
@media(max-width:640px){ .filter-bar { flex-direction:column; } .filter-bar__search { width:100%; min-width:0; } .filter-select { width:100%; } }
@media(max-width:480px){
  .listings-page { padding: 20px 0 40px; }
  .listings-grid { grid-template-columns: 1fr; gap: 14px; }
  .listings-grid.list-view { gap: 0; }

  /* Category pills compact */
  .category-pills { gap: 6px; margin-bottom: 16px; }
  .cat-pill { padding: 7px 12px; font-size: 12px; }

  /* Filter bar compact */
  .filter-bar { padding: 12px 14px; gap: 10px; }

  /* Pagination / load more */
  .pagination { margin-top: 28px; padding-bottom: 20px; }
  .page-btn { width: 34px; height: 34px; font-size: 13px; }
  .load-more-btn { padding: 14px 16px; font-size: 14px; }

  /* List view compact but readable */
  .listing-card-list { padding: 14px; gap: 12px; }
  .listing-card-list__title { font-size: 13.5px; }
  .listing-card-list__meta { gap: 8px; }
  .listing-card-list__icon { width: 36px; height: 36px; }
  .listing-card-list__icon svg { width: 18px; height: 18px; }

  /* View toggle — small mobile */
  .view-toggle__btn { width: 34px; height: 34px; }
  .view-toggle__btn svg { width: 16px; height: 16px; }

  /* Results meta */
  .results-meta { margin-bottom: 14px; gap: 8px; }
}
@media(max-width:360px){
  .filter-bar { padding: 10px 12px; }
  .listings-grid { gap: 12px; }
  .cat-pill { padding: 6px 10px; font-size: 11px; }
}
