html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Airbnb-inspired Header */
header {
    background-color: var(--airbnb-white);
    border-bottom: 1px solid var(--airbnb-border);
    padding: 1rem 2rem;
    box-shadow: var(--airbnb-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 60px;
    display: flex;
    align-items: center;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--airbnb-pink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.8rem;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--airbnb-dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 20px;
    transition: var(--airbnb-transition);
}

.user-menu:hover {
    background-color: var(--airbnb-light-gray);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--airbnb-pink);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Main Container */
.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    gap: 0;
    position: relative;
    width: 100%;
    min-height: 600px;
    flex-direction: row;
    flex-wrap: wrap;
}

/* Airbnb-inspired Card Styles */
.filters-container, 
.listings-container {
    background-color: var(--airbnb-white);
    border-radius: 12px;
    box-shadow: var(--airbnb-shadow);
    border: 1px solid var(--airbnb-border);
    transition: var(--airbnb-transition);
}

/* Map Container - Desktop View */
.map-container {
    flex: 1;
    min-height: 450px;
    position: relative;
    overflow: hidden;
    background-color: var(--airbnb-white);
    border-radius: 12px;
    box-shadow: var(--airbnb-shadow);
    border: 1px solid var(--airbnb-border);
    height: 100%;
}

#map {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.filters-container {
    flex: 0 0 300px;
    padding: 1.5rem;
    height: fit-content;
    min-height: 450px;
}

.listings-container {
    flex: 1;
    padding: 0;
    overflow: hidden;
    max-height: 650px;
    display: flex;
    flex-direction: column;
}

.listings-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--airbnb-border);
    background: var(--airbnb-white);
    flex-shrink: 0;
}

.sort-label {
    color: var(--airbnb-gray);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sort-buttons {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sort-btn {
    border: 1px solid var(--airbnb-border);
    background: var(--airbnb-white);
    color: var(--airbnb-dark);
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: var(--airbnb-transition);
}

.sort-btn:hover {
    border-color: var(--airbnb-pink);
    color: var(--airbnb-pink);
}

.sort-btn.active {
    border-color: var(--airbnb-pink);
    color: #9e1a1f;
    background: rgba(255, 90, 95, 0.14);
}

/* Airbnb-inspired Filter Panel */
.filter-controls {
    padding: 0;
}

.filter-controls h3 {
    margin-top: 0;
    color: var(--airbnb-dark);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--airbnb-border);
    letter-spacing: -0.3px;
}

.filter-group {
    margin-bottom: 2.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.2rem;
    background: linear-gradient(135deg, rgba(255, 90, 95, 0.02), rgba(255, 90, 95, 0.01));
    border-radius: 8px;
    border: 1px solid rgba(255, 90, 95, 0.08);
    transition: all 0.2s ease;
}

.filter-group:hover {
    border-color: rgba(255, 90, 95, 0.15);
    background: linear-gradient(135deg, rgba(255, 90, 95, 0.04), rgba(255, 90, 95, 0.02));
}

/* Airbnb-inspired Listing Cards */
.listing {
    padding: 0.85rem 1rem;
    margin-bottom: 0.25rem;
    border: none;
    border-bottom: 1px solid var(--airbnb-border);
    background-color: var(--airbnb-white);
    cursor: pointer;
    transition: var(--airbnb-transition);
    border-radius: 0;
}

.listing:hover {
    background-color: var(--airbnb-light-gray);
    transform: translateY(0);
    box-shadow: none;
}

.listing h3 {
    margin-top: 0;
    color: var(--airbnb-dark);
    font-size: 0.98rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.listing p {
    margin: 0.2rem 0;
    color: var(--airbnb-gray);
    font-size: 0.84rem;
    line-height: 1.4;
}

.address {
    font-style: normal;
    color: var(--airbnb-gray);
    font-size: 0.82rem;
    margin: 0.2rem 0;
}

/* Pricing Section */
.pricing {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--airbnb-border);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    align-items: center;
    gap: 0.25rem 0.4rem;
    font-weight: 500;
    font-size: 0.82rem;
}

.monthly {
    color: #9e1a1f;
    background: rgba(255, 90, 95, 0.14);
    border: 1px solid rgba(255, 90, 95, 0.35);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    font-weight: 700;
    white-space: nowrap;
}

.single-pass {
    color: var(--airbnb-dark);
    background: rgba(72, 72, 72, 0.08);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.gym-url {
    background: rgba(0, 132, 137, 0.12);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    font-weight: 600;
    white-space: nowrap;
    grid-column: 1 / -1;
    justify-self: start;
}

.gym-url a {
    color: #006c70;
    text-decoration: none;
}

.gym-url a:hover {
    text-decoration: underline;
}

.price-updated {
    color: var(--airbnb-gray);
    font-size: 0.75rem;
    font-weight: 500;
    grid-column: 1 / -1;
    line-height: 1.2;
}

.distance-away {
    color: #006c70;
    font-size: 0.75rem;
    font-weight: 600;
    grid-column: 1 / -1;
    line-height: 1.2;
}

/* Listings Header */
.listings-container h2 {
    padding: 1.5rem 1.5rem 1rem;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--airbnb-dark);
    border-bottom: 1px solid var(--airbnb-border);
    flex-shrink: 0;
}

#gym-listings {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Mobile filter toggle button styling */
.filter-toggle-btn {
    padding: 0.8rem 1.5rem;
    background-color: var(--airbnb-pink);
    color: var(--airbnb-white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--airbnb-transition);
}

.filter-toggle-btn:hover {
    background-color: #FF4040;
}

/* View toggle button styling */
.view-toggle-btn {
    padding: 0.8rem 1.5rem;
    background-color: var(--airbnb-pink);
    color: var(--airbnb-white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--airbnb-transition);
}

.view-toggle-btn:hover {
    background-color: #FF4040;
}

/* Airbnb-inspired Buttons */
.filter-buttons {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--airbnb-transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--airbnb-pink);
    color: var(--airbnb-white);
}

.btn-primary:hover {
    background-color: #FF4040;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--airbnb-white);
    color: var(--airbnb-dark);
    border: 2px solid var(--airbnb-border);
}

.btn-secondary:hover {
    border-color: var(--airbnb-pink);
    color: var(--airbnb-pink);
}

#reset-filters {
    width: 100%;
}

/* Filter Status */
#filter-status {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--airbnb-gray);
    min-height: 1.2rem;
    padding: 0.5rem;
    background-color: var(--airbnb-light-gray);
    border-radius: 8px;
    text-align: center;
}

/* Airbnb-inspired Footer */
footer {
    margin-top: 3rem;
    padding: 2rem 1rem;
    background-color: var(--airbnb-white);
    border-top: 1px solid var(--airbnb-border);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.footer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.footer-brand {
    flex: 1;
}

.footer-brand h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--airbnb-pink);
    margin-bottom: 0.5rem;
}

.footer-links {
    display: flex;
    gap: 3rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--airbnb-dark);
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--airbnb-gray);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--airbnb-transition);
}

.footer-section a:hover {
    color: var(--airbnb-pink);
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--airbnb-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--airbnb-gray);
}


/* Responsive layout for tablets and desktop (768px and above) */
@media (min-width: 768px) {
    .container {
        flex-direction: column; /* Stack vertically */
        flex-wrap: wrap;
        /*height: 100vh;*/
    }
    
    /* Map and listings row */
    .map-and-listings {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
        height: calc(100vh - 140px); /* Full height minus header and some padding */
    }
    
    .filters-container {
        display: none; /* Hide filters by default */
        width: 100%;
    }
    
    .filters-container.visible {
        display: block; /* Show filters when visible class is added */
    }
    
    .map-container {
        flex: 1;
        min-width: 300px;
        min-height: 500px;
        order: 1;
        height: 100%;
        position: relative;
    }
    
    .listings-container {
        flex: 1;
        min-width: 300px;
        min-height: 500px;
        order: 2;
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: none;
    }
    
    /* Ensure map takes full height */
    #map {
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }
    
    #gym-listings {
        overflow-y: auto;
        flex: 1;
    }
    
    /* Desktop/Tablet filter button (fixed bottom, like mobile) */
    .desktop-filter-btn {
        display: block;
        position: fixed;
        bottom: 16px;
        left: 16px;
        right: 16px;
        transform: none;
        padding: 0.9rem 1.5rem;
        background-color: var(--airbnb-pink);
        color: var(--airbnb-white);
        border: none;
        border-radius: 12px;
        font-weight: 600;
        font-size: 0.95rem;
        cursor: pointer;
        transition: var(--airbnb-transition);
        z-index: 101;
        box-shadow: var(--airbnb-shadow);
    }
    
    .desktop-filter-btn:hover {
        background-color: #FF4040;
    }
    
    /* Filters container positioning for all views */
    .filters-container.visible {
        display: block;
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        height: 75vh;
        z-index: 1000;
        background-color: var(--airbnb-white);
        overflow-y: auto;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
        transform: translateY(0);
        transition: transform 0.3s ease;
    }
    
    /* Filters container hidden state */
    .filters-container {
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    /* Backdrop for desktop/tablet */
    .filters-backdrop.visible {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0;
        flex-direction: column;
        gap: 0;
        margin: 0;
        position: relative;
        height: calc(100vh - 60px); /* Full height minus header (60px) */
        width: 100%;
    }
    
    /* Hide desktop filter button on mobile */
    .desktop-filter-btn {
        display: none !important;
    }
    
    .map-and-listings {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    .map-container {
        width: 100%;
        height: 100%;
        min-height: 200px;
        order: 1;
        position: relative;
        overflow: hidden;
    }
    
    #map {
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }
    
    /* Remove any max-height restrictions */
    .map-container, #map {
        max-height: none;
    }
    
    .listings-container {
        position: fixed;
        top: auto;
        bottom: 60px; /* Account for mobile controls */
        left: 0;
        right: 0;
        width: 100%;
        height: calc(100vh - 60px - 60px); /* Full height minus header and controls */
        max-height: calc(100vh - 60px - 60px);
        flex: none;
        order: 2;
        display: none;
        flex-direction: column;
        z-index: 100;
        background: var(--airbnb-white);
        border-radius: 0;
    }
    
    /* On mobile, hide filters by default */
    .filters-container {
        display: block;
        transform: translateY(100%);
    }
    
    /* Show filters when visible class is added */
    .filters-container.visible {
        display: block;
        transform: translateY(0);
    }
    
    /* On mobile, ensure map is visible by default */
    .map-container {
        display: block;
    }
    
    .listings-container.visible {
        display: flex;
    }

    .listings-toolbar {
        padding: 0.6rem 0.75rem;
    }

    .sort-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .map-container.hidden {
        display: none;
    }
    
    /* Mobile controls should always be visible */
    .mobile-controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 101;
        display: flex;
        gap: 0.8rem;
        padding: 0.8rem;
        background-color: var(--airbnb-white);
        border-top: 1px solid var(--airbnb-border);
        justify-content: center;
    }
    
    /* Overlay backdrop for filters modal */
    .filters-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        pointer-events: none;
    }
    
    .filters-backdrop.visible {
        display: block;
        pointer-events: auto;
    }
    
    .filters-container {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 75vh;
        border-radius: 16px 16px 0 0;
        padding: 1.5rem;
        z-index: 1001;
        overflow-y: auto;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
        transform: translateY(100%);
        transition: transform 0.3s ease;
        pointer-events: auto;
    }
    
    .filters-container.visible {
        transform: translateY(0);
    }
    
    .filter-toggle-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--airbnb-dark);
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .filter-controls {
        padding-top: 2rem;
    }
    
    header {
        padding: 0.5rem 1rem;
        height: 60px;
    }
    
    h1 {
        font-size: 1.2rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .logo-icon {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0;
        height: calc(100dvh - 60px);
    }

    .listings-container {
        height: calc(100dvh - 60px - 60px);
        max-height: calc(100dvh - 60px - 60px);
    }
    
    .filters-container {
        max-height: 80vh;
    }
    
    .logo span {
        display: none;
    }
}
