/*
------------------------------------------------------------------
FORCE ONE LISTING PER ROW
- Override Bootstrap column classes to make listings full-width
- Ensure internal layout is horizontal (image left, text right)
------------------------------------------------------------------
*/

/* Force listing wrappers to be full width regardless of column classes */
#listing_ajax_container > .listing_wrapper,
#listing_ajax_container.row > .listing_wrapper,
.listing_wrapper.col-md-12,
.listing_wrapper.col-md-6,
.listing_wrapper.col-md-4,
.listing_wrapper.col-md-3,
.listing_wrapper.col-lg-6,
.listing_wrapper.col-lg-4,
.listing_wrapper.col-lg-3,
.listing_wrapper.col-sm-6,
.listing_wrapper.col-sm-4,
.listing_wrapper.col-sm-3 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.property_listing {
    display: flex !important;         /* Lays out image wrapper and title container side-by-side */
    flex-direction: row !important;  /* Default, but good to be explicit */
    width: 100% !important;          /* Card takes full available width of its parent content area */
    max-width: 1200px; /* Optional: Set a max-width for the card itself for very wide screens, adjust as needed */
    margin-left: auto; /* Optional: Centers the card if max-width is applied */
    margin-right: auto; /* Optional: Centers the card if max-width is applied */
    margin-bottom: 20px !important;  /* Space between stacked full-width cards */
    box-sizing: border-box !important; /* Ensures padding/border are included in width/height */
}

/* Image wrapper */
.property_listing .listing-unit-img-wrapper {
    flex: 0 0 30% !important; /* Image wrapper takes 30% of the card's width. Adjust as needed (e.g., 200px, 250px, 35%, etc.) */
    /* For a fixed pixel width instead of percentage:
    flex: 0 0 250px !important;
    */
    min-height: 180px; /* Minimum height for the image area, adjust as needed */
    position: relative; /* If you have absolutely positioned elements like "Breakfast2" inside */
    background-color: #f0f0f0; /* Placeholder background if image is missing */
}

.property_listing .listing-unit-img-wrapper img {
    width: 100% !important;
    height: 100% !important; /* Make image fill the wrapper's height */
    object-fit: cover !important; /* Crop image to cover, maintains aspect ratio */
    display: block !important;    /* Removes extra space below image */
}

/* Text content container */
.property_listing .title-container {
    flex: 1 1 auto !important; /* Takes the remaining space, can grow/shrink */
    padding: 15px 20px !important; /* Spacing for text content inside */
    display: flex !important;
    flex-direction: column !important; /* Stack title, details, price, button vertically within this text area */
    box-sizing: border-box !important;
}

/* Ensure text elements within title-container behave well */
.property_listing .title-container > * { /* Target direct children */
    margin-bottom: 10px; /* Example spacing between text elements */
}
.property_listing .title-container > *:last-child {
    margin-bottom: 0; /* No bottom margin for the last element */
}

/* Example styling for a title, description, price, button inside .title-container */
.property_listing .property-title { /* Give your title element a class */
    font-size: 1.2em;
    font-weight: bold;
}
.property_listing .property-description { /* Give your description element a class */
    font-size: 0.9em;
    color: #555;
    flex-grow: 1; /* Allows description to take up available vertical space if needed */
}
.property_listing .property-price { /* Give your price element a class */
    font-size: 1.1em;
    font-weight: bold;
    color: #007bff; /* Example blue */
    margin-top: auto; /* Pushes price and button towards bottom if description is short */
}
.property_listing .btn-details { /* Give your button a class */
    background-color: #007bff; /* Example blue button */
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    align-self: flex-start; /* Button doesn't stretch full width */
    margin-top: 10px; /* Space above the button */
}


/*
------------------------------------------------------------------
RESPONSIVE: SMALL SCREENS (e.g., mobile)
Adjusts the INTERNAL LAYOUT of .property_listing cards to stack.
The card itself remains full width.
------------------------------------------------------------------
*/
@media (max-width: 767px) {
    .property_listing {
        flex-direction: column !important; /* Stack image wrapper and title container */
    }

    .property_listing .listing-unit-img-wrapper {
        flex-basis: auto !important; /* Reset flex-basis from percentage/pixels */
        width: 100% !important;     /* Image wrapper takes full width of the card */
        max-width: none !important;  /* Remove any pixel max-width for stacked layout */
        min-height: 200px; /* Adjust height for stacked images, or use aspect ratio padding trick */
        /* For aspect ratio (e.g., 16:9):
        position: relative;
        padding-top: 56.25%; // 9 / 16 * 100
        height: 0;
        */
    }
    /* If using aspect ratio trick for wrapper, image needs absolute positioning:
    .property_listing .listing-unit-img-wrapper img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    */

    .property_listing .title-container {
        flex-basis: auto !important; /* Reset flex-basis */
        width: 100% !important;
        padding: 15px !important; /* Adjust padding for mobile if needed */
    }

    .property_listing .btn-details { /* Or your button's class */
        align-self: stretch !important; /* Makes button full width on mobile if desired */
    }
}