/* --- 1. VARIABILI E RESET --- */
:root {
    --primary: #0056b3;
    --secondary: #ff6600;
    --text-dark: #222;
    --text-light: #555;
    --white: #fff;
    --bg-grey: #f8f9fa;
    --max-width: 1200px;
    --section-spacing: 80px; /* Variabile unica per controllare tutti i distacchi */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- REGOLE GLOBALI DI SPAZIATURA --- */
h1, h2, h3 {
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

p {
    margin-bottom: 1.2rem;
}

/* Regola Base: Tutte le sezioni hanno lo stesso distacco */
section {
    padding: var(--section-spacing) 0;
}

/* Blocca lo spostamento orizzontale su mobile */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
    width: 100%;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    font-size: 18px;
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* --- 2. COMPONENTI (BOTTONI) --- */
.btn {
    display: inline-block;
    padding: 15px 35px;
    border-radius: 5px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: none;
    text-align: center;
}

.btn:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.btn-primary { background: var(--secondary); color: var(--white); }
.btn-secondary { background: var(--primary); color: var(--white); }
.btn-outline { border: 2px solid var(--white); color: var(--white); }
.btn-outline:hover { background: var(--white); color: var(--primary); }

/* --- 3. HEADER & NAV --- */
.site-header {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 10px 0;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.logo img { height: 60px; width: auto; }

.main-nav ul { display: flex; gap: 30px; }
.main-nav a { font-weight: 600; color: var(--text-dark); }
.main-nav a:hover, .main-nav a.active { color: var(--secondary); }

.cta-header-desktop {
    background: var(--secondary);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
}
.menu-toggle span { width: 25px; height: 3px; background: var(--text-dark); }

/* --- 4. HERO SECTION --- */
.hero-section {
    background-size: cover;
    background-position: center;
    color: var(--white);
    /* Padding specifico per compensare l'header fisso */
    padding: 160px 0 100px 0; 
    text-align: center;
    width: 100%;
}

.hero-content h1 { 
    font-size: 2.8rem; 
    line-height: 1.2; 
    margin-bottom: 20px;
    overflow-wrap: break-word; 
}
.hero-content .highlight { color: var(--secondary); }
.hero-subtitle { font-size: 1.2rem; margin-bottom: 40px; max-width: 800px; margin-inline: auto; }
.hero-buttons { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }

/* --- 5. SEZIONI CONTENT --- */
.features-section, .cases-section { background: var(--bg-grey); }
/* Nota: il padding è gestito dalla regola globale "section" */

.section-title { text-align: center; font-size: 2.2rem; color: var(--primary); margin-bottom: 10px; overflow-wrap: break-word; }

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 50px; 
    max-width: 900px;    
    margin-inline: auto; 
    font-size: 1.1rem;    
    line-height: 1.8;           
}

/* Griglie */
.features-grid, .use-cases-grid, .cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.feature-card, .case-card, .use-case-item {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.feature-card { text-align: center; }
.use-case-item { border-left: 4px solid var(--secondary); }
.case-card { padding: 0; overflow: hidden; }
.case-card img { width: 100%; height: 250px; object-fit: cover; }
.case-info { padding: 20px; }

.image-showcase {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}
.image-showcase img {
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

/* About Flex */
.about-grid { display: flex; align-items: center; gap: 50px; }
.about-image-wrapper, .about-content { flex: 1; }
.about-image-wrapper img { border-radius: 8px; }
.benefit-list li { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; font-weight: 500; }

.text-center-max { text-align: center; max-width: 800px; margin: 0 auto; }

/* FAQ */
.faq-container { max-width: 800px; margin: 0 auto; }
.faq-item { background: var(--white); border: 1px solid #ddd; margin-bottom: 15px; border-radius: 5px; }
.faq-item summary { padding: 20px; font-weight: bold; cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { padding: 0 20px 20px 20px; color: var(--text-light); }

/* --- 6. PAGINA SERVIZI E STRUMENTI --- */
/* Corretto per allinearsi alle altre sezioni */
.intro-services { 
    padding-top: var(--section-spacing); 
    padding-bottom: 40px; /* Un po' meno sotto perché c'è la lista dopo */
}

/* Stili per le righe (Tools) */
.tool-row { 
    display: flex; 
    align-items: center; 
    gap: 50px; 
    margin-bottom: 60px; /* Distanza tra uno strumento e l'altro */
}

/* IMPORTANTE: L'ultimo strumento non deve avere margine sotto, altrimenti il padding raddoppia */
.tool-row:last-child {
    margin-bottom: 0;
}

.tool-row.reverse { flex-direction: row-reverse; }
.tool-image, .tool-text { flex: 1; }
.tool-image img { border-radius: 15px; box-shadow: 0 15px 35px rgba(0,0,0,0.1); width: 100%; }
.tool-tag { background: var(--primary); color: white; padding: 5px 12px; font-size: 0.8rem; font-weight: bold; border-radius: 4px; margin-bottom: 15px; display: inline-block; }
.tool-text h3 { font-size: 2rem; color: var(--primary); margin-bottom: 20px; }
.tool-text li { margin-bottom: 10px; padding-left: 25px; position: relative; }
.tool-text li::before { content: "✔"; color: var(--secondary); position: absolute; left: 0; font-weight: bold; }

/* CTA: Corretta per usare lo stesso padding delle altre sezioni */
.cta-section-simple { 
    padding: var(--section-spacing) 0; 
    text-align: center; 
}
.cta-section-simple p { margin-bottom: 40px; font-size: 1.2rem; }

/* --- 7. FOOTER --- */
.site-footer { background: #1a1a1a; color: #ccc; padding: 60px 0 20px 0; width: 100%; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-col h3 { color: var(--white); margin-bottom: 20px; border-bottom: 2px solid var(--secondary); display: inline-block; padding-bottom: 5px; }
.footer-links li { margin-bottom: 10px; }
.footer-links a:hover { color: var(--secondary); text-decoration: underline; }
.footer-bottom { text-align: center; border-top: 1px solid #333; padding-top: 20px; font-size: 0.9rem; }

/* --- 8. BOTTONE STICKY MOBILE --- */
.btn-sticky-mobile {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--secondary);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

/* --- 9. SEZIONI EXTRA (SEO STORY & CASI STUDIO) --- */
.seo-story-section { background-color: var(--white); }
.story-content { text-align: center; max-width: 900px; margin: 0 auto 60px; }
.story-content h2 { font-size: 2.4rem; color: var(--primary); margin-bottom: 20px; }
.seo-grid-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px; }
.seo-block h3 { font-size: 1.4rem; color: var(--secondary); margin-bottom: 15px; border-bottom: 2px solid var(--bg-grey); padding-bottom: 10px; }
.seo-block p { font-size: 1rem; color: var(--text-light); text-align: justify; }

.story-footer { margin-top: 60px; text-align: center; }
.story-footer blockquote { font-style: italic; font-size: 1.3rem; color: var(--primary); border-left: 5px solid var(--secondary); padding: 20px 40px; background: var(--bg-grey); display: inline-block; border-radius: 0 10px 10px 0; }

/* Casi Studio */
.case-study-item { 
    display: flex; 
    gap: 40px; 
    margin-bottom: 60px; /* Ridotto per coerenza */
    align-items: flex-start; 
    background: var(--white); 
    padding: 30px; 
    border-radius: 12px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); 
}

/* IMPORTANTE: L'ultimo caso studio non deve avere margine sotto */
.case-study-item:last-child {
    margin-bottom: 0;
}

.case-study-image { flex: 1; }
.case-study-image img { border-radius: 8px; width: 100%; }
.case-study-content { flex: 1.5; }
.case-tag { background: var(--bg-grey); color: var(--primary); padding: 4px 12px; font-size: 0.85rem; font-weight: bold; border-radius: 20px; display: inline-block; margin-bottom: 15px; }
.case-study-content h3 { font-size: 1.8rem; color: var(--text-dark); margin-bottom: 20px; }
.case-study-content p { margin-bottom: 15px; }
.case-study-content strong { color: var(--primary); }

/* --- STILE LISTA COMUNI --- */
.lista-comuni {
    margin-top: 20px;
    columns: 1; /* 1 colonna su mobile */
}

@media (min-width: 768px) {
    .lista-comuni {
        columns: 2; /* 2 colonne su desktop e tablet */
    }
}


/* --- 10. MEDIA QUERIES (TUTTO IL MOBILE) --- */
@media (max-width: 900px) {
    .container { padding: 0 15px; }
    
    .menu-toggle { display: flex; }
    .cta-header-desktop { display: none; }
    .btn-sticky-mobile { display: flex; }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--white);
        display: none;
        padding: 20px;
        box-shadow: 0 10px 10px rgba(0,0,0,0.1);
        border-top: 1px solid #eee;
    }
    .main-nav.active { display: block; }
    .main-nav ul { flex-direction: column; align-items: center; gap: 20px; }

    /* Ridimensionamento testi per evitare overflow orizzontale */
    .hero-content h1 { font-size: 1.8rem; }
    .section-title { font-size: 1.8rem; }
    .story-content h2 { font-size: 1.8rem; }
    .tool-text h3 { font-size: 1.6rem; }

    /* Stack verticale per griglie complesse */
    .about-grid, .tool-row, .tool-row.reverse, .case-study-item { 
        flex-direction: column; 
        gap: 30px; 
        text-align: center; 
    }
    
    /* Gestione larghezze mobile */
    .about-image-wrapper { order: -1; width: 100%; }
    .tool-image, .tool-text { width: 100%; }
    .about-content li { justify-content: flex-start; text-align: left; }

    .tool-text ul,
    .lista-comuni { text-align: left; }
    
    /* SEO Block mobile */
    .seo-grid-highlights { gap: 30px; }
    .seo-block p { text-align: left; } /* Meglio left su mobile per leggibilità */
    
    /* Casi Studio mobile */
    .case-study-content h3 { font-size: 1.5rem; }
}

/* --- PAGINA CONTATTI --- */
.contact-section { background-color: var(--white); }
/* Padding ereditato da section globale */

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

/* Colonna Sinistra (Info) */
.contact-info h2 { color: var(--primary); margin-bottom: 20px; }

.info-item {
    margin-top: 30px;
    padding-left: 15px;
    border-left: 3px solid var(--secondary);
}

.info-item h3 { font-size: 1.2rem; margin-bottom: 5px; color: var(--text-dark); }
.contact-link { font-size: 1.3rem; font-weight: bold; color: var(--primary); }
.small-note { font-size: 0.9rem; color: #777; margin-top: 0 !important; }

.btn-whatsapp {
    background-color: #25D366;
    color: white;
    margin-top: 30px;
    width: 100%;
    text-align: center;
}
.btn-whatsapp:hover { background-color: #128C7E; color: white; }

/* Colonna Destra (Form) */
.contact-form-wrapper {
    background: var(--bg-grey);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-dark); }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
    border-color: var(--secondary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.checkbox-group { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; }
.checkbox-group input { width: auto; margin-top: 5px; }
.btn-full { width: 100%; margin-top: 10px; }

/* Messaggi di Stato (JS) */
.form-status { margin-top: 15px; padding: 10px; border-radius: 5px; display: none; text-align: center; font-weight: bold; }
.form-status.success { background-color: #d4edda; color: #155724; display: block; }
.form-status.error { background-color: #f8d7da; color: #721c24; display: block; }

/* Responsive Contatti */
@media (max-width: 900px) {
    .contact-grid { grid-template-columns: 1fr; gap: 40px; }
    .contact-form-wrapper { padding: 25px; }
}

/* --- PAGINE LEGALI (Privacy, Cookie, Termini) --- */
.legal-header {
    background-color: var(--primary);
    color: var(--white);
    padding: 140px 0 60px 0;
    text-align: center;
}

.legal-header h1 { font-size: 2.5rem; margin-bottom: 10px; }
.legal-content { padding: 60px 0; max-width: 900px; margin: 0 auto; }
.legal-content h2 { font-size: 1.5rem; color: var(--primary); margin-top: 30px; margin-bottom: 15px; border-bottom: 1px solid #ddd; padding-bottom: 10px; }
.legal-content h3 { font-size: 1.2rem; color: var(--text-dark); margin-top: 25px; margin-bottom: 10px; }
.legal-content p, .legal-content li { margin-bottom: 15px; font-size: 1rem; color: var(--text-light); text-align: justify; }
.legal-content ul { list-style: disc; padding-left: 20px; margin-bottom: 20px; }
.legal-content a { color: var(--secondary); text-decoration: underline; }

/* --- BOTTONE "TORNA ALLA HOME" (Pagine Legali) --- */
.btn-back-home {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

.btn-back-home span { font-size: 1.2rem; line-height: 1; }
.btn-back-home:hover { color: var(--secondary); transform: translateX(-5px); }

/* Mobile: riduciamo leggermente il logo per farci stare il testo */
@media (max-width: 600px) {
    .btn-back-home { font-size: 0.9rem; }
    .logo img { max-width: 180px; }
}

/* --- COOKIE BANNER --- */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--primary);
    color: white;
    padding: 20px;
    z-index: 9999;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

#cookie-banner.show { transform: translateY(0); }
.cookie-content { max-width: 900px; font-size: 0.9rem; line-height: 1.4; }
.cookie-content a { color: var(--secondary); text-decoration: underline; }
.cookie-buttons { display: flex; gap: 10px; min-width: 250px; }
.btn-cookie-accept { background-color: var(--secondary); color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold; font-size: 0.9rem; }
.btn-cookie-decline { background-color: transparent; border: 1px solid white; color: white; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 0.9rem; }

/* Mobile responsive */
@media (max-width: 768px) {
    #cookie-banner { flex-direction: column; text-align: center; padding: 20px 15px; }
    .cookie-buttons { width: 100%; justify-content: center; }
}

/* --- STILE NUOVA VOCE MENU (Diagnosi Online) --- */
.main-nav a.nav-special {
    background-color: rgba(255, 102, 0, 0.1); /* Sfondo arancione chiarissimo */
    color: var(--secondary) !important; /* Testo Arancione */
    border: 1px solid var(--secondary);
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.main-nav a.nav-special:hover {
    background-color: var(--secondary); /* Diventa tutto arancione al passaggio */
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 102, 0, 0.3);
}

/* Adattamento per Mobile (nel menu a tendina) */
@media (max-width: 900px) {
    .main-nav a.nav-special {
        background-color: var(--secondary);
        color: white !important;
        display: inline-block;
        margin-top: 10px;
    }
}