/* 
 * HouseBlue Responsive Property Listings
 * Mobile-first property card and listing system
 */

/* =============================================================================
   SEARCH HERO SECTION
   ============================================================================= */

.hb-search-hero {
  background: linear-gradient(135deg, var(--hb-primary) 0%, var(--hb-primary-dark) 100%);
  color: var(--hb-white);
  border-radius: var(--hb-radius-lg);
  padding: var(--hb-space-8);
  margin-bottom: var(--hb-space-8);
  position: relative;
  overflow: hidden;
}

.hb-search-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
}

.hb-search-hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.hb-search-hero h1 {
  font-size: var(--hb-text-4xl);
  font-weight: 800;
  margin-bottom: var(--hb-space-4);
  line-height: 1.2;
}

.hb-search-hero p {
  font-size: var(--hb-text-lg);
  opacity: 0.9;
  margin-bottom: 0;
  line-height: 1.6;
}

/* =============================================================================
   SEARCH FORM
   ============================================================================= */

.hb-search-form {
  background: var(--hb-white);
  border-radius: var(--hb-radius-lg);
  padding: var(--hb-space-6);
  box-shadow: var(--hb-shadow-lg);
  border: 1px solid var(--hb-gray-200);
  margin-top: calc(-1 * var(--hb-space-8));
  position: relative;
  z-index: 10;
}

.hb-search-form-title {
  font-size: var(--hb-text-xl);
  font-weight: 700;
  color: var(--hb-dark);
  margin-bottom: var(--hb-space-6);
  text-align: center;
}

.hb-search-form .hb-form-row {
  margin-bottom: var(--hb-space-4);
}

.hb-search-form .hb-form-row:last-child {
  margin-bottom: 0;
}

/* Search form specific inputs */
.hb-search-input {
  background: var(--hb-gray-50);
  border: 2px solid var(--hb-gray-200);
  transition: var(--hb-transition);
}

.hb-search-input:focus {
  background: var(--hb-white);
  border-color: var(--hb-primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.hb-search-btn {
  width: 100%;
  min-height: 48px;
  font-size: var(--hb-text-lg);
  font-weight: 700;
  background: linear-gradient(135deg, var(--hb-primary) 0%, var(--hb-primary-dark) 100%);
  color: var(--hb-white);
  border: none;
  border-radius: var(--hb-radius);
  transition: var(--hb-transition);
  box-shadow: var(--hb-shadow);
}

.hb-search-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--hb-shadow-lg);
}

/* =============================================================================
   RESULTS HEADER
   ============================================================================= */

.hb-results-header {
  background: var(--hb-white);
  border-radius: var(--hb-radius-lg);
  padding: var(--hb-space-6);
  margin-bottom: var(--hb-space-6);
  box-shadow: var(--hb-shadow);
  border: 1px solid var(--hb-gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--hb-space-4);
}

.hb-results-count {
  font-size: var(--hb-text-lg);
  font-weight: 600;
  color: var(--hb-dark);
}

.hb-results-count span {
  color: var(--hb-primary);
  font-weight: 700;
}

.hb-view-toggle {
  display: flex;
  gap: var(--hb-space-2);
  background: var(--hb-gray-100);
  padding: var(--hb-space-1);
  border-radius: var(--hb-radius);
}

.hb-view-toggle-btn {
  padding: var(--hb-space-2) var(--hb-space-4);
  border: none;
  background: transparent;
  color: var(--hb-gray-600);
  border-radius: var(--hb-radius-sm);
  transition: var(--hb-transition);
  font-size: var(--hb-text-sm);
  font-weight: 500;
  cursor: pointer;
  min-height: 36px;
}

.hb-view-toggle-btn.active {
  background: var(--hb-white);
  color: var(--hb-primary);
  box-shadow: var(--hb-shadow-sm);
  font-weight: 600;
}

.hb-view-toggle-btn:hover:not(.active) {
  color: var(--hb-primary);
  background: rgba(13, 110, 253, 0.1);
}

/* =============================================================================
   PROPERTY GRID SYSTEM
   ============================================================================= */

.hb-properties-grid {
  display: grid;
  gap: var(--hb-space-6);
  grid-template-columns: 1fr;
}

/* Grid view (default mobile-first) */
.hb-properties-grid.grid-view {
  grid-template-columns: 1fr;
}

/* List view */
.hb-properties-grid.list-view {
  grid-template-columns: 1fr;
}

/* =============================================================================
   PROPERTY CARDS (Mobile-First)
   ============================================================================= */

.hb-property-card {
  background: var(--hb-white);
  border-radius: var(--hb-radius-lg);
  box-shadow: var(--hb-shadow);
  border: 1px solid var(--hb-gray-200);
  overflow: hidden;
  transition: var(--hb-transition);
  position: relative;
  cursor: pointer;
}

.hb-property-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--hb-shadow-xl);
}

/* Property Image */
.hb-property-image {
  position: relative;
  overflow: hidden;
  height: 240px;
  background: var(--hb-gray-100);
}

.hb-property-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.hb-property-card:hover .hb-property-image img {
  transform: scale(1.08);
}

/* Property Image Overlay */
.hb-property-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, transparent 50%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
}

/* Property Badges */
.hb-property-badges {
  position: absolute;
  top: var(--hb-space-4);
  left: var(--hb-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-2);
  z-index: 2;
}

.hb-property-badge {
  padding: var(--hb-space-1) var(--hb-space-3);
  border-radius: var(--hb-radius-full);
  font-size: var(--hb-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hb-property-badge.new {
  background: linear-gradient(135deg, var(--hb-success) 0%, #0d9488 100%);
  color: var(--hb-white);
}

.hb-property-badge.featured {
  background: linear-gradient(135deg, var(--hb-warning) 0%, #d97706 100%);
  color: var(--hb-white);
}

.hb-property-badge.under-offer {
  background: linear-gradient(135deg, var(--hb-danger) 0%, #b91c1c 100%);
  color: var(--hb-white);
}

.hb-property-badge.sold {
  background: linear-gradient(135deg, var(--hb-gray-600) 0%, var(--hb-gray-800) 100%);
  color: var(--hb-white);
}

/* Property Actions */
.hb-property-actions {
  position: absolute;
  top: var(--hb-space-4);
  right: var(--hb-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-2);
  z-index: 2;
}

.hb-property-action-btn {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: var(--hb-radius-full);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  color: var(--hb-gray-600);
  cursor: pointer;
  transition: var(--hb-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--hb-text-base);
  box-shadow: var(--hb-shadow-sm);
}

.hb-property-action-btn:hover {
  background: var(--hb-white);
  color: var(--hb-primary);
  transform: scale(1.1);
  box-shadow: var(--hb-shadow);
}

.hb-property-action-btn.favorited {
  background: var(--hb-danger);
  color: var(--hb-white);
}

/* Property Photo Count */
.hb-property-photo-count {
  position: absolute;
  bottom: var(--hb-space-4);
  right: var(--hb-space-4);
  background: rgba(0, 0, 0, 0.7);
  color: var(--hb-white);
  padding: var(--hb-space-1) var(--hb-space-2);
  border-radius: var(--hb-radius);
  font-size: var(--hb-text-xs);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--hb-space-1);
  z-index: 2;
}

/* Property Content */
.hb-property-content {
  padding: var(--hb-space-5);
}

.hb-property-price {
  font-size: var(--hb-text-2xl);
  font-weight: 800;
  color: var(--hb-primary);
  margin-bottom: var(--hb-space-2);
  line-height: 1.2;
}

.hb-property-address {
  font-size: var(--hb-text-base);
  color: var(--hb-gray-600);
  margin-bottom: var(--hb-space-3);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: var(--hb-space-1);
}

.hb-property-address i {
  font-size: var(--hb-text-sm);
  color: var(--hb-gray-500);
}

.hb-property-type {
  font-size: var(--hb-text-lg);
  font-weight: 600;
  color: var(--hb-dark);
  margin-bottom: var(--hb-space-3);
  line-height: 1.3;
}

/* Property Features */
.hb-property-features {
  display: flex;
  align-items: center;
  gap: var(--hb-space-4);
  margin-bottom: var(--hb-space-4);
  flex-wrap: wrap;
}

.hb-property-feature {
  display: flex;
  align-items: center;
  gap: var(--hb-space-1);
  font-size: var(--hb-text-sm);
  color: var(--hb-gray-600);
  font-weight: 500;
}

.hb-property-feature i {
  font-size: var(--hb-text-base);
  color: var(--hb-gray-500);
}

/* Property Footer */
.hb-property-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--hb-space-4);
  border-top: 1px solid var(--hb-gray-200);
  gap: var(--hb-space-4);
}

.hb-property-agent {
  display: flex;
  align-items: center;
  gap: var(--hb-space-2);
  font-size: var(--hb-text-sm);
  color: var(--hb-gray-600);
}

.hb-property-agent-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--hb-radius-full);
  background: var(--hb-gray-300);
  overflow: hidden;
}

.hb-property-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hb-property-date {
  font-size: var(--hb-text-xs);
  color: var(--hb-gray-500);
  font-weight: 500;
}

/* =============================================================================
   LIST VIEW MODIFICATIONS
   ============================================================================= */

.hb-properties-grid.list-view .hb-property-card {
  display: flex;
  align-items: stretch;
}

.hb-properties-grid.list-view .hb-property-image {
  width: 280px;
  height: auto;
  min-height: 180px;
  flex-shrink: 0;
}

.hb-properties-grid.list-view .hb-property-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hb-properties-grid.list-view .hb-property-main {
  flex: 1;
}

.hb-properties-grid.list-view .hb-property-features {
  margin-bottom: var(--hb-space-3);
}

/* =============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================= */

/* Mobile (Default) */
@media (max-width: 767.98px) {
  .hb-search-hero {
    padding: var(--hb-space-6);
    margin-bottom: var(--hb-space-6);
  }
  
  .hb-search-hero h1 {
    font-size: var(--hb-text-3xl);
  }
  
  .hb-search-form {
    padding: var(--hb-space-4);
    margin-top: calc(-1 * var(--hb-space-6));
  }
  
  .hb-results-header {
    padding: var(--hb-space-4);
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  
  .hb-view-toggle {
    align-self: center;
  }
  
  .hb-properties-grid {
    gap: var(--hb-space-4);
  }
  
  .hb-property-image {
    height: 200px;
  }
  
  .hb-property-content {
    padding: var(--hb-space-4);
  }
  
  .hb-property-price {
    font-size: var(--hb-text-xl);
  }
  
  .hb-property-features {
    gap: var(--hb-space-3);
  }
  
  .hb-property-footer {
    flex-direction: column;
    align-items: stretch;
    gap: var(--hb-space-2);
  }
  
  /* Force grid view on mobile for list view */
  .hb-properties-grid.list-view .hb-property-card {
    flex-direction: column;
  }
  
  .hb-properties-grid.list-view .hb-property-image {
    width: 100%;
    height: 200px;
  }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
  .hb-properties-grid.grid-view {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .hb-property-image {
    height: 220px;
  }
  
  .hb-search-form .hb-form-row {
    display: flex;
    gap: var(--hb-space-4);
  }
  
  .hb-search-form .hb-form-col {
    flex: 1;
  }
}

/* Desktop */
@media (min-width: 992px) {
  .hb-properties-grid.grid-view {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .hb-property-image {
    height: 260px;
  }
  
  .hb-search-form {
    padding: var(--hb-space-8);
  }
  
  .hb-search-form .hb-form-row {
    display: flex;
    gap: var(--hb-space-4);
    align-items: end;
  }
  
  .hb-search-form .hb-form-col {
    flex: 1;
  }
  
  .hb-search-btn {
    width: auto;
    min-width: 200px;
  }
}

/* Large Desktop */
@media (min-width: 1200px) {
  .hb-properties-grid.grid-view {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .hb-search-hero {
    padding: var(--hb-space-12);
  }
  
  .hb-search-hero h1 {
    font-size: var(--hb-text-5xl);
  }
}

/* =============================================================================
   LOADING STATES
   ============================================================================= */

.hb-property-card.loading {
  pointer-events: none;
  opacity: 0.7;
}

.hb-property-card.loading .hb-property-image {
  background: linear-gradient(90deg, var(--hb-gray-200) 25%, var(--hb-gray-300) 50%, var(--hb-gray-200) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* =============================================================================
   UTILITIES
   ============================================================================= */

.hb-property-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.hb-property-link:hover {
  text-decoration: none;
  color: inherit;
}

/* Hide elements on specific views */
.list-view-only {
  display: none;
}

.grid-view-only {
  display: block;
}

.hb-properties-grid.list-view .list-view-only {
  display: block;
}

.hb-properties-grid.list-view .grid-view-only {
  display: none;
}