/* =========================================








img {
    max-width: 100%;
    height: auto;
}


   1. RESET E IMPOSTAZIONI BASE
   ========================================= */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
    color: #333;
    /* Diamo lo sfondo azzurro "medico" a tutte le pagine di base */
    background-color: #f0f6fa; 
    
    /* IL TRUCCO PER NON AVERE MAI PIÙ SPAZI BIANCHI SOTTO IL FOOTER: */
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Forza il body a essere alto almeno quanto tutto lo schermo */
}
/* =========================================
   2. NAVBAR E HEADER
   ========================================= */
.navbar {
    width: 100%;
    
       background-color: rgba(255, 255, 255, 0.7); 
    
       backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);    
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    
       box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 70px;
}

.logo-wrapper, .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 12px;
}

.logo-img {
    height: 45px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    white-space: nowrap;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

.menu {
    display: flex;
    gap: 20px;
}

.menu a {
    text-decoration: none;
    color: #333333;
    font-size: 15px;
    font-weight: 500;
    position: relative;
    padding: 5px 0;
    white-space: nowrap;
}

.menu a::after {
    content: "";
    width: 0;
    height: 2px;
    background-color: #2c6cff;
    position: absolute;
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease;
}

.menu a:hover::after {
    width: 100%;
}

@media (max-width: 900px) {
    .menu {
        display: none;
    }
}

/* =========================================
   3. BOTTONI GLOBALI E DELLA NAVBAR
   ========================================= */
.nav-btn {
    background-color: #2c6cff;
    color: #ffffff !important;
    padding: 8px 18px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.3s ease;
}

.nav-btn:hover {
    background-color: #1e4fd4;
}

.btn {
    background: #2f5d8c;
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    transition: transform 0.3s ease, background-color 0.3s ease;
    position: relative;
    z-index: 2;
}

.btn:hover {
    transform: scale(1.1); 
    background: #1b4fd1; 
}

.btn-prenota {
    background: #2c6cff;
    color: white;
    padding: 18px 35px;
    font-size: 18px;
    border-radius: 8px;
    text-decoration: none;
    transition: 0.3s;
}

.btn-prenota:hover {
    background: #1b4fd1;
}

/* =========================================
   4. SEZIONE HERO (FOTO PRINCIPALE)
   ========================================= */
.hero {
    /* RIMOSSO: margin-top: 70px; (in questo modo l'immagine parte dalla cima assoluta dello schermo, infilandosi sotto il vetro) */
    
    /* AGGIUNTO: Un padding in alto per evitare che il testo e i bottoni finiscano coperti dalla navbar */
    padding-top: 70px; 
    
    background-image: url('img/hero.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* RIPRISTINATO a 100vh, così occupa tutto lo schermo visibile */
    min-height: 100vh; 
    
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative; 
}
.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.1); 
    z-index: 1; 
    transition: background-color 0.5s ease; 
}

.hero:has(.btn:hover)::before {
    background-color: rgba(0, 0, 0, 0.7); 
}

.hero-text {
    position: relative;
    z-index: 2; 
    color: #ffffff; 
    text-align: center; 
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px; /* Aggiunto respiro tra titolo e paragrafo */
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px; /* Aggiunto respiro tra paragrafo e bottoni */
}

/* =========================================
   5. LAYOUT BASE DELLE SEZIONI
   ========================================= */
.section {
    padding: 80px 40px;
    text-align: center;
}

.light {
    background: #f0f6fa; 
}

.hidden {
    display: none;
}

/* =========================================
   6. GRIGLIA E CARD DEI SERVIZI
   ========================================= */
.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    justify-items: stretch;
}

.service-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
}

.card {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    display: block;
}

.card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.9);
    transition: transform 0.4s ease;
}

.card-content {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 2;
}

.card-content h3 {
    background: rgba(0, 0, 0, 0.65);
    padding: 8px 14px;
    border-radius: 8px;
    margin: 0;
    font-size: 18px;
    color: white; /* Assicura che il testo sia visibile sullo sfondo scuro */
}

.card-content p {
    font-size: 15px;
    color: white; 
}

.card:hover {
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    transform: translateY(-5px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (max-width: 1200px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .cards { grid-template-columns: 1fr; }
}

/* =========================================
   7. PAGINE INTERNE (Servizi HTML)
   ========================================= */
.service-page {
    padding: 100px 20px 80px 20px; 
    display: block; 
    width: 100%;
}

.service-container {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: auto;
    gap: 60px;
}

.service-text {
    flex: 1;
}

.service-text h1 {
    font-size: 40px;
    margin-bottom: 20px;
}

.service-text p {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* =========================================
   SLIDER IMMAGINI (Proporzioni originali e Multi-Fade)
   ========================================= */
.service-slider {
    flex: 1;
    position: relative;
}

.service-slider img {
    width: 100%;
    height: auto; /* Mantiene le proporzioni originali senza tagliare */
    border-radius: 10px;
    opacity: 0; /* Partono invisibili per l'animazione */
}

/* TRUCCO 1: Solo la prima immagine detta l'altezza del contenitore */
.service-slider img:first-child {
    position: relative;
}

/* Le altre immagini si sovrappongono in modo assoluto alla prima */
.service-slider img:not(:first-child) {
    position: absolute;
    top: 0;
    left: 0;
}

/* -----------------------------------------
   CASO 1: Una sola immagine (Nessuna animazione)
   ----------------------------------------- */
.service-slider img:only-child {
    opacity: 1;
    animation: none;
}

/* -----------------------------------------
   CASO 2: Esattamente 2 immagini (Durata totale 8s)
   ----------------------------------------- */
.service-slider img:first-child:nth-last-child(2),
.service-slider img:first-child:nth-last-child(2) ~ img {
    animation: fade2 8s infinite;
}
.service-slider img:first-child:nth-last-child(2) { animation-delay: 0s; }
.service-slider img:first-child:nth-last-child(2) ~ img:nth-child(2) { animation-delay: 4s; }

/* -----------------------------------------
   CASO 3: Esattamente 3 immagini (Durata totale 12s)
   ----------------------------------------- */
.service-slider img:first-child:nth-last-child(3),
.service-slider img:first-child:nth-last-child(3) ~ img {
    animation: fade3 12s infinite;
}
.service-slider img:first-child:nth-last-child(3) { animation-delay: 0s; }
.service-slider img:first-child:nth-last-child(3) ~ img:nth-child(2) { animation-delay: 4s; }
.service-slider img:first-child:nth-last-child(3) ~ img:nth-child(3) { animation-delay: 8s; }

/* -----------------------------------------
   CASO 4: Esattamente 4 immagini (Durata totale 16s)
   ----------------------------------------- */
.service-slider img:first-child:nth-last-child(4),
.service-slider img:first-child:nth-last-child(4) ~ img {
    animation: fade4 16s infinite;
}
.service-slider img:first-child:nth-last-child(4) { animation-delay: 0s; }
.service-slider img:first-child:nth-last-child(4) ~ img:nth-child(2) { animation-delay: 4s; }
.service-slider img:first-child:nth-last-child(4) ~ img:nth-child(3) { animation-delay: 8s; }
.service-slider img:first-child:nth-last-child(4) ~ img:nth-child(4) { animation-delay: 12s; }

/* -----------------------------------------
   KEYFRAMES PER I DIVERSI TEMPI DI FADE
   ----------------------------------------- */
@keyframes fade2 {
    0%   { opacity: 0; }
    15%  { opacity: 1; }
    50%  { opacity: 1; }
    65%  { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes fade3 {
    0%   { opacity: 0; }
    10%  { opacity: 1; }
    33%  { opacity: 1; }
    43%  { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes fade4 {
    0%   { opacity: 0; }
    8%   { opacity: 1; }
    25%  { opacity: 1; }
    33%  { opacity: 0; }
    100% { opacity: 0; }
}

.prenotazione {
    text-align: center;
    padding: 60px 20px;
}

/* =========================================
   8. CHI SIAMO
   ========================================= */
.chi-siamo {
    padding: 100px 20px 80px 20px;
    background-color: transparent;
}

.chi-container {
    max-width: 1200px;
    margin: auto;
    display: flex;
    align-items: center;
    gap: 50px;
}

.chi-testo, .chi-foto {
    flex: 1;
}

.chi-testo h2 {
    font-size: 36px;
    margin-bottom: 25px;
}

.chi-testo p {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.chi-foto.foto-slider {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
}

.chi-foto.foto-slider img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.chi-foto.foto-slider img.active {
    opacity: 1;
}

/* =========================================
   9. MAPPA E GALLERIA
   ========================================= */
.mappa {
    padding: 80px 20px;
    text-align: center;
}

.mappa h2 {
    font-size: 36px;
    margin-bottom: 30px;
}

.mappa-container {
    max-width: 1200px;
    margin: auto;
}

.mappa-container iframe {
    width: 100%;
    border-radius: 12px;
}

.gallery {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.gallery img {
    width: 100%;
    border-radius: 10px;
}

/* =========================================
   10. CONTATTI E FOOTER
   ========================================= */
#contatti {
    /* Il gradiente parte dal colore di base della pagina e si scurisce leggermente */
    background: linear-gradient(to bottom, #f0f6fa 0%, #e1eff8 100%);
    padding: 80px 20px 60px 20px;
    margin-top: auto; 
}

.contatti {
    text-align: center;
    padding: 80px 20px;
}

.contatti h2 {
    font-size: 32px;
    margin-bottom: 20px;
}

.contatti p {
    font-size: 18px;
    margin: 10px 0;
}
#contatti a {
    color: #333333;
    text-decoration: none;
    transition: color 0.3s ease;
}

#contatti a:hover {
    color: #2c6cff; /* Diventa azzurro al passaggio del mouse */
}

footer {
    text-align: center;
    padding: 30px;
    
    /* FONDAMENTALE: Il footer ora ha ESATTAMENTE lo stesso colore di fine gradiente dei contatti */
    background-color: #e1eff8; 
}





/* =========================================
   FIX SOLO PER CELLULARI (INCOLONNAMENTO FORZATO)
   ========================================= */
@media (max-width: 768px) {
    /* 1. Forza il testo e la foto a mettersi uno sotto l'altro */
    .service-container, .chi-container {
        flex-direction: column !important;
        gap: 40px !important;
    }
    
    /* 2. Dà un'altezza fissa alla foto per evitare che invada lo spazio del bottone */
    .service-slider, .chi-foto.foto-slider {
        width: 100% !important;
        height: 300px !important;
        min-height: 300px !important;
        display: block !important;
    }
    
    /* 3. Spinge le pagine in giù per non farle coprire dal menu in alto */
    .service-page, .chi-siamo {
        padding-top: 130px !important;
    }
    
    /* 4. Rende i bottoni facili da cliccare */
    .prenotazione .btn-prenota {
        display: block !important;
        width: 100% !important;
        margin-top: 20px !important;
    }
}

.hero {
        padding-top: 120px !important;
        height: auto !important;
        min-height: 100vh;
        padding-bottom: 50px;
    }

    /* Impila i bottoni della hero uno sotto l'altro in modo ordinato */
    .hero-buttons {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 12px !important;
        align-items: center !important;
    }

    /* Fa in modo che ogni bottone occupino lo spazio giusto senza accavallarsi */
    .hero-buttons .btn {
        width: 85% !important;
        max-width: 300px;
        text-align: center;
    }
}