/* ==========================================================================
   QMI Archive — Grid & Card Styles
   ========================================================================== */

/* Page wrapper */
.qmi-archive-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ---- Grid ---- */
.qmi-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  padding: 30px 0;
  transition: opacity 0.2s ease;
}

.qmi-posts-grid.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

.qmi-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 16px;
}

/* ---- Sentinel (infinite scroll trigger) ---- */
.qmi-scroll-sentinel {
  height: 1px;
  width: 100%;
  display: block;
}

/* ---- Card ---- */
.qmi-card {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease;
}

.qmi-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
}

/* ---- Card image ---- */
.qmi-card-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #f0f0f0;
}

.qmi-card-image a {
  display: block;
  width: 100%;
  height: 100%;
}

.qmi-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.qmi-card:hover .qmi-card-image img {
  transform: scale(1.03);
}

/* Property ribbon (AVAILABLE, SOLD, etc.) */
.qmi-card-image .property-ribbon {
  position: absolute;
  top: 20px;
  right: -28px;
  background: #333;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 36px;
  transform: rotate(45deg);
  transform-origin: center;
  white-space: nowrap;
  z-index: 2;
}

.qmi-card-image .property-ribbon.available { background: #333; }
.qmi-card-image .property-ribbon.sold      { background: #c0392b; }

/* mi_labels (when no property_status ribbon) */
.qmi-card-image .mi_labels {
  position: absolute;
  top: 10px;
  left: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.qmi-card-image .mi_labels li {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 2px;
  color: #fff;
}

.qmi-card-image .mi_labels li.orange { background: #FF8200; }
.qmi-card-image .mi_labels li.grey   { background: #888; }

/* Save-for-later heart button */
.qmi-card-image .saved-for-later-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 0;
}

/* ---- Card body ---- */
.qmi-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

/* Title */
.qmi-card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.qmi-card-title a {
  color: inherit;
  text-decoration: none;
}

.qmi-card-title a:hover {
  color: #FF8200;
}

/* Pricing row */
.qmi-card-pricing {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qmi-price {
  font-size: 16px;
  font-weight: 700;
  color: #222;
}

.qmi-estimated-payment {
  font-size: 13px;
  font-weight: 600;
  color: #FF8200;
}

/* Housing type + Compare row */
.qmi-card-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qmi-housing-type {
  font-size: 13px;
  color: #FF8200;
  font-weight: 600;
}

/* Compare button */
.qmi-compare-button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Specs row (bed / bath / sqft) */
.qmi-card-specs {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 13px;
  color: #444;
}

.qmi-spec {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.qmi-spec svg {
  flex-shrink: 0;
}

/* Details row (date / status / city) */
.qmi-card-details {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
  color: #555;
  border-top: 1px solid #f0f0f0;
  padding-top: 8px;
  margin-top: auto;
}

.qmi-detail {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.qmi-detail svg {
  flex-shrink: 0;
}

/* ==========================================================================
   Skeleton cards (infinite-scroll loading state)
   ========================================================================== */

@keyframes qmi-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.qmi-card-skeleton {
  pointer-events: none;
}

.qmi-card-skeleton .qmi-card-image,
.qmi-card-skeleton .qmi-skel {
  background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: qmi-shimmer 1.4s ease-in-out infinite;
}

.qmi-card-skeleton .qmi-card-image {
  border-radius: 0;
}

.qmi-card-skeleton .qmi-skel {
  border-radius: 3px;
  height: 16px;
}

.qmi-card-skeleton .qmi-skel--title   { width: 75%; height: 20px; }
.qmi-card-skeleton .qmi-skel--price   { width: 45%; }
.qmi-card-skeleton .qmi-skel--specs   { width: 65%; }
.qmi-card-skeleton .qmi-skel--details { width: 55%; margin-top: auto; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .qmi-posts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .qmi-posts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .qmi-archive-page {
    padding: 0 12px 40px;
  }
}
