body {
    font-family: 'Roboto', sans-serif; 
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 60px; 
}

body.menu-open {
    overflow: hidden; 
}

h1, h2, h3 {
    font-family: 'Montserrat', sans-serif; 
    color: #222;
    margin-bottom: 10px;
}

p, input, textarea, button {
    font-family: 'Roboto', sans-serif;
    color: #333;
}

header {
    background-color: black;
    color: white;
    padding: 10px 20px;
    height: auto; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000; /* Assicurati che la navbar sia sopra le frecce */
    transition: background-color 0.3s ease; /* Transizione per il cambio di colore */
    flex-wrap: wrap; /* Permetti agli elementi di andare a capo su schermi piccoli */
}

header.scrolled {
    background-color: rgba(17, 17, 17, 0.9); 
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    color: white;
}

header .logo {
    flex-shrink: 0; /* Impedisce al logo di ridimensionarsi */
    height: 40px; /* Altezza del logo */
    width: auto;
    display: block;
}

header .logo img {
    height: 50px; 
    width: auto;
    display: block;
}

header nav {
    text-align: right;
    padding-right: 50px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 15px; 
    padding: 0;
    flex-wrap: wrap; 
    justify-content: flex-end;
}

nav ul li {
    display: inline;
}

nav ul li a {
    text-decoration: none;
    color: white;
    font-weight: bold;
    font-size: 14px; 
    transition: color 0.3s ease;
    white-space: nowrap; /* Evita che il testo vada a capo */
}

nav ul li a:hover {
    color: #ff0000; 
}

#mobile-menu {
    display: none;
}

.sezione-home {
    background-image: url('images/RL-Cars-Home.webp'); /* Usa il formato .webp */
    background-size: cover;
    background-position: center;
    color: white;
    text-align: center;
    padding: 180px 20px; 
}

.sezione-home h2 {
    margin-top: 110px;
    text-align: center;
    color: white;
    font-size: 40px;
}

#contattaci-btn {
    margin-top: 20px;
    background-color: #ff0000;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 25px;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#contattaci-btn:hover {
    background-color: #515151;
    transform: scale(1.05);
}

#contattaci-btn:active {
    transform: scale(0.95);
}

button#contattaci-btn {
    width: 200px; /* Larghezza fissa per evitare variazioni */
    height: 50px; /* Altezza fissa per evitare variazioni */
}

#catalogo {
    padding: 40px 20px;
    text-align: center;
}

#auto-container {
    display: grid; /* Usa un layout a griglia */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Adatta le colonne alla larghezza disponibile */
    gap: 20px; 
    margin-top: 20px;
    justify-items: center;
    min-height: 400px; /* Altezza minima per evitare variazioni di layout */
}

.car-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 250px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.car-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.car-card img, .car-details-images img, .carousel img {
    width: 100%;
    height: 200px; 
    object-fit: cover; 
    object-position: center; 
    border-radius: 10px; 
}

.carousel img {
    width: 100%;
    height: 400px;
    object-fit: cover; 
    border-radius: 10px;
}

.car-details-images img {
    transition: opacity 0.3s ease-in-out; 
}

.features {
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 20px;
    margin-top: 20px;
    text-align: center; 
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px; 
    min-height: 250px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.feature.visible {
    animation: fadeInUp 0.8s ease-out forwards;
}

.feature img {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
}

.feature h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: #333;
    min-height: 50px; 
}

.feature p {
    font-size: 1em;
    color: #666;
    max-width: 600px; 
    margin: 0 auto; 
    min-height: 100px; 
}

.icon {
    display: block;
    margin: 0 auto;
    width: 80px;
    height: 80px;
}

#perche-sceglierci h2 {
    font-size: 2em;
    font-family: 'Montserrat', sans-serif; 
    color: #222;
    text-align: center; 
    margin: 40px 0;
}

#perche-sceglierci p {
    font-size: 1.2em;
    color: #555;
    text-align: center; 
    max-width: 800px;
    margin: 0 auto; 
}

#contatti {
    padding: 40px 20px;
    text-align: center;
}

#whatsapp-form {
    max-width: 400px;
    margin: 0 auto; 
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: left; 
}

#whatsapp-form input, #whatsapp-form textarea, #whatsapp-form button {
    width: calc(100% - 20px); /* Riduci la larghezza per evitare che tocchi i bordi */
    margin: 10px auto;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
    display: block; 
}

#whatsapp-form textarea {
    resize: none; /* Disabilita il ridimensionamento della textarea */
}

#whatsapp-form button {
    background-color: #25d366;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

#whatsapp-form button:hover {
    background-color: #1ebe57;
}

.whatsapp-btn, .call-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center; 
    background-color: #25d366;
    color: white;
    padding: 12px 25px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 10px; 
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 
}

.whatsapp-btn:hover, .call-btn:hover {
    background-color: #1ebe57;
    transform: scale(1.05); 
}

.whatsapp-btn:active, .call-btn:active {
    transform: scale(0.95); 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); 
}

footer {
    background-color: #000;
    color: white;
    text-align: center;
    padding: 20px 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    gap: 20px; 
}

.footer-section {
    flex: 1;
    padding: 20px;
    text-align: left;
}

.footer-section h3 {
    margin-bottom: 10px;
    color: white; 
    font-size: 1.5em;
}

.footer-section p, .footer-section a {
    font-size: 1em; 
    color: #ffffff;
    text-decoration: none;
}

.footer-section a:hover {
    color: #333;
    text-decoration: underline;
}

.footer-bottom p {
    font-family: "Montserrat", sans-serif;
    font-size: 18px;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.footer-bottom p a {
    text-decoration: none;
    font-weight: bold;
    color: #ff0000;
    position: relative;
    transition: all 0.3s ease-in-out;
}

.footer-bottom p a::after {
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    background: red;
    position: absolute;
    left: 0;
    bottom: -5px;
    transform: scaleX(0);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.footer-bottom p a:hover {
    color: #ff4d4d;
    text-shadow: 0 0 10px #ff4d4d, 0 0 20px #ff6666, 0 0 30px #ff9999;
}

.footer-bottom p a:hover::after {
    transform: scaleX(1);
    box-shadow: 0 0 10px #ff0000, 0 0 20px #ff3333, 0 0 30px #ff6666;
}

.map-container iframe {
    width: 100%;
    height: 300px;
    border: 0;
    border-radius: 10px;
}

.map-container {
    text-align: left;
}

.open-maps-btn {
    display: block;
    margin: 10px 0;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    background-color: #ff0000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: left;
}

.open-maps-btn:hover {
    background-color: #515151;
}

.instagram-link {
    font-weight: bold;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); /* Gradiente Instagram */
    -webkit-background-clip: text; 
    background-clip: text;
    -webkit-text-fill-color: transparent; 
    text-decoration: none;
    transition: transform 0.3s ease, text-shadow 0.3s ease; 
}

.instagram-link:hover {
    transform: scale(1.1);
    text-shadow: 0 0 10px rgba(220, 39, 67, 0.8);
}

#carosello {
    padding: 40px 20px;
    text-align: center;
    background-color: #f9f9f9;
}

#carosello h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #222;
}

.carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden; 
    text-align: center; 
    min-height: 300px; /* Altezza minima per evitare variazioni di layout */
}

.carousel {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.slider-image {
    display: none;
    max-width: 100%;
    height: auto;
}

.image-btn {
    position: absolute;
    top: 50%; /* Centrare verticalmente */
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.7); /* Sfondo semi-trasparente */
    color: white;
    border: none;
    padding: 15px;
    cursor: pointer;
    font-size: 18px;
    width: 50px;
    height: 50px;
    z-index: 900; /* Imposta un valore inferiore rispetto alla navbar */
    transition: background-color 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-radius: 0;
}

.image-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

.carousel img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 10px; 
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 18px;
    border-radius: 50%;
    z-index: 1000;
}

.carousel-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

#car-details {
    display: flex;
    flex-wrap: nowrap; 
    gap: 20px; 
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background-color: #f9f9f9;
}

.car-details-images {
    flex: 1;
    max-width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 400px; /* Altezza fissa per tutte le immagini */
    overflow: hidden; /* Evita overflow */
    border-radius: 10px; /* Cornice arrotondata */
    background-color: #f4f4f4; /* Sfondo per immagini mancanti */
}

.car-details-images img {
    width: 100%;
    height: 100%; /* Adatta l'immagine alla cornice */
    object-fit: cover; /* Ritaglia l'immagine per riempire la cornice */
    object-position: center; /* Centra l'immagine */
    border-radius: 10px; /* Cornice arrotondata */
    transition: opacity 0.3s ease-in-out;
}

.back-btn {
    background-color: #ff0000;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 25px;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

@keyframes scrollCarousel {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

@media (max-width: 1200px) {
    #auto-container {
        justify-content: center; 
    }

    .car-card {
        width: 300px; 
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: center;
        padding: 10px;
         /* Rimuove il comportamento fisso della navbar */
    }

    .sezione-home {
        padding: 80px 20px;
        text-align: center;
    }

    .sezione-home h2 {
        font-size: 20px;
    }

    #contattaci-btn {
        padding: 10px 15px;
        width: 100%;
        max-width: 310px;
    }

    #catalogo h2 {
        font-size: 20px;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .feature img {
        width: 60px;
        height: 60px;
    }

    .feature h3 {
        font-size: 1.2em;
    }

    .feature p {
        font-size: 0.9em;
    }

    #auto-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .car-card {
        width: 90%;
        margin: 0 auto;
    }

    .car-card img {
        height: 250px;
    }

    footer {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }

    .footer-section {
        text-align: center;
        margin-bottom: 20px;
        min-height: 150px;
    }

    .map-container {
        min-height: 300px;
    }

    .carousel-container {
        min-height: 200px;
    }

    .carousel img {
        height: 200px;
    }

    .sezione-home h2 {
        font-size: 20px; 
    }

    #whatsapp-form {
    overflow: hidden;
    }

    .footer-content {
        flex-direction: column;
        align-items: center;
    }

    .open-maps-btn {
        display: block; 
        margin: 10px auto; 
        padding: 10px 15px;
        font-size: 14px; 
    }

    nav ul {
        justify-content: center; 
    }
    .logo{
    justify-content: center;
        }
        header nav {
        padding-right: 20px;
        padding-top: 10px;
        }
        
        header nav{
        flex-wrap: wrap;
        flex-direction: column; 
        align-items: center;
    }

    #car-details {
        flex-direction: column; /* Disporre gli elementi in colonna */
        align-items: center; /* Centrare gli elementi */
        padding: 80px 20px;
    }

    .car-details-images {
        max-width: 100%; /* Larghezza massima al 100% */
        height: 300px; /* Altezza fissa per dispositivi mobili */
        margin-bottom: 20px; /* Spazio sotto le immagini */
        position: relative; /* Necessario per posizionare le frecce */
    }

    .car-details-container {
        width: 100%; /* Larghezza massima al 100% */
        text-align: center; /* Centrare il testo */
    }

    .car-details-images img {
        max-width: 100%; /* Larghezza massima al 100% */
        height: 100%; /* Adatta l'immagine alla cornice */
        object-fit: cover; /* Mantieni le proporzioni */
    }

    .image-btn {
        position: absolute;
        top: 50%; /* Centrare verticalmente */
        transform: translateY(-50%);
        background-color: rgba(0, 0, 0, 0.7); /* Sfondo semi-trasparente */
        color: white;
        border: none;
        padding: 10px;
        cursor: pointer;
        font-size: 18px;
        width: 40px;
        height: 40px;
        z-index: 900; /* Imposta un valore inferiore rispetto alla navbar */
        transition: background-color 0.3s ease;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    .image-btn:hover {
        background-color: rgba(0, 0, 0, 0.9);
    }

    .prev-btn {
        left: 10px; /* Posiziona la freccia sinistra sopra l'immagine */
    }

    .next-btn {
        right: 10px; /* Posiziona la freccia destra sopra l'immagine */
    }
}

@media (min-width: 769px) {
    nav#desktop-menu {
        display: flex;
    }
    nav#mobile-menu {
        display: none;
        position: static;
        width: auto;
        height: auto;
        background: none;
        flex-direction: row;
        align-items: center;
        padding: 0;
        transition: none;
    }

    nav#mobile-menu ul {
        display: flex;
        gap: 15px;
    }

    nav#mobile-menu ul li {
        margin: 0;
    }
}

/* Animazioni */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Nuova animazione per "Perché sceglierci?" */
@keyframes fadeInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Applicazione delle animazioni */
.feature, .car-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.feature.visible {
    animation: fadeInUp 0.8s ease-out forwards;
}

.car-card.visible {
    animation: fadeIn 0.8s ease-out forwards;
}


