/* Professional Airbnb-style Design */

.simple-search-app {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 24px;
    font-family: Circular, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
    color: #222222;
}

/* Floating Search Bar */
.property-search-box {
    margin: 0 auto 40px;
    background: #ffffff;
    padding: 8px;
    border-radius: 40px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.08);
    border: 1px solid #DDDDDD;
    max-width: 850px;
    transition: box-shadow 0.2s ease;
}

.property-search-box:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.simple-search-form {
    display: flex;
    align-items: center;
    width: 100%;
}

.search-main-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0;
}

/* Individual Search Segments */
.search-main-row .search-field {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 24px;
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    transition: background 0.2s ease;
    cursor: pointer;
}

.search-main-row .search-field:hover {
    background: #EBEBEB;
}

.search-main-row .search-field::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: #DDDDDD;
}

.search-main-row .search-field:last-of-type::after {
    display: none;
}

.search-main-row .search-field i {
    display: none; /* Hide icons to match minimal Airbnb style */
}

.search-main-row .search-field label {
    font-size: 12px;
    font-weight: 800;
    color: #222222;
    margin-bottom: 2px;
}

.search-main-row .search-field input[type="text"] {
    background: transparent;
    padding: 0;
    font-size: 14px;
    color: #222222;
    border: none;
    width: 100%;
    text-overflow: ellipsis;
    cursor: pointer;
    outline: none;
}

.search-main-row .search-field input[type="text"]::placeholder {
    color: #717171;
}

.search-main-row .search-buttons-wrapper {
    display: flex;
    align-items: center;
}

/* Circular Search Button */
.search-main-row button#search-submit {
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    border-radius: 50%;
    background: #FF385C; /* Airbnb Pink */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    border: none;
    cursor: pointer;
}

.search-main-row button.map-view-toggle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    border-radius: 50%;
    background: #222222;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.search-main-row button.map-view-toggle:hover {
    background: #000000;
    transform: scale(1.04);
}

.search-main-row button#search-submit svg,
.search-main-row button.map-view-toggle svg {
    color: #FFFFFF;
    pointer-events: none;
}

.search-main-row button#search-submit span {
    display: none; /* Hide text on search button */
}

/* Results Grid - Airbnb Cards */
.simple-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.simple-results.is-hidden {
    display: none !important;
}

.simple-results.is-visible {
    display: grid !important;
}

.search-result-card {
    background: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-result-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #F7F7F7;
}

.search-result-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 60%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
    pointer-events: none;
}

.search-result-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.search-result-card:hover .search-result-image-wrapper img {
    transform: scale(1.05);
}

.result-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    color: #FFFFFF;
    z-index: 2;
}

.result-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.result-card-title a {
    color: #FFFFFF;
    text-decoration: none;
}

.result-card-meta {
    margin: 4px 0 0;
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.result-card-meta .price {
    font-weight: 800;
    color: #FFFFFF;
    background: none;
    padding: 0;
    font-size: 15px;
}

.result-card-meta .beds {
    background: none;
    padding: 0;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

/* Custom Dropdown Menus (Airbnb Style) */
.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 24px;
    margin-top: 12px;
    padding: 16px 0;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 8px 28px rgba(0,0,0,0.12);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    animation: fadeInScale 0.2s ease-out;
}

.dropdown-item, .location-suggestion-item {
    padding: 12px 24px;
    cursor: pointer !important;
    font-size: 14px;
    color: #222222;
    transition: background 0.2s ease;
    display: flex !important;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1000000;
    pointer-events: auto !important;
}

.dropdown-item:hover, .location-suggestion-item:hover {
    background: #F7F7F7;
}

.dropdown-item i, .location-suggestion-item i {
    color: #717171;
    font-size: 14px;
    width: 20px;
    text-align: center;
    pointer-events: none !important; /* Prevent icons from intercepting clicks/touches */
}

.dropdown-item:hover i, .location-suggestion-item:hover i {
    color: #222222;
}

/* Ensure dropdown items are fully clickable/touchable */
.dropdown-item {
    position: relative;
    z-index: 1;
}

.dropdown-item * {
    pointer-events: none !important; /* All child elements should not intercept events */
}

/* Specific to Location Dropdown */
#location-suggestions {
    width: 120%;
}

/* Dropdown backdrop for mobile bottom sheet */
.dropdown-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99998;
}

.dropdown-backdrop.is-visible {
    display: block;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* View Toggle Button - DEPRECATED (Moved to search bar) */
.view-toggle {
    display: none;
}

.toggle-btn {
    pointer-events: auto;
    background: #222222;
    color: #FFFFFF;
    border-radius: 24px;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), background-color 0.2s ease;
    white-space: nowrap;
}

.toggle-btn:hover {
    background: #000000;
    transform: translateX(0) scale(1.04);
}

.toggle-btn:active {
    transform: translateX(0) scale(0.96);
}

.property-map-container {
    position: relative;
    width: 100%;
}

.property-map-container.is-hidden {
    display: none !important;
}

.property-map-container.is-visible {
    display: block !important;
}

#property-map {
    width: 100%;
    height: 350px !important;
}

@media (min-width: 769px) {
    #property-map {
        height: 500px !important;
    }
}


/* Loading and No Results states */
.property-listings.loading,
.property-listings-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 100px 20px;
    width: 100%;
}

.property-listings-empty p {
    font-size: 18px;
    color: #717171;
    font-weight: 500;
}

.property-listings-empty.mobile-search-prompt {
    padding: 60px 20px;
}

.property-listings-empty.mobile-search-prompt p {
    font-size: 16px;
    color: #555;
    line-height: 1.6;
}

.property-listings.loading {
    color: #FF385C;
}

/* Load More Button */
.load-more-btn {
    background: #222222;
    color: #FFFFFF;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #222222;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.load-more-btn:hover {
    background: #000000;
    transform: scale(1.02);
}

.load-more-btn:active {
    transform: scale(0.98);
}

.property-listings.loading::after {
    content: "";
    display: block;
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FF385C;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@media (max-width: 768px) {
    /* Hide property listings by default on mobile */
    #property-search-app.mobile-view #property-listings.simple-results {
        display: none !important;
    }

    /* Show listings when they have results (is-visible class) */
    #property-search-app.mobile-view #property-listings.simple-results.is-visible {
        display: grid !important;
    }

    .property-search-box {
        border-radius: 24px;
        padding: 12px;
    }
    .search-main-row {
        flex-direction: column;
        align-items: stretch;
    }
    .search-main-row .search-field {
        padding: 12px 16px;
        width: 100%;
        border-bottom: 1px solid #DDDDDD;
        border-radius: 0;
        touch-action: manipulation;
    }

    /* Mobile bottom-sheet dropdown */
    .custom-dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
        margin-top: 0 !important;
        padding: 24px 0 !important;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15) !important;
        max-height: 70vh !important;
        z-index: 99999 !important;
        animation: slideUp 0.25s ease-out !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
        pointer-events: auto !important;
    }

    .dropdown-item, .location-suggestion-item {
        padding: 18px 24px !important;
        font-size: 16px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        pointer-events: auto !important;
        position: relative;
        z-index: 100000;
    }

    .search-main-row button#search-submit,
    .search-main-row button.map-view-toggle {
        touch-action: manipulation;
    }

    .search-main-row .search-field:last-of-type {
        border-bottom: none;
    }
    .search-main-row .search-field::after {
        display: none;
    }
    .search-main-row .search-field:hover {
        background: transparent;
    }
    .search-main-row .search-field label {
        font-size: 11px;
    }
    .search-main-row .search-field input[type="text"] {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .search-main-row .search-buttons-wrapper {
        display: flex;
        justify-content: center;
        gap: 12px;
        margin-top: 12px;
        padding-top: 8px;
        border-top: 1px solid #DDDDDD;
    }

    .search-main-row button#search-submit,
    .search-main-row button.map-view-toggle {
        margin-left: 0;
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
}
