/* ==========================================================================
   Guesty Search Results Page
   ========================================================================== */

.guesty-sr {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Hero spacer under sticky header */
.guesty-sr-hero {
    flex: 0 0 120px;
    background: url('../images/results-hero.jpg') center/cover no-repeat;
    background-color: #1a1a2e;
}

/* Search Bar + Count (fixed top, does not scroll) */
.guesty-sr-search-bar {
    flex: 0 0 auto;
    background: #f8f8f8;
    padding: 1rem 1.5rem;
}

.guesty-sr-search-bar .guesty-search-form {
    background: transparent;
}

.guesty-sr-search-bar .guesty-sr-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    margin-top: 0.75rem;
}

/* Results Layout */
.guesty-sr-content {
    display: flex;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.guesty-sr-listings {
    flex: 0 0 60%;
    max-width: 60%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.guesty-sr-results {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.guesty-sr-results-inner {
    padding: 1.5rem;
    flex: 1 0 auto;
}

/* Footer always at bottom of scroll */
.guesty-sr-results > footer,
.guesty-sr-results > .site-footer,
.guesty-sr-results > #footer {
    flex-shrink: 0;
}

.guesty-sr-map {
    flex: 0 0 40%;
    max-width: 40%;
}

.guesty-sr-map #guesty-results-map {
    width: 100%;
    height: 100%;
}

/* Results Header */
.guesty-sr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guesty-sr-count {
    font-size: 14px;
    color: #666;
}

.guesty-sr-dates {
    font-size: 13px;
    color: #999;
}

/* Property Grid */
.guesty-sr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

/* Property Card */
.guesty-sr-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.guesty-sr-card:hover,
.guesty-sr-card.guesty-sr-card--active {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.guesty-sr-card.guesty-sr-card--highlighted {
    box-shadow: 0 0 0 3px #c9a962, 0 4px 16px rgba(0, 0, 0, 0.15);
}

.guesty-sr-card-image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    position: relative;
}

.guesty-sr-card-price {
    position: absolute;
    bottom: 0.625rem;
    left: 0.625rem;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.guesty-sr-card-price small {
    font-weight: 400;
    opacity: 0.8;
}

.guesty-sr-card-body {
    padding: 0.875rem;
}

.guesty-sr-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.guesty-sr-card-title a {
    color: inherit;
    text-decoration: none;
}

.guesty-sr-card-title a:hover {
    color: #c9a962;
}

.guesty-sr-card-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.guesty-sr-card-details span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.guesty-sr-card-details svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.guesty-sr-card-amenities {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.guesty-sr-card-amenity {
    font-size: 11px;
    background: #f5f5f5;
    color: #666;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

/* Map Price Markers */
.guesty-map-marker {
    background: #fff;
    border: 2px solid #333;
    border-radius: 20px;
    padding: 0.25rem 0.625rem;
    font-size: 12px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    text-align: center;
    line-height: 1.2;
    will-change: transform;
}

.guesty-map-marker:hover,
.guesty-map-marker--active {
    background: #c9a962;
    border-color: #c9a962;
    color: #fff;
    transform: scale(1.1);
    z-index: 10 !important;
}

/* Map Info Window */
.guesty-map-infowindow {
    max-width: 220px;
    font-family: inherit;
}

.guesty-map-infowindow img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

.guesty-map-infowindow h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #333;
}

.guesty-map-infowindow p {
    font-size: 12px;
    color: #666;
    margin: 0;
}

/* No Results */
.guesty-sr-no-results {
    text-align: center;
    padding: 3.75rem 1.5rem;
    grid-column: 1 / -1;
}

.guesty-sr-no-results p {
    font-size: 16px;
    color: #666;
    margin: 0 0 8px;
}

/* Loading */
.guesty-sr-loading {
    text-align: center;
    padding: 3.75rem 1.5rem;
    grid-column: 1 / -1;
}

.guesty-sr-loading::after {
    content: '';
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #c9a962;
    border-radius: 50%;
    animation: guesty-spin 0.6s linear infinite;
}

@keyframes guesty-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Mobile Controls
   ========================================================================== */

/* Hidden on desktop */
.guesty-sr-mobile-bar {
    display: none;
}

.guesty-sr-filters-modal {
    display: none;
}

/* ==========================================================================
   Body & Footer
   ========================================================================== */

/* Prevent body scroll — listings panel scrolls internally */
body:has(.guesty-sr) {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Let .guesty-sr fill remaining space after site header */
body:has(.guesty-sr) .guesty-sr {
    flex: 1 1 auto;
    min-height: 0;
}

/* Footer relocated into listings scroll via JS */
.guesty-sr + footer,
.guesty-sr ~ footer,
.guesty-sr ~ .site-footer,
.guesty-sr ~ #footer {
    margin-top: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 992px) {
    .guesty-sr-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Mobile bar visible */
    .guesty-sr-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem 1rem;
        background: #fff;
        border-bottom: 1px solid #eee;
        flex: 0 0 auto;
    }

    /* Filters button */
    .guesty-sr-mobile-filters {
        display: flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.5rem 0.75rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        background: #fff;
        font-size: 13px;
        font-weight: 600;
        color: #333;
        cursor: pointer;
    }

    .guesty-sr-mobile-filters:active {
        background: #f5f5f5;
    }

    /* List / Map toggle */
    .guesty-sr-mobile-toggle {
        display: flex;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
    }

    .guesty-sr-toggle-btn {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.5rem 0.75rem;
        border: none;
        background: #fff;
        font-size: 13px;
        font-weight: 600;
        color: #666;
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
    }

    .guesty-sr-toggle-btn + .guesty-sr-toggle-btn {
        border-left: 1px solid #ddd;
    }

    .guesty-sr-toggle-btn--active {
        background: #333;
        color: #fff;
    }

    /* Filters modal */
    .guesty-sr-filters-modal {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 9999;
    }

    .guesty-sr-filters-modal[aria-hidden="false"] {
        display: flex;
        align-items: flex-end;
        justify-content: center;
    }

    .guesty-sr-filters-modal-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
    }

    .guesty-sr-filters-modal-content {
        position: relative;
        width: 100%;
        max-height: 85vh;
        background: #fff;
        border-radius: 1rem 1rem 0 0;
        overflow-y: auto;
        z-index: 1;
        animation: guesty-slide-up 0.25s ease-out;
    }

    @keyframes guesty-slide-up {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .guesty-sr-filters-modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.25rem;
        border-bottom: 1px solid #eee;
    }

    .guesty-sr-filters-modal-header h3 {
        margin: 0;
        font-size: 1rem;
        font-weight: 700;
        color: #333;
    }

    .guesty-sr-filters-close {
        border: none;
        background: none;
        font-size: 1.5rem;
        color: #666;
        cursor: pointer;
        padding: 0;
        line-height: 1;
    }

    .guesty-sr-filters-modal-body {
        padding: 1.25rem;
    }

    .guesty-sr-filters-modal-body .guesty-search-form {
        flex-direction: column;
        box-shadow: none;
        padding: 0;
        background: transparent;
    }

    .guesty-sr-filters-modal-body .guesty-search-field {
        min-width: 100%;
    }

    .guesty-sr-filters-modal-body .guesty-search-submit {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Hide desktop search bar and hero on mobile */
    .guesty-sr-search-bar {
        display: none;
    }

    .guesty-sr-hero {
        flex: 0 0 70px;
    }

    /* Layout: full viewport, flex column */
    .guesty-sr-content {
        flex-direction: column;
        min-height: 0;
    }

    .guesty-sr-listings {
        flex: 1 1 auto;
        max-width: 100%;
    }

    .guesty-sr-results {
        overflow-y: auto;
    }

    /* Map: hidden by default, full height when active */
    .guesty-sr-map {
        flex: none;
        max-width: 100%;
        position: relative;
        height: 0;
        overflow: hidden;
        order: -1;
        transition: height 0.25s ease;
    }

    /* When map view is active */
    .guesty-sr--map-view .guesty-sr-map {
        flex: 1 1 auto;
        height: auto;
    }

    .guesty-sr--map-view .guesty-sr-listings {
        display: none;
    }
}

@media (max-width: 768px) {
    .guesty-sr-grid {
        grid-template-columns: 1fr;
    }

    .guesty-sr-results-inner {
        padding: 1rem;
    }
}
