/* Search page styles - optimized for speed and performance */

/* Core layout */
body {
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: #333;
    background-color: #f8fafc;
}

/* Critical styles for layout placeholders */
.search-container {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 2000px; /* Arbitrary large value */
}

/* Collapsed search container */
.search-container.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    margin-top: 0;
    margin-bottom: 20px;
    border: none;
    box-shadow: none;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Page content container */
.page-content {
    flex: 1;
    padding: 2rem 0;
}

/* Header styling */
.site-header {
    background-color: #3b82f6; /* Blue-500 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Logo styling */
.logo-img {
    height: 2.5rem; /* 40px */
    width: auto;
    transition: transform 0.2s ease;
}

@media (min-width: 768px) {
    .logo-img {
        height: 3rem; /* 48px */
    }
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: white;
}

.nav-link.active {
    color: white;
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: white;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Property cards */
.property-card {
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem;  /* Ensure some space between stacked cards */
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.property-img-container {
    aspect-ratio: 4/3;
    background-color: #f1f5f9; /* slate-100 */
    position: relative;
    overflow: hidden;
}

.property-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.property-img.loaded {
    opacity: 1;
}

/* Loading indicator */
.property-img-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6; /* Blue-500 */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
}

.container-loaded::after {
    display: none !important;
}

.card-body {
    flex: 1 1 auto;
    padding: 1rem;
}

.property-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1e293b; /* slate-800 */
    line-height: 1.3;
}

.property-location {
    color: #64748b; /* slate-500 */
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.property-location i {
    margin-right: 0.25rem;
    color: #94a3b8; /* slate-400 */
}

.property-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: #64748b; /* slate-500 */
    font-size: 0.875rem;
}

.price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #10b981; /* emerald-500 */
}

.view-details {
    padding: 0.375rem 0.75rem;
    background-color: transparent;
    color: #3b82f6; /* Blue-500 */
    border: 1px solid #3b82f6;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}

.view-details:hover {
    background-color: #3b82f6;
    color: white;
}

/* Custom select dropdowns */
.custom-select-container {
    position: relative;
}

.custom-select-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #1e293b; /* slate-800 */
    background-color: #fff;
    border: 1px solid #cbd5e1; /* slate-300 */
    border-radius: 0.375rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-select-input:focus {
    border-color: #3b82f6; /* Blue-500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    outline: none;
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #cbd5e1; /* slate-300 */
    border-radius: 0.375rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-top: 2px;
    display: none;
}

.custom-select-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.custom-select-item:hover {
    background-color: #f1f5f9; /* slate-100 */
}

/* Tags input styles */
.tags-input-container {
    border: 1px solid #cbd5e1; /* slate-300 */
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background-color: #fff;
    min-height: 45px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tags-input-container:focus-within {
    border-color: #3b82f6; /* Blue-500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.tag {
    display: inline-flex;
    align-items: center;
    background-color: #e0f2fe; /* light blue-100 */
    color: #0369a1; /* light blue-700 */
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    margin-right: 5px;
    margin-bottom: 2px;
}

.tag .close {
    margin-left: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
    color: #0369a1; /* light blue-700 */
    transition: color 0.2s;
}

.tag .close:hover {
    color: #be123c; /* rose-700 */
}

.tags-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0;
    background: transparent;
    min-width: 100px;
    font-size: 0.875rem;
}

.tags-dropdown {
    position: absolute;
    background-color: white;
    border: 1px solid #cbd5e1; /* slate-300 */
    border-radius: 0.375rem;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    width: calc(100% - 30px);
    margin-top: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: none;
}

.tags-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tags-dropdown-item:hover {
    background-color: #f1f5f9; /* slate-100 */
}

.tags-dropdown-loading {
    padding: 10px;
    text-align: center;
    color: #64748b; /* slate-500 */
    font-style: italic;
}

.tags-dropdown-error {
    padding: 10px;
    text-align: center;
    color: #ef4444; /* red-500 */
}

.tags-dropdown-empty {
    padding: 10px;
    text-align: center;
    color: #64748b; /* slate-500 */
}

.tags-dropdown-load-more {
    padding: 5px;
    text-align: center;
    background-color: #f1f5f9; /* slate-100 */
    border-top: 1px solid #e2e8f0; /* slate-200 */
    font-size: 0.8rem;
    color: #64748b; /* slate-500 */
}

/* Form styles */
.form-label {
    color: #475569; /* slate-600 */
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    display: block;
}

.form-select, 
.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #1e293b; /* slate-800 */
    background-color: #fff;
    border: 1px solid #cbd5e1; /* slate-300 */
    border-radius: 0.375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus,
.form-control:focus {
    border-color: #3b82f6; /* Blue-500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    outline: none;
}

.btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background-color: #3b82f6; /* Blue-500 */
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #2563eb; /* Blue-600 */
}

/* Ensure proper button alignment */
@media (min-width: 768px) {
    .align-items-end {
        align-items: flex-end !important;
    }
}

/* Messages */
.message {
    padding: 2rem;
    text-align: center;
}

.message h3 {
    color: #1e293b; /* slate-800 */
    margin-bottom: 0.5rem;
}

.message p {
    color: #64748b; /* slate-500 */
}

/* Loading spinner */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 0.25rem solid rgba(59, 130, 246, 0.25);
    border-top-color: #3b82f6; /* Blue-500 */
    animation: spin 1s linear infinite;
}

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

/* Scroll to top button */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #3b82f6; /* Blue-500 */
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 100;
    transform: translateY(20px);
    pointer-events: none;
}

.scroll-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-to-top:hover {
    background-color: #2563eb; /* Blue-600 */
}

/* Results counter */
.results-counter {
    padding: 0.75rem 1rem;
    background-color: #f8fafc; /* slate-50 */
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    color: #64748b; /* slate-500 */
    font-size: 0.875rem;
}

.font-semibold {
    font-weight: 600;
    color: #334155; /* slate-700 */
}

/* Load more button */
.load-more-btn {
    padding: 0.75rem 1.5rem;
    background-color: white;
    color: #3b82f6; /* Blue-500 */
    border: 1px solid #3b82f6;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 1.5rem 0;
}

.load-more-btn:hover {
    background-color: #eff6ff; /* Blue-50 */
}

.load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Utilities */
.container {
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
    margin-right: auto;
    margin-left: auto;
    max-width: 1200px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.col-md-2, .col-md-3, .col-md-4, .col-md-6, .col-md {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    width: 100%;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.align-items-end {
    align-items: flex-end;
}

.justify-content-between {
    justify-content: space-between;
}

.w-100 {
    width: 100%;
}

.d-none {
    display: none;
}

.position-relative {
    position: relative;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }

.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.text-center { text-align: center; }

/* Footer */
.site-footer {
    background-color: #1e293b; /* slate-800 */
    color: #94a3b8; /* slate-400 */
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-title {
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-link {
    color: #94a3b8; /* slate-400 */
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: white;
}

.site-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.site-footer li {
    margin-bottom: 0.5rem;
}

.footer-bottom {
    border-top: 1px solid #334155; /* slate-700 */
    margin-top: 2rem;
    padding-top: 1rem;
    text-align: center;
    font-size: 0.875rem;
}

/* Media queries */
/* Tablet (medium devices) */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .col-md-2 { width: 33.3333%; }  /* Make slightly wider on tablets */
    .col-md-3 { width: 33.3333%; }  /* Make columns wider on tablets */
    .col-md-4 { width: 50%; }       /* 2 columns per row instead of 3 */
    .col-md-6 { width: 50%; }
    .col-md { flex: 1 0 0%; }
    
    .search-container {
        padding: 1.5rem;
    }
    
    .property-img-container {
        aspect-ratio: 3/2;  /* Slightly wider aspect ratio for tablets */
    }
    
    /* Optimize form layout for tablets */
    .custom-select-dropdown, .tags-dropdown {
        max-height: 180px;
    }
    
    /* Adjust property card sizes for tablets */
    .property-title {
        font-size: 1rem;
    }
    
    .property-details {
        gap: 0.5rem;
    }
}

/* Desktop (large devices) */
@media (min-width: 1024px) {
    .col-md-2 { width: 16.6667%; }
    .col-md-3 { width: 25%; }
    .col-md-4 { width: 33.3333%; }
    .col-md-6 { width: 50%; }
    .col-md { flex: 1 0 0%; }
    
    .search-container {
        padding: 2rem;
    }
    
    .property-img-container {
        aspect-ratio: 4/3;  /* Standard aspect ratio for desktop */
    }
    
    /* Desktop-specific enhancements */
    .property-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 24px rgba(0,0,0,0.12);
    }
    
    /* Larger clickable areas on desktop */
    .btn, .view-details {
        padding: 0.75rem 1.25rem;
    }
    
    /* Larger container width for widescreen displays */
    @media (min-width: 1400px) {
        .container {
            max-width: 1320px;
        }
    }
}

/* Mobile (small devices) */
@media (max-width: 767.98px) {
    .property-img-container {
        aspect-ratio: 16/9;
    }
    
    .row {
        margin-right: -0.5rem;
        margin-left: -0.5rem;
    }
    
    [class*="col-"] {
        padding-right: 0.5rem;
        padding-left: 0.5rem;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #3b82f6;
        padding: 1rem;
        z-index: 100;
    }
    
    .nav-links.show {
        display: flex;
    }
}