/* =========================================
   1. VARIABILI & RESET
========================================= */
:root {
    --af-dark: #1a1f2c;       /* Antracite Scuro */
    --af-blue: #007bff;       /* Blu Brand */
    --af-blue-hover: #0056b3;
    --af-green: #4ade80;      /* Verde Tecnico */
    --af-steel: #475569;      /* Grigio Acciaio */
    --af-light: #f8fafc;      /* Sfondo Chiaro */
    --text-white: #ffffff;
    --text-dark: #1e293b;
}

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

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--af-light);
}

/* Utility */
.af-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.af-section { padding: 80px 0; } /* Padding standard */
.af-text-center { text-align: center; }

/* Titoli */
.af-section-title {
    font-size: 2.5rem;
    color: var(--af-dark);
    margin-bottom: 15px;
    font-weight: 800;
    text-transform: uppercase;
}
.af-section-title span { color: var(--af-blue); }

.af-section-desc {
    font-size: 1.1rem;
    color: var(--af-steel);
    max-width: 700px;
    margin: 0 auto 50px auto;
}

/* =========================================
   2. HERO SECTION
========================================= */
.af-hero-section {
    position: relative;
    background-color: var(--af-dark);
    
    /* Sfondo PNG tubi */
    background-image: 
        linear-gradient(to right, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.7)),
        url('mes-system-production-control-background.jpg'); 
        
    background-size: cover;
    background-position: center;
    color: white;
    padding: 120px 0;
    overflow: hidden; 
}

.af-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.af-badge {
    background: var(--af-blue);
    color: white;
    padding: 6px 12px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 20px;
}
.af-badge-green { background: var(--af-green); color: #000; }

.af-hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 900;
    margin-bottom: 25px;
}

.af-hero-subtitle {
    font-size: 1.15rem;
    color: #cbd5e1;
    margin-bottom: 35px;
    border-left: 4px solid var(--af-green);
    padding-left: 20px;
    background: rgba(255,255,255,0.05);
    padding: 20px;
}

/* Pulsanti */
.af-btn-group { display: flex; gap: 15px; }

.af-btn {
    padding: 15px 30px;
    text-transform: uppercase;
    font-weight: 700;
    text-decoration: none;
    border-radius: 4px;
    transition: 0.3s;
}
.af-btn-primary { background: var(--af-blue); color: white; }
.af-btn-primary:hover { background: var(--af-blue-hover); transform: translateY(-3px); }

.af-btn-outline { border: 1px solid white; color: white; }
.af-btn-outline:hover { background: rgba(255,255,255,0.1); }

/* --- VISUAL TABLET (GIGANTE 170% FLUTTUANTE) --- */
.af-hero-visual {
    position: relative;
    width: 100%;
    padding-top: 60%; 
    background: transparent; 
    border: none;
    box-shadow: none;
    perspective: 1000px;
    display: block; 
    z-index: 5;
}

.af-tablet-mockup {
    position: absolute;
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* WIDTH 170% */
    width: 170%; 
    max-width: none; 
    height: auto;
    
    border: none; 
    border-radius: 0;
    box-shadow: none; 
    filter: drop-shadow(0 30px 60px rgba(0,0,0,0.7));
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.af-hero-visual:hover .af-tablet-mockup {
    transform: translate(-50%, -55%) scale(1.05) rotateX(2deg);
    filter: drop-shadow(0 60px 90px rgba(0,0,0,0.9));
}


/* =========================================
   3. ARCHITETTURA SECTION
========================================= */
.af-architecture { background: white; }

.af-arch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.af-engine-card {
    background: var(--af-dark);
    color: white;
    padding: 40px;
    border-radius: 6px;
    border-left: 5px solid var(--af-blue);
}
.af-engine-card h3 { font-size: 1.8rem; margin-bottom: 15px; }
.af-engine-card p { opacity: 0.8; margin-bottom: 25px; }

/* Liste con Icone */
.af-check-list { list-style: none; }
.af-check-list li { 
    margin-bottom: 15px; 
    display: flex; 
    align-items: center; 
    font-weight: 500; 
}
.af-list-icon { width: 24px; height: 24px; margin-right: 15px; display: block; }

.af-modules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.af-module-box {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 25px;
    text-align: center;
    transition: 0.3s;
}
.af-module-box:hover { border-color: var(--af-blue); transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.af-module-box h4 { color: var(--af-dark); margin-bottom: 5px; font-weight: 800; }
.af-module-box p { font-size: 0.9rem; color: var(--af-steel); margin: 0; }


/* =========================================
   4. INTEGRAZIONE SECTION
========================================= */
.af-erp-wrapper {
    background: var(--af-dark);
    border-radius: 8px;
    padding: 60px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    color: white;
}

.af-erp-content { flex: 1; min-width: 300px; padding-right: 40px; }
.af-erp-content h2 { font-size: 2rem; margin: 15px 0; }
.af-erp-content p { color: #cbd5e1; margin-bottom: 30px; }

.af-check-list-light { list-style: none; }
.af-check-list-light li { margin-bottom: 15px; display: flex; align-items: center; font-weight: 500; }
.af-list-icon-small { width: 20px; height: 20px; margin-right: 10px; }

.af-erp-visual {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.05);
    padding: 30px;
    border-radius: 8px;
}

.af-sys-box {
    background: white;
    color: var(--af-dark);
    padding: 20px 30px;
    width: 220px;
    text-align: center;
    font-weight: 800;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.af-erp { border-bottom: 4px solid #e11d48; } 
.af-mes { border-bottom: 4px solid var(--af-blue); } 
.af-box-icon { width: 40px; height: 40px; margin-bottom: 10px; }

.af-flow-arrows {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    color: var(--af-green);
    font-family: monospace;
    font-weight: bold;
}
.af-flow-label { margin: 5px 0; }


/* =========================================
   5. FEATURES GRID
========================================= */
/* CORREZIONE SPAZIO BIANCO: Ridotto il padding top per questa sezione */
.af-features {
    padding-top: 10px; 
    padding-bottom: 80px;
}

.af-feat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.af-feat-card {
    background: white;
    padding: 30px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: 0.3s;
    text-align: center;
}
.af-feat-card:hover { border-color: var(--af-blue); transform: translateY(-5px); }

.af-icon-wrapper {
    margin-bottom: 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.af-feat-icon { width: 48px; height: 48px; }

.af-feat-card h3 { margin-bottom: 15px; color: var(--af-dark); }
.af-feat-card p { font-size: 0.95rem; color: var(--af-steel); }

/* --- STILE PER IL BLOCCO ORIZZONTALE (WIDE CARD) --- */

.af-feature-wide-wrapper {
    margin-top: 30px; /* Spazio dalla griglia sopra */
    display: flex;
    justify-content: center;
}

.af-feat-card-wide {
    /* Stessi stili base delle card verticali, ma layout orizzontale */
    display: flex; 
    align-items: center; /* Centra verticalmente icona e testo */
    text-align: left;    /* Testo allineato a sinistra, non al centro */
    
    width: 100%;
    max-width: 900px; /* Non larga come tutto lo schermo, ma più larga delle card singole */
    padding: 40px;
    gap: 30px; /* Spazio tra icona e testo */
    
    /* Manteniamo coerenza con le altre card */
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    transition: 0.3s;
}

.af-feat-card-wide:hover {
    border-color: var(--af-blue);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

/* Gestione icona nella card orizzontale */
.af-icon-wrapper-wide {
    flex-shrink: 0; /* Impedisce all'icona di schiacciarsi */
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.af-wide-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3rem; /* Leggermente più grande per importanza */
    color: var(--af-dark);
}

.af-wide-content p {
    margin: 0;
    color: var(--af-steel);
}

/* ADATTAMENTO MOBILE */
@media (max-width: 768px) {
    .af-feat-card-wide {
        flex-direction: column; /* Torna verticale su mobile */
        text-align: center;
        padding: 30px;
    }
    
    .af-icon-wrapper-wide {
        margin-bottom: 20px;
    }
}

/* =========================================
   6. SECTORS SECTION
========================================= */
.af-sectors {
    background-color: white;
    border-top: 1px solid #e2e8f0;
}

.af-sectors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.af-sector-card {
    background: var(--af-light);
    border: 1px solid #e2e8f0;
    padding: 30px 20px;
    text-align: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: default;
}
.af-sector-card:hover {
    background: white;
    border-color: var(--af-blue);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    transform: translateY(-5px);
}

/* Icone settori */
.af-sector-img { width: 64px; height: 64px; margin: 0 auto 20px auto; display: block; }

.af-sector-card h3 {
    font-size: 1.1rem;
    color: var(--af-dark);
    margin-bottom: 10px;
    font-weight: 700;
}
.af-sector-card p { font-size: 0.9rem; color: var(--af-steel); margin: 0; }


/* =========================================
   7. CONTACT & FOOTER
========================================= */
.af-contact-section {
    background-color: var(--af-dark);
    padding-bottom: 30px;
}

.af-contact-box {
    background: linear-gradient(135deg, var(--af-blue) 0%, var(--af-blue-hover) 100%);
    border-radius: 8px;
    padding: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.af-contact-text { max-width: 700px; }
.af-contact-text h2 { font-size: 2rem; margin-bottom: 15px; color: white; }
.af-contact-text p { font-size: 1.1rem; opacity: 0.9; margin-bottom: 30px; }

.af-contact-details { display: flex; gap: 30px; }
.af-c-item a { color: white; text-decoration: underline; font-weight: bold; }

.af-btn-white {
    background: white;
    color: var(--af-blue);
    padding: 18px 40px;
    font-size: 1rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    display: inline-block;
}
.af-btn-white:hover {
    background: #f8fafc;
    transform: translateY(-3px);
    color: var(--af-blue-hover);
}

.af-footer-bottom {
    text-align: center;
    color: #64748b;
    margin-top: 60px;
    font-size: 0.9rem;
    border-top: 1px solid #334155;
    padding-top: 30px;
}

/* Responsive */
@media (max-width: 900px) {
    .af-hero-grid, .af-arch-grid, .af-erp-wrapper, .af-feat-grid {
        grid-template-columns: 1fr;
    }
    .af-sectors-grid { grid-template-columns: repeat(2, 1fr); }
    
    .af-erp-content { padding-right: 0; margin-bottom: 40px; }
    
    /* Mobile Hero Visual */
    .af-hero-visual { padding-top: 65%; margin-top: 50px; }
    .af-tablet-mockup { width: 110%; }
    
    /* Mobile Footer */
    .af-contact-box { flex-direction: column; text-align: center; padding: 40px 20px; }
    .af-contact-details { flex-direction: column; gap: 10px; margin-bottom: 30px; justify-content: center; }
}

@media (max-width: 600px) {
    .af-sectors-grid { grid-template-columns: 1fr; }
}


/* Impedisce che il menu copra l'inizio delle sezioni quando clicchi un link */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Altezza del tuo menu */
}

.af-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95); /* Bianco leggermente trasparente */
    backdrop-filter: blur(10px); /* Effetto vetro sfocato molto moderno */
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 0;
}

.af-nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.af-nav-menu a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.3s ease;
}

.af-nav-menu a:hover {
    color: #0056b3; /* Il tuo colore blu */
}

.af-btn-nav {
    padding: 8px 20px;
    font-size: 14px;
    background-color: #0056b3;
    color: white;
    border-radius: 4px;
    text-decoration: none;
}

/* Nascondi il menu su mobile se non hai ancora gestito l'hamburger menu */
@media (max-width: 768px) {
    .af-nav-menu {
        display: none;
    }
}


.af-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background-color: #0056b3; /* Il tuo blu aziendale */
    color: white;
    border-radius: 4px; /* Squadrato per stile tecnico, o 50% per tondo */
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 999;
    opacity: 0; /* Invisibile all'inizio */
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.af-back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.af-back-to-top:hover {
    background-color: #004494;
    transform: translateY(-3px);
}




.af-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background-color: #0056b3; /* Il tuo blu aziendale */
    color: white;
    border-radius: 4px; /* Squadrato per stile tecnico, o 50% per tondo */
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 999;
    opacity: 0; /* Invisibile all'inizio */
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.af-back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.af-back-to-top:hover {
    background-color: #004494;
    transform: translateY(-3px);
}



.af-logo img {
    height: 50px;    /* Regola l'altezza come preferisci */
    width: auto;      /* Mantiene le proporzioni corrette */
    display: block;   /* Toglie spazi bianchi indesiderati sotto l'immagine */
    transition: all 0.3s ease; /* Opzionale: lo rende fluido se vuoi animarlo */
}

/* Opzionale: Se vuoi che il logo diventi leggermente più piccolo su mobile */
@media (max-width: 768px) {
    .af-logo img {
        height: 40px;
    }
}