/* ==========================================================================
   FOGLIO DI STILE GLOBALE UNIFICATO
   ========================================================================== */

/* --- 1. VARIABILI GLOBALI --- */
:root {
    /* Colori Base */
    --verde: #52c133;
    --verde-hover: #52c133;
    --blu: #00538a; /*#3399cc;*/
    --blu-scuro: #00538a;
    --blu-medio: #66b3d9;
    --blu-chiaro: #e6f2f9;
    
    /* Testi e Sfondi */
    --testo-scuro: #333333;
    --testo-chiaro: #ffffff;
    --bianco: #ffffff;
    --sfondo-chiaro: #f4f7f6;
    --sfondo-chiaro-menu: #dcebf7;
    --sfondo-scuro: #ebf2f7;
}

/* --- 2. RESET E IMPOSTAZIONI BASE --- */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--sfondo-chiaro);
    color: var(--testo-scuro);
    display: flex;
    flex-direction: column; /* Impila gli elementi verticalmente */
}

/* Ordinamento semantico blocchi principali */
nav { order: 1; }
header { order: 2; }
main { order: 3; }
footer { order: 4; }

/* Link Base */
a {
    color: var(--verde);
    transition: color 0.3s ease;
    text-decoration: none;
}

a:hover {
    color: var(--blu-scuro);
}

li::marker {
    color: var(--blu);
}

mark {
    background-color: #e0f0fa; 
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Classi di utilità */
.testo-rosso { color: red; }
.testo-centrato { text-align: center !important; }
.chiusura { text-align: center; font-size: 0.8em; }

/* --- 3. LAYOUT STRUTTURALE --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container h2 {
    font-size: 3.5rem;
    color: var(--verde);
    text-align: left;
}

.contenuto-principale {
    padding: 20px;
}

.contenuto-principale h2 {
    text-align: center;
    font-size: 1.5rem;
    color: var(--blu);
    margin-bottom: 40px;
}

.contenuto-principale .colonne {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.contenuto-principale .colonna {
    flex: 1;
    min-width: 250px;
    text-align: justify;
}

.colonna h1 { text-align: left; font-size: 1.5rem; color: var(--blu); margin-bottom: 0; }
.colonna h2 { text-align: left; font-size: 1.3rem; color: var(--blu); margin-bottom: 0; }
.colonna h3 { text-align: left; font-size: 1.1rem; color: var(--blu); margin-bottom: 0; }

/* --- 4. HEADER E MENU DESKTOP --- */
.header-principale {
    background-color: var(--testo-chiaro);
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-principale .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Gestione Logo e Contenitore Banner Desktop */
.nav-secondaria {
    background-color: var(--bianco); /* Ripristinato lo sfondo bianco */
    padding: 10px 0;
    text-align: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--verde);
    text-decoration: none;
}

.logo-principale {
    height: auto;
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 1200px;
}

/* Menu Dropdown Desktop */
.menu-discesa {
    width: 100%;
    font-weight: bold;
    font-size: 1.1rem;
    position: sticky;
    top: 0;
    z-index: 101;
}

.menu-discesa > ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    background-color: var(--blu-scuro);
    box-shadow: 0 16px 8px rgba(0,0,0,0.1);
}

.menu-discesa li { position: relative; }

.menu-discesa > ul > li > a, 
.menu-discesa p {
    display: block;
    padding: 15px 35px;
    text-decoration: none;
    color: var(--bianco);
    background-color: var(--blu-scuro);
    transition: background-color 0.3s ease;
    white-space: nowrap;
    margin: 0;
}

.menu-discesa > ul > li > a:hover, 
.menu-discesa p:hover {
    background-color: var(--verde);
    cursor: pointer;
}

/* Sottomenu (Livello 2 e 3) */
.menu-discesa .sottomenu,
.menu-discesa .sottomenu-livello-3 {
    display: none;
    position: absolute;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 400px;
    background-color: var(--sfondo-chiaro-menu);
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    z-index: 102;
    border-top: 1px solid #eee;
    font-size: 1rem;
}

.menu-discesa > ul > li:hover > .sottomenu {
    display: block;
    top: 100%;
    left: 0;
}

.menu-discesa .sottomenu-livello-3 {
    top: 0;
    left: 100%;
}

.menu-discesa .sottomenu > li:hover > .sottomenu-livello-3 {
    display: block;
}

.menu-discesa .sottomenu li a {
    display: block;
    padding: 10px 20px;
    color: var(--testo-scuro);
    background-color: var(--sfondo-chiaro-menu);
    border-bottom: 1px solid var(--blu-scuro);
}

.menu-discesa .sottomenu li a:hover {
    background-color: var(--verde);
    color: var(--testo-chiaro);
}

.menu-discesa .sottomenu-livello-3 li a {
    background-color: var(--sfondo-scuro);
}

/* Stati Attivi Menu */
.menu-discesa a.active,
.sottomenu a.active,
.menu-discesa p.active {
    background-color: var(--verde) !important;
    color: var(--testo-chiaro) !important;
}

.voce-con-sottomenu-livello-3 > a::after {
    content: " »";
    float: right;
}

/* --- 5. COMPONENTI UI E BOX --- */

/* Modern Box Base */
.modern-p { display: flex; }
.modern-box {
    background-color: #fff;
    border-radius: 30px;
    padding: 1rem;
    max-width: 400px;
    width: 70%;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0 auto;
    font-size: 0.8em;
    border: 1px solid rgba(51, 153, 204, 0.5); 
    box-shadow: 0px 2px 25px rgba(51,153,204, 0.5);
}

.modern-box:hover {
    box-shadow: 24px 24px 48px rgba(163, 177, 198, 0.7), -24px -24px 48px rgba(255, 255, 255, 0.9);
}

.modern-box h2 { font-size: 1.8rem; font-weight: 600; color: #2c3e50; margin: 0 0 1rem 0; }
.modern-box p { font-size: 1rem; color: #000000; line-height: 2; margin-bottom: 0.8rem; }

/* Box Giallo e Grigio */
.box-giallo {
    background-color: #fafac3;
    border: 1px solid var(--blu);
    text-align: center;
    padding: 25px;
}

.box-grigio {
    background-color: #f8f9fa;
    border: 1px solid var(--blu);
    font-size: 1rem;
    padding: 15px;
    border-radius: 18px;
    margin: 15px 0px;
}

/* Call to Action Banner */
.cta-banner {
    background-color: #f8f9fa;
    padding: 30px;
    margin: 40px auto;
    max-width: 900px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    flex-wrap: wrap;
}

.cta-content {
    flex: 1;
    min-width: 0 !important;
    width: 100% !important;
    padding-right: 20px;
}

.cta-content h3 { font-size: 1.5em; margin: 0 0 10px 0; color: #333; }
.cta-content p { margin: 0; color: #666; font-size: 1em; }

.cta-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

/* Pulsanti */
.btn {
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    text-align: center;
    white-space: nowrap;
}

.btn-phone { background-color: white; color: #333; border: 2px solid #333; }
.btn-phone:hover { background-color: var(--verde); color: #ffffff; }

.btn-quote { background-color: var(--blu-scuro); color: #ffffff; border: 2px solid #0056b3; }
.btn-quote:hover { background-color: var(--verde); border: 2px solid #333; color: #ffffff; }

.box-button {
    display: inline-block;
    background-color: var(--verde);
    color: #ffffff;
    padding: 10px 10px;
    margin: 7px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 4px 4px 8px rgba(0, 122, 255, 0.2);
    transition: all 0.3s ease;
}

.box-button:hover {
    background-color: var(--blu);
    color: #ffffff;
}

/* --- 6. GRIGLIE E BOX INTERATTIVI (PAGINA MENU) --- */
.titolo { text-align: center; margin-bottom: 2.5rem; }
.titolo h2 { font-size: 1.7rem; color: var(--blu-scuro); }
.titolo p { font-size: 1.1rem; color: #333; }

.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem; 
}

.menu-box {
    display: block;
    background-color: #f0f8ff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    color: black;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--blu);
}

.menu-box:hover, .menu-box:focus {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    outline: none;
}

.box-title { padding: 1.25rem 1.5rem; color: #ffffff; }
.box-title h3 { margin: 0; font-size: 1.3rem; color: white; }
.box-content { padding: 1.5rem; font-size: 0.95rem; line-height: 1.6; }

/* Colori Titoli Menu Box */
.box-1 .box-title, .box-2 .box-title, .box-3 .box-title, 
.box-4 .box-title, .box-5 .box-title, .box-6 .box-title { background-color: var(--blu-scuro); }
.box-7 .box-title, .box-8 .box-title, .box-9 .box-title { background-color: #bf8bff; }

/* Box Interattivi Advanced */
.container-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.box-interattivo {
    position: relative;
    background-color: var(--bianco);
    border: 2px solid var(--blu-scuro);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    min-height: 220px;
    box-sizing: border-box;
    overflow: hidden;
}

.box-interattivo:hover {
    background-color: var(--blu-chiaro);
    border-color: var(--blu-medio);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.box-interattivo p {
    color: var(--testo-scuro);
    font-size: 1rem;
    margin: 0 0 10px 0;
    position: relative;
    z-index: 2;
}

.box-interattivo a {
    color: var(--blu-scuro);
    font-weight: bold;
    display: inline-block;
    padding-bottom: 4px;
    align-self: center;
    margin-bottom: 15px;
    position: relative;
    z-index: 5;
}

/* Link Stretching per Box Interattivo */
.box-interattivo a::before {
    content: '';
    position: absolute;
    top: -150px; left: -150px; right: -150px; bottom: -150px;
    z-index: 1; 
}

.box-interattivo a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--verde-hover);
    transition: width 0.3s ease-in-out;
    z-index: 2;
}

.box-interattivo:hover a::after { width: 100%; }

.download-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto;
    fill: #cccccc;
    transition: fill 0.3s ease, transform 0.3s ease;
    position: relative;
    z-index: 2;
}

.box-interattivo:hover .download-icon {
    fill: var(--blu-scuro);
    transform: translateY(15px);
}

.action-link {
    font-size: 1rem;       
    color: var(--blu-medio);
    display: inline-block;
    margin-top: 5px;         
}

.box-interattivo:hover .action-link {
    color: var(--verde-hover);
    transition: color 0.3s ease;
}

/* --- 7. EFFETTI SPECIALI (TESTI E LINK) --- */
.animated-underline {
    color: var(--verde);
    position: relative;
    padding-bottom: 5px;
}
.animated-underline::before {
    content: ''; position: absolute; width: 0; height: 2px; bottom: 0; left: 0;
    background-color: var(--blu-scuro); transition: width 0.3s ease-out;
}
.animated-underline:hover::before { width: 100%; }

.color-fade { color: var(--verde); font-size: 1.2em; font-weight: 600; transition: color 0.3s ease; }
.color-fade:hover { color: var(--blu-scuro); }

.button-pop {
    display: inline-block; padding: 10px; margin: 5px;
    background-color: var(--verde); color: white; border-radius: 10px; font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); transition: all 0.3s ease; transform: scale(1);
}
.button-pop:hover {
    background-color: var(--blu-scuro); color: white;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); transform: scale(1.05);
}

.border-bottom-animate {
    color: #196719; position: relative; padding-bottom: 5px;
}
.border-bottom-animate::after {
    content: ''; position: absolute; width: 0; height: 2px; bottom: 0; left: 50%;
    transform: translateX(-50%); background-color: var(--blu-scuro); transition: width 0.3s ease-out;
}
.border-bottom-animate:hover::after { width: 100%; }

.rotate-text {
    color: #2c3e50; font-size: 1.2em; font-weight: 600; display: inline-block; transition: transform 0.2s ease-in-out;
}
.rotate-text:hover { transform: rotate(3deg); color: #e74c3c; }

/* Contenitore e Animazioni */
.content-section {
    padding: 50px 20px; max-width: 960px; margin: 40px auto; background-color: #fff;
    border-radius: 30px; border: 2px solid rgba(0, 83, 138, 1); box-shadow: 0px 2px 25px rgba(0,83,138,0.5); 
}

.fade-in-section {
    padding: 25px 50px 35px 50px; opacity: 0; transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in-section.is-visible { opacity: 1; transform: translateY(0); }

/* --- 8. LISTE E IMMAGINI --- */
.lista a { font-weight: bold; }
.lista-larga li { line-height: 2; }

.lista-foglioline { list-style-type: none; padding-left: 0; counter-reset: item-counter; }
.lista-foglioline li { position: relative; padding-left: 30px; margin-bottom: 10px; }
.lista-foglioline li::before {
    position: absolute; left: 0; top: 4px; content: '';
    background-image: url('/images/foglia.svg'); background-size: 21px 21px; background-repeat: no-repeat; width: 21px; height: 21px;
}

/* FIX CENTRAGGIO DESKTOP */
.contenitore-immagine { max-width: 1200px; display: block; margin: 0 auto; }
.immagine-responsiva { max-width: 100%; }
.imasx img { width: 270px; float: left; margin: 10px; padding-right: 20px; }

/* Image Cards */
.card-container { display: flex; justify-content: center; flex-wrap: wrap; gap: 50px; max-width: 960px; }
.image-card {
    position: relative; width: 280px; height: 250px; margin: 20px 0; border-radius: 10px;
    overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.2); cursor: pointer;
}
.image-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6);
    color: white; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
    opacity: 0; transition: opacity 0.4s ease;
}
.image-card:hover img { transform: scale(1.1); }
.image-card:hover .card-overlay { opacity: 1; }

/* --- 9. FOOTER --- */
.container-footer { max-width: 1150px; height: 30px; margin: 0 auto; }
.container-footer a { color: #FFFFFF; }
.footer {
    background-color: var(--blu); color: var(--testo-chiaro); text-align: center;
    font-size: 0.8rem; padding: 10px 0; margin-top: 30px;
}

/* --- 10. CLASSI DI VISIBILITA' --- */
.desktop-only, .mobile-only { display: none; }
@media (min-width: 768px) { .desktop-only { display: block; } }
@media (max-width: 768px) { .mobile-only { display: block; } }

/* --- 11. MENU MOBILE (HAMBURGER) E MEDIA QUERIES GENERALI --- */

/* Nascondi il menu mobile di default */
.nav-mobile {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 5px 40px;
    background-color: white;
    position: relative;
    margin-bottom: 10px;
}

.mobile-logo-link { display: block; line-height: 0; }
.mobile-logo-img { width: 136px; height: auto; margin: 0; display: block; }

#hamburger-icon { cursor: pointer; display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }
#hamburger-icon .bar { display: block; width: 28px; height: 3px; background-color: var(--blu); transition: all 0.3s ease-in-out; }
#hamburger-icon.attivo .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
#hamburger-icon.attivo .bar:nth-child(2) { opacity: 0; }
#hamburger-icon.attivo .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

#menu-tendina { display: none; position: absolute; top: 100%; left: 0; width: 100%; background-color: #E0FFFF; padding: 10px 0; z-index: 101; }
#menu-tendina.aperto { display: block; }
#menu-tendina ul { list-style: none; padding: 0; margin: 0; text-align: left; }
#menu-tendina li a { display: block; padding: 15px; color: black; border-top: 1px solid #eee; font-weight: 600; }
#menu-tendina li a:hover { background-color: var(--verde); color: white; }

/* Tablet Media Query */
@media (max-width: 992px) {
    .menu-grid { grid-template-columns: repeat(2, 1fr); }
    .container-box { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile Standard (768px) */
@media (max-width: 768px) {
    /* Menu Switch */
    .menu-desktop { display: none !important; }
    .nav-mobile { display: flex !important; }

    /* Componenti Layout */
    .header-principale .container { flex-direction: column; gap: 15px; }
    .banner h1 { font-size: 2.5rem; }
    header h1 { font-size: 2rem; }
    .menu-grid { grid-template-columns: 1fr; }
    
    .logo-principale { width: 136px; margin: 0; float: left; display: inline-block; }

    /* CTA Banner blindata */
    .cta-banner { display: flex; flex-direction: column; width: auto; max-width: 100%; margin: 20px 15px; padding: 5px; text-align: center; align-items: center; height: auto; }
    .cta-content { width: 100%; padding-right: 0; margin-bottom: 20px; word-wrap: break-word; overflow-wrap: break-word; }
    .cta-content h3 { font-size: 1.3em; line-height: 1.3; white-space: normal !important; overflow-wrap: break-word !important; }
    .cta-content p { white-space: normal !important; overflow-wrap: break-word !important; }
    .cta-buttons { width: 100%; flex-direction: column; gap: 10px; margin-top: 0; }
    .btn { width: 100%; display: block; box-sizing: border-box; margin: 0; white-space: normal; }
}

/* Mobile Small (600px) */
@media (max-width: 600px) {
    .container-box { grid-template-columns: 1fr; }
}

/* Mobile Ultra-Small (480px) */
@media screen and (max-width: 480px) {
    .container, .contenuto-principale, .colonna, .content-section, .fade-in-section {
        width: auto !important; 
        max-width: 100% !important;
        min-width: 0 !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
        float: none !important;
    }
}