/* Spinner overlay for property grid loading */
.cpf-loading-spinner {
  position: absolute;
  left: 50%;
  top: 3.5rem;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border: 4px solid rgba(0,0,0,0.08);
  border-top-color: #3d5f48;
  border-radius: 50%;
  animation: cpf-spin 1s linear infinite;
  z-index: 60;
  background: none;
}
/* Property Grid: responsive card grid that mirrors mobile card layout from property-filter */
@import url('../property-badges/style.css');

/* Initial load state: hide until fully rendered to avoid huge unstyled layout
   and show a small spinner. The container keeps a reasonable min-height */
.cpf-property-grid {
  width: 100%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  min-height: 260px; 
  padding-bottom: 2.5rem; 
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  position: relative;
}

/* Header row: title + optional side note */
.cpf-header-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.75rem;
  margin-bottom: 1rem;
}
.cpf-header-title { margin: 0; }
.cpf-header-note { margin: 0 0 0.75rem 0; color: rgba(0,0,0,0.65); font-size: 0.95rem; }


.cpf-property-grid::before {
  content: '';
  display: block;
  width: 44px;
  height: 44px;
  border: 4px solid rgba(0,0,0,0.08);
  border-top-color: #3d5f48;
  border-radius: 50%;
  position: absolute;
  left: 50%;
  top: 1.25rem;
  transform: translateX(-50%);
  animation: cpf-spin 1s linear infinite;
  z-index: 60;
}

.cpf-property-grid.cpf-rendered {
  opacity: 1;
  pointer-events: auto;
}

.cpf-property-grid.cpf-rendered::before { display: none; }

@keyframes cpf-spin { to { transform: translateX(-50%) rotate(360deg); } }

.cpf-property-grid .cpf-property-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Medium: two columns */
@media (min-width: 720px) {
  .cpf-property-grid .cpf-property-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large: three columns */
@media (min-width: 1100px) {
  .cpf-property-grid .cpf-property-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Card container */
.cpf-property-grid .cpf-property-item {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 150ms ease, transform 150ms ease, opacity 220ms ease;
  display: flex;
  flex-direction: column;
  position: relative; /* badges overlay correctly */
}

.cpf-property-grid .cpf-property-item:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

/* Per-card reveal: hidden by default, reveal when image loads */
.cpf-property-grid .cpf-property-item {
  opacity: 0;
  transform: translateY(6px);
}

.cpf-property-grid .cpf-property-item.cpf-card-rendered {
  opacity: 1;
  transform: translateY(0);
}

/* If overall grid is rendered but some cards still not revealed, show them anyway */
.cpf-property-grid.cpf-rendered .cpf-property-item { opacity: 1; transform: none; }

/* Thumbnail: fixed aspect ratio box */
.cpf-property-grid .cpf-property-thumb {
  width: 100%;
  aspect-ratio: 3 / 2; /* modern browsers */
  background: #f6f6f6;
  display: block;
  overflow: hidden;
}

.cpf-property-grid .cpf-property-thumb img,
.cpf-property-grid .cpf-property-thumb > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cpf-property-grid .cpf-thumb-link { display: block; width:100%; height:100%; }

.cpf-property-grid .cpf-property-details {
  padding: 12px 14px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Title (support either h2 from older markup or h3 from updated markup) */
.cpf-property-grid .cpf-property-item h2,
.cpf-property-grid .cpf-property-item h3 {
  margin: 0;
  font-size: 1.05rem;
}

.cpf-property-grid .cpf-property-content {
  color: rgba(0,0,0,0.8);
  font-size: 0.95rem;
  line-height: 1.35;
  margin-top: 4px;
  flex: 1 1 auto; /* take remaining vertical space so cards align */
}

/* Small badge container adjustments inside cards */
.cpf-property-grid .property-badges { top: 10px; left: 10px; }


