/* Variabili per colori e spaziatura */
:root {
    --primary-color: #a47864;
    --secondary-color: #333;
    --hover-color: #707070;
    --div-back-color: #e0e0e0;
    --light-gray: #f9f9f9;
    --dark-gray: #ddd;
    --white: #fff;
    --box-shadow: rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-base: 1rem;
    --font-size-lg: 1.1rem;
}

/* Stile globale */
body {
    font-family: var(--font-family) !important;
    background-color: var(--light-gray);
    color: var(--secondary-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--secondary-color);
    color: var(--white);
}

#cookie-banner {
    position: fixed;
    bottom: 0;
    background: #222;
    color: white;
    padding: 1rem;
    width: 100%;
    text-align: center;
    z-index: 9999;
}

#cookie-banner a {
    color: #fff;
    text-decoration: underline;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    width: 200px;
    /* Regola questa dimensione in base al logo */
    height: auto;
    margin-right: 1rem;
}

/* Stili per il menu di navigazione */
nav {
    margin-left: auto;
    /* Spinge il menu a destra */
}

.nav-menu {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    margin: 0 15px;
}

.nav-menu a {
    text-decoration: none;
    color: white;
    /* Colore dei link */
    font-weight: bold;
    padding: 10px;
    transition: color 0.3s;
}

/* Cambia colore dei link al passaggio del mouse */
.nav-menu a:hover {
    color: var(--hover-color);
}

/* MAIN */
main {
    padding: 2rem 2rem;
}

#listings {
    display: flex;
    gap: 2rem;
}

section {
    margin-bottom: 2rem;
}

#home-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.home-card {
    background-color: var(--white);
    border: 1px solid var(--dark-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--box-shadow);
    transition: transform 0.3s, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
}

.home-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.home-card-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.home-card h3 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--secondary-color);
}

/* FAVORITE SECTION */
.div-personal {
    margin-bottom: 2rem;
}

#favorites h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

#favorites-container {
    display: flex;
    overflow-x: auto;
    /* Abilita lo scroll orizzontale */
    gap: 20px;
    /* Spazio tra gli annunci */
    padding: 10px;
}

.favorite-annuncio {
    flex-shrink: 0;
    /* Impedisce agli elementi di ridursi */
    box-sizing: border-box;
    /* Include il padding e il bordo nella larghezza */
    width: 250px;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    background-color: var(--white);
    cursor: pointer;
    align-items: flex-start;
    /* Allinea gli elementi a sinistra */
}

.favorite-annuncio:hover {
    transform: translateY(-8px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.favorite-annuncio-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.favorite-annuncio h3 {
    font-size: 18px;
    margin: 10px 0;
    color: var(--secondary-color);
}

.favorite-annuncio p {
    margin: 5px 0;
}

.remove-favorite {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border: none;
    z-index: 10;
    cursor: pointer;
}


/* ANNUNCI */
#annunci-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.annuncio {
    background-color: var(--white);
    border: 1px solid var(--dark-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--box-shadow);
    transition: transform 0.3s, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
}

#annunci-section {
    flex: 3;
    /* La sezione degli annunci occuperà 3 volte più spazio rispetto ai filtri */
    padding: 1.5rem;
}

.annuncio:hover {
    transform: translateY(-8px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}


.no-images {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.no-images-favorites {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
}

.annuncio-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.annuncio h3 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--secondary-color);
}

.annuncio p {
    font-size: var(--font-size-base);
    color: var(--secondary-color);
}

.most-visited-tag {
    background-color: red;
    /* Colore di sfondo giallo/arancione */
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    position: absolute;
    /* Posiziona sopra l'immagine */
    top: 10px;
    right: 10px;
    font-size: 14px;
    z-index: 10;
    /* Assicurati che il tag stia sopra l'immagine */
}

.price-tag {
    background-color: #008f39;
    /* Colore di sfondo giallo/arancione */
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    position: absolute;
    /* Posiziona sopra l'immagine */
    top: 10px;
    left: 10px;
    font-size: 14px;
    z-index: 10;
    /* Assicurati che il tag stia sopra l'immagine */
}

.category-tag {
    background-color: blue;
    /* Colore di sfondo giallo/arancione */
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    position: absolute;
    /* Posiziona sopra l'immagine */
    bottom: 10px;
    right: 10px;
    font-size: 14px;
    z-index: 10;
    /* Assicurati che il tag stia sopra l'immagine */
}

.favorite-heart {
    cursor: pointer;
    font-size: 24px;
    color: #888;
    transition: color 0.3s ease;
}

.favorite-heart.fas {
    color: red;
    /* Colore dorato per i preferiti */
}

.favorite-heart:hover {
    color: red;
}

.favorite-heart.active {
    color: red;
}

.additional-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    border-top: 1px solid #ccc;
    padding-top: 10px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item i {
    color: #555;
    font-size: 16px;
}

.info-item span {
    font-size: 14px;
    color: #333;
}

.info-item strong {
    width: auto !important;
}

/* FORM COMPILAZIONE */
form {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px var(--box-shadow);
    max-width: 600px;
    margin: 0 auto;
}

form label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

form input,
form textarea {
    width: 90%;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--dark-gray);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    transition: border-color 0.3s ease;
}

form button {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--dark-gray);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    transition: border-color 0.3s ease;
}

form input:focus,
form textarea:focus,
form button:focus {
    outline: none;
    border-color: var(--secondary-color);
}

form button {
    background-color: var(--secondary-color);
    color: var(--white);
    cursor: pointer;
    border: none;
    font-weight: 600;
}

form button:hover {
    background-color: var(--hover-color);
}

/* FOOTER */
footer {
    background-color: var(--secondary-color);
    color: var(--white);
    text-align: center;
    padding: 0.5rem;
    position: relative;
    bottom: 0;
    width: 100%;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
}

.social-icons {
    margin-top: 10px;
}

.social-icon {
    margin: 0 10px;
    font-size: 24px;
    color: white;
    text-decoration: none;
}

.social-icon:hover {
    color: #007bff;
    /* Colore blu su hover, puoi personalizzarlo */
}

/* PERSONAL HTML ELEMENT */
.div-personal {
    padding: 1rem;
    background-color: var(--div-back-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px var(--box-shadow);
}

/*FILTER SECTION*/
#filters {
    position: sticky;
    top: 1rem;
    height: fit-content;
    /* Adatta l'altezza al contenuto */
    align-items: center;
    flex: 1;
    /* Occupazione flessibile della sezione dei filtri */
}

#filters label {
    display: block;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

select {
    width: 100%;
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--dark-gray);
    margin-bottom: 1rem;
}

#filters input {
    width: 60%;
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--dark-gray);
    margin-bottom: 1rem;
}

#filters input:focus,
select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.filter-price-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    /* Spaziatura tra gli elementi */
}

.filter-price-range {
    flex-grow: 1;
    width: 100%;
    margin: 10px 0;
}

.filter-price-value {
    display: inline-block;
    margin-left: 10px;
    font-weight: bold;
    text-align: center;
}

.common-button {
    padding: 1rem 2rem;
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.common-button:hover {
    background-color: var(--hover-color);
}

/* Stili per il modale */
.modal {
    display: none;
    /* Nasconde il modale di default */
    position: fixed;
    z-index: 11;
    /* Assicura che il modale si sovrapponga agli altri elementi */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
    /* Sfondo trasparente */
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 900px;
    border-radius: var(--border-radius);
}

.close-button {
    color: #aaa;
    float: right;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-img {
    width: 100%;
    height: auto;
    margin-top: 20px;
}

.image-tabs {
    display: flex;
    margin-bottom: 15px;
}

.tab-button {
    background-color: #f1f1f1;
    padding: 10px 20px;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 16px;
    flex: 1;
    font-weight: 600;
}

.tab-button:hover {
    background-color: #ddd;
}

.tab-button.active {
    background-color: #ddd;
    border-bottom: 3px solid var(--secondary-color);
}

.share-button {
    background-color: var(--secondary-color);
    /* Colore di sfondo blu */
    color: white;
    /* Colore del testo bianco */
    border: none;
    /* Rimuove il bordo */
    padding: 10px 20px;
    /* Aggiunge padding per la dimensione */
    cursor: pointer;
    /* Cambia il cursore a mano */
    font-size: 16px;
    /* Imposta la dimensione del font */
    border-radius: 5px;
    /* Aggiunge angoli arrotondati */
    margin-top: 20px;
    /* Distanza sopra il pulsante */
    font-weight: 600;
}

.share-button:hover {
    background-color: var(--hover-color);
    /* Colore di sfondo più scuro al passaggio del mouse */
}

.share-button i {
    margin-right: 5px;
    /* Distanza tra l'icona e il testo */
}

.div-column {
    display: flex;
    gap: 20px;
}

.image-container {
    flex: 1;
    max-width: 50%;
    text-align: center;
    margin: 20px 0;
}

.image-container {
    flex: 1;
    max-width: 50%;
    text-align: center;
    margin: 20px 0;
}

.img-detail {
    width: 100% !important;
    border-radius: 8px !important;
}

.carousel {
    flex: 1;
    position: relative;
    max-width: 50%;
    margin: 20px 0;
    overflow: hidden;
    border-radius: 8px;
}

.carousel img {
    width: 100%;
    display: none;
}

.carousel img.active {
    display: block;
}

.carousel .controls {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
}

.carousel .controls button {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
}

.details {
    flex: 2;
    line-height: 1.6;
}

.details strong {
    display: inline-block;
    width: 120px;
}


#map-container {
    height: 100vh;
    width: 100%;
}

.map {
    flex: 2;
    max-width: 100%;
    text-align: center;
    margin: 20px 0;
}

.map iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.pagination {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.pagination button {
    padding: 10px 15px;
    margin: 0 5px;
    border: 1px solid #ddd;
    background-color: #f8f8f8;
    color: #333;
    cursor: pointer;
    border-radius: 3px;
}

.pagination button.active {
    background-color: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
}

.pagination button:hover {
    background-color: var(--hover-color);
    color: #fff;
}

.limited-text {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* MEDIA QUERIES PER VERSIONE MOBILE */
@media (max-width: 768px) {

    /* Header */
    header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .logo {
        width: 150px;
        /* Adatta il logo per schermi piccoli */
    }

    nav {
        margin-top: 1rem;
    }

    .nav-menu {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .nav-menu li {
        margin: 10px 0;
    }

    /* Main */
    main {
        padding: 1rem;
    }

    /* Home Cards */
    #home-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .home-card {
        width: 100%;
        /* Adatta le card a schermi piccoli */
    }

    /* Annunci */
    #annunci-container {
        grid-template-columns: 1fr;
    }

    .annuncio,
    .home-card {
        width: auto;
        padding: 1rem;
    }

    .info-item {
        display: flex;
        align-items: center;
        gap: 3px;
    }

    .annuncio-img,
    .home-card-img {
        height: 200px;
        /* Riduci la dimensione dell'immagine */
    }

    /* Favorites Section */
    #favorites-container {
        flex-direction: column;
        gap: 1rem;
    }

    .favorite-annuncio {
        width: 100%;
        /* Adatta gli annunci preferiti a schermi piccoli */
    }


    #listings {
        display: block;
        gap: 2rem;
    }

    /* Filter Section */
    #filters {
        position: relative;
        /* Rimuove la sticky positioning su schermi piccoli */
        margin-bottom: 1.5rem;
    }

    select,
    #filters input {
        width: 90%;
        padding: 0.75rem;
    }

    /* Footer */
    footer {
        padding: 1rem;
    }

    /* Modal */
    .modal-content {
        width: 90%;
        max-width: 400px;
    }

    /* Details Section */
    .div-column {
        flex-direction: column;
        gap: 1rem;
    }

    .carousel,
    .image-container {
        max-width: 100%;
    }

    /* Map */
    .map iframe {
        height: 200px;
    }

    /* Responsive Buttons */
    .common-button {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }

    /* Social Icons */
    .social-icons {
        margin-top: 1rem;
    }

    .social-icon {
        font-size: 20px;
        margin: 0 5px;
    }

    /* Price Range Filter */
    .filter-price-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-price-value {
        margin-left: 0;
        /* Aggiusta il valore per mobile */
    }

    #map-container {
        height: 50vh;
        width: 100%;
    }
}

@media (max-width: 480px) {

    /* Header Logo */
    .logo {
        width: 120px;
    }

    /* Annunci Images */
    .annuncio-img,
    .home-card-img {
        height: 180px;
    }

    /* Footer Social Icons */
    .social-icon {
        font-size: 18px;
    }

    /* Form Inputs */
    form input,
    form textarea,
    form button {
        padding: 0.8rem;
    }

    /* Modal Content */
    .modal-content {
        width: 95%;
    }

    #map-container {
        height: 50vh;
        width: 100%;
    }
}