/* Property Listings Specific Styles */
/* This file contains styles specific to the property listings page */

/* Property Image Styling */
.property-image-container {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 0.375rem 0 0 0.375rem;
    display: block; /* Changed from flex to block to reduce layout shifts */
}

.property-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block; /* Ensure block display */
    backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
}

.property-card:hover .property-image {
    transform: scale(1.05);
}

.property-image-placeholder {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Property Status Badge */
.property-status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Image Count Badge */
.image-count-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Property Badges (legacy support) */
.property-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    z-index: 2;
}

/* Page Header Styles */
.page-header {
    background: linear-gradient(135deg, #000 0%, #333 100%);
    color: white;
    padding: 4rem 0 2rem;
    position: relative;
}

.page-header-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
}

.page-header-content p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: white;
}

.property-badge.under-offer {
    background: rgba(220, 53, 69, 0.9);
}

.image-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(6px);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.image-count:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-1px);
}

.image-count i {
    font-size: 0.7rem;
}

/* Property Card Enhancements */
.property-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e9ecef !important;
    border-radius: 0.5rem;
    overflow: hidden;
    background: white;
    margin-bottom: 1.5rem;
}

.property-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}

.property-card .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.property-card .row.g-0 {
    min-height: 280px;
}

.property-card .col-md-4 {
    display: flex;
    align-items: stretch;
}

.property-card .col-md-8 {
    display: flex;
    flex-direction: column;
}

/* Feature Items */
.feature-item {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6c757d;
    white-space: nowrap;
}

.feature-item i {
    margin-right: 0.25rem;
    color: #0d6efd;
}

/* Property Actions */
.property-actions {
    margin-top: auto;
    padding-top: 1rem;
}

.property-actions .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.property-actions .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

/* Search Form Enhancements */
.search-container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.search-form {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    backdrop-filter: blur(10px);
}

.search-form .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    text-align: left;
    font-size: 0.875rem;
}

.search-form .form-control,
.search-form .form-select {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-size: 0.875rem;
}

.search-form .form-control:focus,
.search-form .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.search-form .input-group-text {
    background: #e9ecef;
    border: 1px solid #ced4da;
    color: #6c757d;
}

/* Search form layout and alignment */
/* Prior Searches clickable rows */
.prior-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.prior-row:hover,
.prior-row:focus {
    background-color: #f8f9fa; /* Bootstrap light */
    outline: none;
}

/* Expandable card headers */
.card-toggle {
    cursor: pointer;
    border-radius: 0.25rem;
    padding: 0.125rem 0.25rem;
}
.card-toggle:hover,
.card-toggle:focus {
    background-color: #f8f9fa;
    outline: none;
}
.toggle-icon {
    transition: transform 0.2s ease;
}
.toggle-icon.expanded {
    transform: rotate(180deg);
}
.search-form .row {
    align-items: flex-start;
}

/* Selected locations styling - mobile and general */
.search-form #selected_locations {
    margin-top: 0.5rem;
    min-height: 0;
    transition: all 0.3s ease;
}

.search-form #selected_locations:not(:empty) {
    padding-bottom: 0.25rem;
}

/* Style the selected location badges */
.search-form .selected-location {
    display: inline-block;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.search-form .selected-location .btn-close {
    font-size: 0.6rem;
    padding: 0;
    margin-left: 0.25rem;
}

/* Mobile-specific: ensure form can grow naturally */
@media (max-width: 767px) {
    .search-form {
        padding-bottom: 1rem; /* Less padding on mobile */
    }
}

/* Desktop search form layout */
@media (min-width: 768px) {
    .search-form .row {
        align-items: flex-start; /* Lock columns to top */
    }
    
    /* Ensure form inputs align properly by creating a consistent baseline */
    .search-form .col-md-4,
    .search-form .col-md-3,
    .search-form .col-md-2 {
        display: flex;
        flex-direction: column;
    }
    
    /* Create a wrapper for the input area to maintain consistent alignment */
    .search-form .form-input-wrapper {
        display: flex;
        flex-direction: column;
        min-height: calc(2.25rem + 2px + 1.5rem); /* input height + label height */
        justify-content: flex-end; /* Push form controls to bottom of wrapper */
    }
    
    /* Special handling for location column to prevent postcode tags from affecting alignment */
    .search-form .col-md-4 .form-input-wrapper {
        position: relative;
    }
    
    /* Ensure selected locations don't affect the form input alignment */
    .search-form .col-md-4 #selected_locations {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: 0.25rem;
        z-index: 10;
    }
    
    /* Make the location input container relative for proper spacing */
    .search-form .col-md-4 .position-relative {
        position: relative !important;
    }
    
    /* Ensure the search form can grow to accommodate selected locations */
    .search-form {
        min-height: auto;
        overflow: visible;
        padding-bottom: 6rem; /* Add padding to accommodate postcode tags */
    }
}

/* Results Summary */
.results-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
}

.results-summary h4 {
    margin: 0;
    color: #222 !important;
    font-weight: 600;
}

.results-summary .text-muted {
    font-size: 0.875rem;
}

/* View Controls */
.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-controls .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #dee2e6;
    background: white;
    color: #6c757d;
}

.view-controls .btn.active {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

/* Property Meta Information */
.property-meta {
    font-size: 0.875rem;
    color: #6c757d;
}

.property-meta i {
    color: #0d6efd;
    margin-right: 0.25rem;
}

/* No Properties Alert */
.alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* Pagination Styles */
.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.pagination .page-link {
    color: #0d6efd;
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

.pagination .page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: white;
    border-color: #dee2e6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .property-card .row.g-0 {
        flex-direction: column;
        min-height: auto;
    }
    
    .property-card .col-md-4,
    .property-card .col-md-8 {
        max-width: 100%;
        flex: 0 0 auto;
        width: 100%;
    }
    
    .property-image-container {
        height: 300px;
        border-radius: 0.375rem 0.375rem 0 0;
    }
    
    .property-features .d-flex {
        gap: 1rem !important;
    }
    
    .feature-item {
        font-size: 0.85rem;
    }
    
    .search-form {
        padding: 1.5rem;
    }
    
    .results-summary h4 {
        font-size: 1.1rem;
    }
    
    .property-actions .d-flex {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
}

@media (max-width: 576px) {
    .search-form {
        padding: 1rem;
    }
    
    .property-image-container {
        height: 300px;
    }
    
    .results-summary {
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .view-controls {
        justify-content: center;
        width: 100%;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: center !important;
        text-align: center;
    }
}

/* Grid View Styles */
.grid-view .property-item {
    margin-bottom: 2rem;
}

.grid-view .property-card .row {
    flex-direction: column;
}

.grid-view .property-image-container {
    height: 200px;
    border-radius: 0.375rem 0.375rem 0 0;
}

/* Loading States */
.property-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Smooth Transitions */
.property-item {
    transition: opacity 0.3s ease;
}

/* Focus States for Accessibility */
.property-card:focus-within {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Location Search Styles */
#location_suggestions {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: white;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

#location_suggestions .dropdown-item {
    padding: 0.5rem 1rem;
    border: none;
    color: #212529;
    text-decoration: none;
    display: block;
    width: 100%;
    clear: both;
    font-weight: 400;
    line-height: 1.5;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
}

#location_suggestions .dropdown-item:hover,
#location_suggestions .dropdown-item:focus {
    background-color: #e9ecef;
    color: #16181b;
}

.selected-location {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
    background-color: #0d6efd !important;
    color: white;
    border-radius: 0.375rem;
}

.selected-location .btn-close {
    font-size: 0.75rem;
    margin-left: 0.5rem;
    padding: 0;
    border: none;
    opacity: 0.8;
    color: #fff;
}

.selected-location .btn-close:hover {
    opacity: 1;
}

.selected-location .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Filters Toggle Button Styles */
#filters-toggle-btn {
    transition: all 0.3s ease;
}

#filters-toggle-btn.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

#filters-toggle-btn:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: white;
}

/* Search Form Transition */
#search-form {
    transition: all 0.3s ease;
    overflow: hidden;
}

#search-form.show {
    display: block !important;
}

/* Faux multi-select dropdown for Property Type */
.multi-select { position: relative; }
.multi-select .multi-select-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: .375rem;
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
  padding: .5rem 0;
  display: none;
  max-height: 220px;
  overflow-y: auto;
}
.multi-select .dropdown-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .375rem .75rem;
  cursor: pointer;
}
.multi-select .dropdown-item input { margin-right: .5rem; }
.form-select { cursor: pointer; }