/* css/search.css */

/* Global Reset for Search Page */
body.search-body {
    background: var(--color-5, #f5f7fa);
    margin: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--color-text);
}

/* Main Container Grid */
.search-page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
    min-height: calc(100vh - 80px); /* minus navbar height */
    
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

@media (min-width: 1024px) {
    .search-page-container {
        display: grid;
        grid-template-columns: 300px 1fr;
        align-items: start; /* extremely important for sticky to work */
    }
}

/* ------------------------------------- */
/* LEFT SIDEBAR (FILTERS)                */
/* ------------------------------------- */

.search-sidebar {
    background: var(--bg-white, #FFFFFF);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    
    /* Sticky magic */
    position: sticky;
    top: 100px; /* offset from navbar */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Sidebar Custom Scrollbar */
.search-sidebar::-webkit-scrollbar {
    width: 6px;
}
.search-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.search-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 10px;
}
.search-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-3);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.filter-section {
    margin-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-md);
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section summary {
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-text);
}

.filter-section summary::-webkit-details-marker {
    display: none;
}

.filter-section summary::after {
    content: '+';
    font-size: 1.2rem;
    color: var(--color-text-muted);
}

.filter-section[open] summary::after {
    content: '-';
}

.filter-options {
    margin-top: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.custom-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9375rem;
    cursor: pointer;
    color: var(--color-text-muted);
}
.custom-label input {
    accent-color: var(--color-3);
}
.custom-label:hover {
    color: var(--color-3);
}

/* ------------------------------------- */
/* RIGHT SIDE (PROPERTIES)               */
/* ------------------------------------- */

.search-results-area {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

#dynamic-search-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Sort Bar */
.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-white);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-4);
    outline: none;
}

/* ------------------------------------- */
/* PROPERTY CARDS (Horizontal Layout)    */
/* ------------------------------------- */

.result-card-hz {
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card-hz:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

@media (min-width: 768px) {
    .result-card-hz {
        flex-direction: row;
        height: 320px; /* Increased height significantly for spacious layout */
    }
}

.result-card-image {
    position: relative;
    width: 100%;
    height: 200px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .result-card-image {
        width: 320px;
        height: 100%;
    }
}

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

.result-badges {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    display: flex;
    gap: var(--space-xs);
}

.result-badges .badge {
    background: var(--color-4);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.result-card-content {
    padding: var(--space-md);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.result-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.result-builder {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 4px 0;
}

.result-location {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-4);
    white-space: nowrap;
}

.result-specs {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-5);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
}

.spec-item {
    display: flex;
    flex-direction: column;
}

.spec-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spec-val {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
}

.result-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.result-amenities {
    flex: 1;
    margin-right: var(--space-md);
}

.card-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-4);
    color: var(--color-4);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-outline:hover {
    background: var(--color-4);
    color: white;
}

.btn-solid {
    background: var(--color-4);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-solid:hover {
    background: var(--color-3);
}