/**
 * Search Results New - CSS Styles
 * Matching the UI/UX design from attached images
 */

/* Base Styles */
.search-results-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
    background: #f8f9fa;
}

/* Search Header Section */
.search-header-section {
    padding: 0;
    margin: 0;
}

/* Header Section */
.search-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 0;
}

.breadcrumb {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.filter-tabs {
    display: flex;
    gap: 2px;
    background: #f1f3f4;
    padding: 4px;
    border-radius: 8px;
    width: fit-content;
}

.filter-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tab.active {
    background: #fff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-tab:hover:not(.active) {
    background: rgba(255,255,255,0.5);
}

/* Main Layout */
.search-main {
    padding: 20px 0;
}

.search-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    align-items: start;
}

/* Map-only Layout */
.search-layout-map {
    display: block;
    width: 100%;
}

/* Sidebar */
.search-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
}

.search-input-section {
    margin-bottom: 30px;
}

.search-input-group {
    margin-bottom: 12px;
}

.location-search-btn,
.station-search-btn {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-search-btn:hover,
.station-search-btn:hover {
    border-color: #1976d2;
    color: #1976d2;
}

.location-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
}

.search-btn {
    width: 100%;
    padding: 10px;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.search-btn:hover {
    background: #1565c0;
}

/* Filters Section */
.filters-section h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.price-range,
.area-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-select,
.building-type-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.area-range input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.apply-filters-btn {
    width: 100%;
    padding: 12px;
    background: #ff5722;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

/* Main Content */
.search-content {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.results-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

.results-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* Advanced Filters Dropdown */
.container-filter-dropdown {
    display: flex;
    gap: 16px;
    padding: 20px 25px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    align-items: center;
}

.container-filter-select {
    position: relative;
    min-width: 120px;
}

.container-filter-button,
.container-filter-select-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    white-space: nowrap;
    outline: none;
}

.container-filter-button:hover,
.container-filter-select-button:hover {
    border-color: #e74c3c;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.1);
}

.container-filter-button.active,
.container-filter-select-button.active {
    border-color: #e74c3c;
    background: #fef2f1;
    color: #e74c3c;
}

.container-filter-button svg,
.container-filter-select-button svg {
    width: 16px;
    height: 16px;
    color: currentColor;
    transition: transform 0.2s ease;
}

.container-filter-button svg path,
.container-filter-select-button svg path {
    fill: currentColor;
}

.container-filter-button.active svg,
.container-filter-select-button.active svg {
    transform: rotate(180deg);
}

.container-filter-button.active svg path,
.container-filter-select-button.active svg path {
    fill: currentColor;
}

.container-filter-select-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.container-filter-select.active .container-filter-select-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.container-filter-select-item {
    margin: 0;
    padding: 0;
}

.container-filter-select-item-label {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
    margin: 0;
}

.container-filter-select-item-label:hover {
    background-color: #e74c3c;
    color: #fff;
}
span.container-filter-select-item-label:hover {
    background: red !important;
    color: #fff !important;
}
.container-filter-select-item-label[data-value=""] {
    font-weight: 600;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
}

.container-filter-select-item-label[data-value=""]:hover {
    background-color: #e74c3c;
    color: #fff;
}

.container-filter-select-item-label.selected {
    background-color: #fef2f1;
    color: #e74c3c;
    font-weight: 500;
}

/* Map Container */
.map-container {
    position: relative;
    height: 600px;
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.google-map {
    flex: 1;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.google-map.loaded {
    opacity: 1;
}

/* Map Loading State */
.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.map-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e3e3e3;
    border-top: 4px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Map Info Window Styles */
.gm-style .gm-style-iw-c {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
}

.map-info-window {
    /* Font kế thừa từ theme settings */
    max-width: 280px;
}

.map-info-window h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.map-info-window img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.map-info-window p {
    margin: 6px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.map-info-window strong {
    color: #333;
}

.map-info-window button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.map-info-window button:hover {
    background: #c0392b;
}

/* Map List Toggle Button */
.map-list-toggle {
    top: 60px;
    right: 10px;
    position: absolute;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}
.map-list-toggle.active {
    right: calc(var(--property-list-width, 400px) + 10px);
}

.map-list-toggle:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.map-list-toggle i {
    font-size: 16px;
    color: #666;
}

.map-list-toggle.active {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
}

.map-list-toggle.active i {
    color: #fff;
}

.map-property-list {
    width: 400px;
    height: 100%;
    overflow-y: auto;
    border-left: 1px solid #e0e0e0;
    background: #fff;
    flex-shrink: 0;
    transition: all 0.3s ease;
    transform: translateX(0);
}

.map-property-list.hidden {
    width: 0;
    border-left: none;
    transform: translateX(-100%);
    overflow: hidden;
}

/* Property List Header */
.property-list-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.property-list-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.property-list-content {
    flex: 1;
    overflow-y: auto;
}

/* Property Cards (Compact for Map View) */
.property-card-compact {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.property-card-compact:hover,
.property-card-compact.highlighted {
    background: #f8f9fa;
}

.property-card-compact.highlighted {
    border-left: 4px solid #1976d2;
    background: #e3f2fd;
}

.property-card-compact .property-image {
    flex: 0 0 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 12px;
}

.property-card-compact .property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-card-compact .property-info {
    flex: 1;
    min-width: 0;
}

.property-card-compact .property-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.property-details {
    margin-bottom: 6px;
}

.property-badges {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}

.badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.property-price {
    font-size: 13px;
    color: #d32f2f;
    font-weight: 600;
    margin-bottom: 4px;
}

.property-price .management {
    color: #666;
    font-weight: normal;
}

.property-location {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.view-details {
    color: #1976d2;
    font-size: 12px;
    text-decoration: none;
    font-weight: 500;
}

.view-details:hover {
    text-decoration: underline;
}

/* List Container */
.list-container {
    padding: 20px 25px;
}

.properties-grid {
    display: grid;
    gap: 20px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

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

.no-results h3 {
    font-size: 18px;
    color: #333;
    margin: 0 0 10px 0;
}

.no-results p {
    font-size: 14px;
    margin: 0;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: #f0f0f0;
}

.modal-body {
    padding: 20px 24px;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

.area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.area-item {
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.area-item:hover {
    border-color: #1976d2;
    background: #f8f9ff;
}

.area-item.selected {
    border-color: #1976d2;
    background: #e3f2fd;
}

/* Map Info Window */
.map-info-window {
    max-width: 250px;
}

.map-info-window h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.map-info-window h4 a {
    color: #1976d2;
    text-decoration: none;
}

.map-info-window h4 a:hover {
    text-decoration: underline;
}

/* Pagination */
.pagination-wrapper {
    margin-top: 30px;
    text-align: center;
}

.pagination-wrapper .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination-wrapper .page-numbers:hover,
.pagination-wrapper .page-numbers.current {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .search-layout {
        grid-template-columns: 280px 1fr;
        gap: 20px;
    }
    
    .map-property-list {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .search-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .search-sidebar {
        position: static;
    }
    
    .container-filter-dropdown {
        gap: 12px;
        padding: 15px 20px;
    }
    
    .container-filter-select {
        flex: 1;
        min-width: calc(50% - 6px);
    }
    
    .container-filter-button,
    .container-filter-select-button {
        min-width: 100%;
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .map-container {
        flex-direction: column;
        height: auto;
    }
    
    .google-map {
        height: 400px;
    }
    
    .map-property-list {
        width: 100%;
        height: 300px;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }
    
    .results-header {
        padding: 15px 20px;
    }
    
    .map-list-toggle {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .map-list-toggle i {
        font-size: 14px;
    }
    
    .map-property-list {
        width: 320px;
    }
}

@media (max-width: 480px) {
    .search-main {
        padding: 15px 0;
    }
    
    .search-sidebar,
    .search-content {
        margin: 0 15px;
        border-radius: 8px;
    }
    
    .filter-tabs {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .filter-tab {
        flex: 1;
    }
    
    .map-list-toggle {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .map-property-list {
        width: 280px;
        min-width: 80px;
        text-align: center;
    }
    
    .google-map {
        height: 300px;
    }
    
    .map-property-list {
        height: 250px;
    }
}

/* Animation */
.property-card-compact {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus States for Accessibility */
.location-search-btn:focus,
.station-search-btn:focus,
.search-btn:focus,
.apply-filters-btn:focus,
.toggle-btn:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .filter-tab.active,
    .toggle-btn.active {
        border: 2px solid #000;
    }
    
    .search-btn,
    .apply-filters-btn {
        border: 2px solid #000;
    }
} 