/* ============================================================
   RICERCA SU MAPPA — ricerca_su_mappa.css
   Prefisso: rsm- (nessuna dipendenza da Bootstrap)
   Compatibile Bootstrap 3 / 4 / 5
   ============================================================ */

#mapsearch {
    margin-top: 20px;
}

#lista_annunci {
    margin-top: 2em;
    margin-bottom: 2em;
}

/* --- Card --- */
.rsm-card {
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 1.5em 0;
    overflow: hidden;
    box-sizing: border-box;
    background: #fff;
}

/* --- Layout orizzontale: immagine | corpo --- */
.rsm-row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
}

/* --- Colonna immagine --- */
.rsm-col-img {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 280px;
    flex: 0 0 280px;
    position: relative;
    overflow: hidden;
}

.rsm-img-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 200px;
}

.rsm-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    /* fallback per browser che non supportano object-fit */
    font-family: 'object-fit: cover';
}

.rsm-img.rsm-img--vertical {
    width: auto;
    max-width: 100%;
    height: 100%;
    margin: 0 auto;
}

/* --- Icona preferiti (sopra l'immagine) --- */
.rsm-preferiti {
    position: absolute;
    top: 0.8em;
    right: 0.8em;
    z-index: 10;
    color: red;
    cursor: pointer;
}

/* --- Colonna corpo --- */
.rsm-col-body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    min-width: 0; /* evita overflow del testo */
}

/* --- Header: prezzo --- */
.rsm-header {
    padding: 15px 15px 0 15px;
}

.rsm-prezzo {
    display: inline-block;
    background-color: rgba(152, 232, 152, 0.467);
    padding: 0.4em 0.6em;
    font-weight: 500;
    font-size: 1.2em;
    border-radius: 4px;
    margin: 0;
}

/* --- Body: titolo + testo --- */
.rsm-body {
    padding: 10px 15px 0 15px;
}

.rsm-title {
    font-size: 1.4em;
    font-weight: normal;
    margin: 0 0 8px 0;
}

.rsm-text {
    font-size: 1em;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 4em;
}

.rsm-divider {
    margin: 10px 0 0 0;
    border: 0;
    border-top: 1px solid #e0e0e0;
}

/* --- Dettagli: mq / bagni / camere --- */
.rsm-details {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 15px 0 15px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.rsm-detail-item {
    font-size: 1em;
    white-space: nowrap;
}

/* --- Footer: pulsante --- */
.rsm-footer {
    padding: 12px 15px 15px 15px;
    margin-top: auto; /* spinge il pulsante in fondo */
}

.rsm-btn {
    display: inline-block;
    padding: 0.5em 1em;
    border-radius: 0.5em;
    background-color: rgba(43, 42, 100, 0.18);
    color: inherit;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.rsm-btn:hover {
    background-color: rgba(43, 42, 100, 0.3);
    color: inherit;
    text-decoration: none;
}

/* --- Contatore risultati --- */
.title-list-annunci h1.tot_risultati {
    font-size: 1.3em;
    margin: 1em 0 0.5em;
}

.listNoFound {
    font-size: 1.2em;
    color: #888;
    margin: 2em 0;
}

/* --- Filtro mappa --- */
#filterMap {
    padding: 2em;
    background-color: lightgrey;
}

/* Normalizza altezza input tra BS3/4/5 */
#filterMap .btn,
#filterMap select,
#filterMap input[type="text"],
#filterMap input[type="number"],
#mq_min, #mq_max, #price_max {
    height: 40px;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
}

/* ============================================================
   MOBILE (< 540px)
   ============================================================ */
@media screen and (max-width: 540px) {

    .rsm-row {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
    }

    .rsm-col-img {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 auto;
        flex: 0 0 auto;
        width: 100%;
        height: 220px;
        min-height: 0;
    }

    .rsm-img-wrap {
        min-height: 0;
        height: 220px;
    }

    .rsm-title {
        font-size: 1.2em;
        font-weight: bold;
    }

    .rsm-prezzo {
        font-size: 1em;
    }

    .rsm-text {
        -webkit-line-clamp: 3;
        max-height: 4.5em;
    }

    .rsm-details {
        -webkit-box-pack: space-around;
        -ms-flex-pack: space-around;
        justify-content: space-around;
    }

    .rsm-detail-item {
        font-size: 13px;
        text-align: center;
    }

    .rsm-btn {
        display: block;
        width: 100%;
        text-align: center;
        text-transform: uppercase;
    }

    #filterMap .btn,
    #filterMap select,
    #filterMap input,
    #mq_min, #mq_max, #price_max {
        height: 50px;
    }

    #OSMdeleteButton {
        margin-top: 10px;
    }
}

/* ============================================================
   TABLET (768px – 900px)
   ============================================================ */
@media screen and (min-width: 768px) and (max-width: 900px) {

    .rsm-col-img {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 220px;
        flex: 0 0 220px;
    }

    .rsm-img-wrap {
        min-height: 240px;
    }

    .rsm-prezzo {
        font-size: 1em;
    }

    .rsm-text {
        -webkit-line-clamp: 2;
    }
}