* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9fa;
    color: #212529;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 30px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.header p {
    margin-top: 8px;
    opacity: 0.9;
    font-size: 16px;
}

/* Filters Section */
.filters-section {
    background: white;
    padding: 25px 40px;
    border-bottom: 2px solid #dee2e6;
    overflow: hidden;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filters-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-filters {
    background: #e9ecef;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s;
}

.toggle-filters:hover {
    background: #dee2e6;
}

.filters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.filter-label {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-input, .filter-select {
    padding: 10px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
    width: 100%;
    min-width: 0;
}

.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: #1e3c72;
}

/* Location Tree */
.location-tree {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    max-height: 500px;
    overflow-y: auto;
    background: white;
}

.tree-root {
    border-bottom: 1px solid #e9ecef;
}

.tree-root:last-child {
    border-bottom: none;
}

.tree-root-header {
    padding: 12px 15px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #212529;
    transition: background 0.2s;
}

.tree-root-header:hover {
    background: #e9ecef;
}

.tree-root-header.selected {
    background: #e7f3ff;
    color: #1e3c72;
}

.tree-root-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tree-expand-icon {
    margin-left: auto;
    transition: transform 0.2s;
    color: #6c757d;
}

.tree-expand-icon.expanded {
    transform: rotate(90deg);
}

.tree-locations {
    display: none;
    padding: 10px 15px 10px 35px;
    background: white;
}

.tree-locations.show {
    display: block;
}

/* Sub-Root Styles */
.tree-subroot-item {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    font-weight: 500;
    color: #212529;
}

.tree-subroot-item:hover {
    background: #f8f9fa;
}

.tree-subroot-item.selected {
    background: #e7f3ff;
}

.tree-subroot-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.tree-subroot-label {
    font-size: 14px;
    cursor: pointer;
    flex: 1;
}

.tree-subroot-expand {
    margin-left: auto;
    transition: transform 0.2s;
    color: #6c757d;
    font-size: 12px;
}

.tree-subroot-expand.expanded {
    transform: rotate(90deg);
}

/* Location Items */
.tree-location-item {
    padding: 6px 10px 6px 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.tree-location-item:hover {
    background: #f8f9fa;
}

.tree-location-item.selected {
    background: #e7f3ff;
}

.tree-location-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.tree-location-label {
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    flex: 1;
}

/* Sub-Locations Container */
.tree-sublocations {
    display: none;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 2px solid #dee2e6;
}

.tree-sublocations.show {
    display: block;
}

/* Price Range */
.price-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.btn-apply-filters {
    background: #1e3c72;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 150px;
}

.btn-apply-filters:hover {
    background: #2a5298;
}

.btn-clear-filters {
    background: #6c757d;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}

.btn-clear-filters:hover {
    background: #5a6268;
}

/* Active Filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.filter-tag {
    background: #e7f3ff;
    color: #1e3c72;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-tag button {
    background: none;
    border: none;
    color: #1e3c72;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

/* Controls */
.controls {
    padding: 20px 40px;
    background: white;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.language-select {
    padding: 10px 15px;
    border: 2px solid #1e3c72;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: white;
    color: #1e3c72;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #1e3c72;
    color: white;
}

.btn-primary:hover {
    background: #2a5298;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-info {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.update-time {
    color: #6c757d;
    font-size: 13px;
}

.query-info {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.query-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.query-indicator.fresh {
    background: #28a745;
}

.query-indicator.aging {
    background: #ffc107;
}

.query-indicator.stale {
    background: #dc3545;
}

/* Listings Container */
.listings-container {
    padding: 30px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.results-header {
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-count {
    font-size: 18px;
    color: #495057;
}

.results-count strong {
    color: #212529;
    font-weight: 600;
}

/* Property List */
.property-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.property-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    padding: 20px;
    gap: 20px;
    transition: all 0.3s;
    cursor: pointer;
}

.property-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.property-image {
    width: 280px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #e9ecef;
}

.property-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.property-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.property-title {
    flex: 1;
}

.property-location {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 4px;
}

.property-ref {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

.property-price {
    font-size: 28px;
    font-weight: 700;
    color: #1e3c72;
    white-space: nowrap;
}

.property-description {
    color: #495057;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.property-features {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #495057;
    font-size: 14px;
}

.feature i {
    color: #6c757d;
    width: 18px;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.loading i {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 20px;
    animation: spin 1s linear infinite;
}

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

.error {
    text-align: center;
    padding: 60px 20px;
    color: #dc3545;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.no-results i {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 20px;
    }
    
    .filters-section {
        padding: 15px 20px;
    }
    
    .filters-container {
        grid-template-columns: 1fr;
    }
    
    .price-range {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .btn-apply-filters,
    .btn-clear-filters {
        width: 100%;
    }
    
    .property-card {
        flex-direction: column;
    }
    
    .property-image {
        width: 100%;
        height: 220px;
    }
    
    .property-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        padding: 15px 20px;
    }
    
    .listings-container {
        padding: 20px;
    }
    
    .location-tree {
        max-height: 400px;
    }
}