/* ==========================================================================
   LISTING LIST VIEW & GRID STYLES
   Robust, responsive container and grid layout for property listings.
   ========================================================================== */

.listing-list-view-container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem 1.25rem;
}

/* --------------------------------------------------------------------------
   HEADER
   -------------------------------------------------------------------------- */
.listing-list-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(222, 173, 170, 0.2);
}

.header-text-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.listing-list-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-color, #ffffff);
  letter-spacing: -0.02em;
}

@media (prefers-color-scheme: light) {
  .listing-list-title {
    color: #0f172a;
  }
}

.listing-list-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted, #94a3b8);
}

.listing-list-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 20px;
  background: rgba(222, 173, 170, 0.15);
  color: var(--secondary, #deadaa);
  border: 1px solid rgba(222, 173, 170, 0.35);
}

/* --------------------------------------------------------------------------
   GRID LAYOUT
   Responsive auto-fit grid adapting seamlessly across viewports
   -------------------------------------------------------------------------- */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem 1.5rem;
  width: 100%;
}

@media (max-width: 640px) {
  .listing-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.listing-grid-item {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* --------------------------------------------------------------------------
   EMPTY STATE
   -------------------------------------------------------------------------- */
.listing-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4.5rem 1.5rem;
  border-radius: 16px;
  background: var(--bg-card, rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(222, 173, 170, 0.3);
  margin: 1.5rem 0;
}

@media (prefers-color-scheme: light) {
  .listing-empty-state {
    background: #ffffff;
  }
}

.empty-icon-wrap {
  margin-bottom: 1.25rem;
  opacity: 0.9;
}

.empty-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-color, #ffffff);
}

@media (prefers-color-scheme: light) {
  .empty-title {
    color: #0f172a;
  }
}

.empty-description {
  max-width: 480px;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted, #94a3b8);
}

/* --------------------------------------------------------------------------
   PAGINATION
   -------------------------------------------------------------------------- */
.listing-pagination {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
}

.pagination-list {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.page-item {
  display: inline-flex;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-color, #ffffff);
  background: var(--glass, rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(222, 173, 170, 0.25);
  transition: all 0.2s ease;
}

@media (prefers-color-scheme: light) {
  .page-link {
    color: #111827;
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
  }
}

.page-link:hover {
  background: var(--secondary, #deadaa);
  color: #0f172a;
  border-color: var(--secondary, #deadaa);
  transform: translateY(-1px);
}

.page-item.active .page-link {
  background: var(--secondary, #deadaa);
  color: #0f172a;
  border-color: var(--secondary, #deadaa);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   INFINITE SCROLL
   Hidden until JavaScript confirms that intersection observation is available.
   The regular pagination above remains the non-JavaScript fallback.
   -------------------------------------------------------------------------- */
.listing-infinite-scroll {
  display: none;
  justify-content: center;
  align-items: center;
  min-height: 3rem;
  margin-top: 2.5rem;
  color: var(--muted, #94a3b8);
  font-size: 0.9rem;
  text-align: center;
}

.listing-infinite-scroll.is-active {
  display: flex;
}

.listing-infinite-scroll.is-loading .listing-scroll-status::before {
  content: "";
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  margin-right: 0.65rem;
  border: 2px solid rgba(222, 173, 170, 0.3);
  border-top-color: var(--secondary, #deadaa);
  border-radius: 50%;
  animation: listing-scroll-spin 0.75s linear infinite;
}

.listing-infinite-scroll.is-error {
  color: #fca5a5;
}

.listing-infinite-scroll.is-complete {
  color: var(--muted, #94a3b8);
}

.listing-scroll-retry {
  margin-left: 0.75rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.listing-scroll-retry:hover {
  background: rgba(255, 255, 255, 0.08);
}

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

@media (prefers-reduced-motion: reduce) {
  .listing-infinite-scroll.is-loading .listing-scroll-status::before {
    animation: none;
  }
}
