/* Optimized Device-Friendly Property Search */
:root {
    --primary-blue: #0066cc;
    --primary-dark: #004499;
    --light-gray: #f8f9fa;
    --border-gray: #e1e5e9;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --success-green: #28a745;
    --shadow-light: 0 2px 8px rgba(0, 102, 204, 0.1);
    --shadow-medium: 0 4px 16px rgba(0, 102, 204, 0.15);
    --transition: all 0.25s ease;
}

/* Main Search Container */
.property-search-container {
    background: white;
    border-bottom: 1px solid var(--border-gray);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-light);
}

/* Search Header - Single Line Layout */
.search-header-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
}

/* Main Search Input - Database Connected */
.search-input-container {
    position: relative;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.main-search-input {
    width: 100%;
    height: 48px;
    border: 2px solid var(--primary-blue);
    border-radius: 8px;
    padding: 0 50px 0 16px;
    font-size: 16px;
    font-weight: 400;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

.main-search-input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-medium);
}

.search-icon-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--primary-blue);
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.search-icon-btn:hover {
    background: var(--primary-dark);
}

/* Search Suggestions Dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    z-index: 1001;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.suggestion-item:hover {
    background: var(--light-gray);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-icon {
    color: var(--text-light);
    font-size: 18px;
}

.suggestion-text {
    flex: 1;
}

.suggestion-title {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.suggestion-subtitle {
    font-size: 13px;
    color: var(--text-light);
}

/* Inline Filter Buttons */
.inline-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 48px;
    padding: 0 16px;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--primary-blue);
    background: #f8fbff;
}

.filter-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.filter-btn .dropdown-icon {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.filter-btn.active .dropdown-icon {
    transform: rotate(180deg);
}

/* Price Filter Dropdown */
.price-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    padding: 20px;
    min-width: 350px;
    z-index: 1001;
    margin-top: 8px;
}

.price-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 16px;
    height: 16px;
    background: white;
    border: 1px solid var(--border-gray);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

.price-section-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    font-size: 16px;
}

/* Price Input Row */
.price-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.price-input {
    flex: 1;
    height: 44px;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 0 12px;
    font-size: 14px;
    color: var(--text-dark);
    background: #fafafa;
    transition: var(--transition);
}

.price-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.price-separator {
    color: var(--text-light);
    font-weight: 500;
    font-size: 16px;
}

/* Price Range Dropdowns */
.price-dropdowns {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.price-select {
    flex: 1;
    height: 44px;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 0 12px;
    font-size: 14px;
    color: var(--text-dark);
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.price-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

/* Apply Button */
.apply-btn {
    width: 100%;
    height: 44px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.apply-btn:hover {
    background: var(--primary-dark);
}

.apply-btn:active {
    transform: translateY(1px);
}

/* Home Type Dropdown */
.home-type-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    padding: 20px;
    min-width: 300px;
    max-width: 400px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    margin-top: 8px;
}

.home-type-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 16px;
    height: 16px;
    background: white;
    border: 1px solid var(--border-gray);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

.type-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    transition: var(--transition);
}

.type-checkbox-item:hover {
    background: var(--light-gray);
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: 6px;
}

.type-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-gray);
    border-radius: 3px;
    position: relative;
    transition: var(--transition);
}

.type-checkbox.checked {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
}

.type-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 2px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.type-label {
    font-size: 14px;
    color: var(--text-dark);
    user-select: none;
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px;
    max-width: 1400px;
    margin: 0 auto;
    border-bottom: 1px solid var(--border-gray);
}

.results-count {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-size: 14px;
    color: var(--text-light);
}

.sort-select {
    height: 40px;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 0 12px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* Loading States */
.search-loading {
    position: relative;
    opacity: 0.7;
}

.search-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 50px;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .search-header-inline {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .search-input-container {
        width: 100%;
        max-width: none;
        order: 1;
    }
    
    .inline-filters {
        width: 100%;
        justify-content: space-between;
        order: 2;
    }
    
    .filter-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
        font-size: 13px;
        padding: 0 8px;
    }
    
    .price-dropdown,
    .home-type-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: none;
        max-height: none;
        border-radius: 0;
        margin: 0;
        padding: 60px 20px 20px;
        overflow-y: auto;
        z-index: 1050;
    }
    
    .price-dropdown::before,
    .home-type-dropdown::before {
        display: none;
    }
    
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: white;
        border-bottom: 1px solid var(--border-gray);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        z-index: 1051;
    }
    
    .mobile-close {
        background: none;
        border: none;
        font-size: 24px;
        color: var(--text-light);
        cursor: pointer;
        padding: 8px;
    }
    
    .results-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .sort-container {
        width: 100%;
        justify-content: space-between;
    }
    
    .sort-select {
        flex: 1;
        margin-left: 12px;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .search-header-inline {
        gap: 10px;
        padding: 14px;
    }
    
    .filter-btn {
        font-size: 13px;
        padding: 0 12px;
    }
    
    .price-dropdown {
        min-width: 320px;
    }
}

/* Large Screen Optimizations */
@media (min-width: 1400px) {
    .search-input-container {
        max-width: 450px;
    }
    
    .price-dropdown {
        min-width: 380px;
    }
}

/* Performance Optimizations */
* {
    box-sizing: border-box;
}

.property-search-container *,
.property-search-container *::before,
.property-search-container *::after {
    box-sizing: inherit;
}

/* GPU acceleration for animations */
.filter-btn,
.main-search-input,
.price-dropdown,
.home-type-dropdown,
.search-suggestions {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Smooth scrolling for dropdowns */
.search-suggestions,
.home-type-dropdown {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Focus indicators for accessibility */
.filter-btn:focus,
.main-search-input:focus,
.price-input:focus,
.price-select:focus,
.apply-btn:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-blue: #0052cc;
        --border-gray: #666;
        --text-light: #333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}