/* ==========================================
   DESIGN SYSTEM: FORMAZIONE E CRESCITA
   ========================================== */
:root {
    --white: #ffffff;
    --blue: #2c3e50;
    --orange: #f39c12;
    --header-h: 80px;
}

/* ==========================================
   1. RESET CORE & TYPOGRAPHY
   ========================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--white); color: var(--blue); font-family: 'Montserrat', sans-serif; line-height: 1.6; overflow-x: hidden; padding-top: var(--header-h); }

/* ==========================================
   2. HEADER & NAVBAR
   ========================================== */
.navbar { position: fixed; top: 0; left: 0; width: 100%; height: var(--header-h); background: var(--white); border-bottom: 3px solid var(--blue); z-index: 1000; }
.nav-container { max-width: 1400px; margin: 0 auto; height: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; }
.nav-logo img { height: 55px; display: block; }
.nav-links { display: flex; align-items: center; gap: 25px; }
.nav-links a.nav-item { text-decoration: none; color: var(--blue); font-weight: 700; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; transition: 0.3s ease; white-space: nowrap; }
.nav-links a.nav-item:hover { color: var(--orange); }

.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; top: 100%; left: 0; background-color: var(--white); min-width: 200px; border: 3px solid var(--blue); border-top: none; z-index: 1001; }
.dropdown-content a { display: block; padding: 15px; margin: 0; border-bottom: 1px solid var(--blue); text-decoration: none; color: var(--blue); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; transition: 0.3s ease; }
.dropdown-content a:hover { color: var(--orange); }
.dropdown-content a:last-child { border-bottom: none; }
.dropdown:hover .dropdown-content { display: block; }

/* ==========================================
   3. ICONE SOCIAL NEL MENU
   ========================================== */
.nav-socials { display: flex; align-items: center; gap: 15px; margin-left: 15px; padding-left: 20px; border-left: 2px solid var(--blue); }
.social-icon { color: var(--blue) !important; font-size: 1.2rem; transition: 0.3s ease; text-decoration: none; }
.social-icon:hover { color: var(--orange) !important; transform: translateY(-3px); }
.mobile-socials { display: flex; gap: 25px; margin-top: 40px; padding-top: 25px; border-top: 2px solid var(--blue); width: 80%; justify-content: center; }
.mobile-socials .social-icon { font-size: 2rem; }

/* ==========================================
   4. HERO SECTION
   ========================================== */
.hero { min-height: calc(100vh - var(--header-h)); display: flex; align-items: center; justify-content: center; text-align: center; background-color: var(--white); }
.hero-box { max-width: 800px; padding: 20px; }
.hero-image img { width: 100%; max-width: 500px; height: auto; margin-bottom: 30px; }
.hero-caption h1 { font-size: clamp(2.5rem, 8vw, 6rem); font-weight: 900; line-height: 0.9; color: var(--blue); text-transform: uppercase; }
.hero-caption span { color: var(--orange); }

/* ==========================================
   5. COMPONENTI GENERICI & LAYOUT
   ========================================== */
.btn-tfg { display: inline-block; margin-top: 40px; padding: 18px 50px; background: var(--orange); color: var(--white); text-decoration: none; font-weight: 900; text-transform: uppercase; border: 4px solid var(--blue); transition: 0.3s; }
.btn-tfg:hover { background: var(--blue); color: var(--orange); transform: translateY(-3px); }
.container { max-width: 1000px; margin: 80px auto; padding: 0 20px; }
.content-block { border: 4px solid var(--blue); padding: clamp(20px, 5vw, 60px); background: var(--white); }
.title-geometric { font-size: 2.5rem; font-weight: 900; text-transform: uppercase; border-bottom: 8px solid var(--orange); display: inline-block; margin-bottom: 40px; color: var(--blue); }

/* ==========================================
   6. STILE FORM GEOMETRICO 
   ========================================== */
.tfg-form-container { width: 100%; background-color: var(--white); position: relative; z-index: 10; }
.form-row { display: flex; align-items: center; margin-bottom: 25px; gap: 20px; }
.form-row label { flex: 0 0 220px; font-weight: 900; text-transform: uppercase; font-size: 0.85rem; color: var(--blue); text-align: right; letter-spacing: 1px; }
.form-control-tfg { flex: 1; padding: 16px; background-color: var(--white); border: 3px solid var(--blue); font-family: 'Montserrat', sans-serif; font-size: 1rem; color: var(--blue); transition: 0.3s ease; width: 100%; }
textarea.form-control-tfg { resize: vertical; height: 150px; }
.form-control-tfg:focus { outline: none; border-color: var(--orange); }
.btn-submit-tfg { display: block; width: 100%; padding: 22px; margin-top: 40px; background-color: var(--orange); color: var(--white); font-family: 'Montserrat', sans-serif; font-weight: 900; text-transform: uppercase; font-size: 1.2rem; letter-spacing: 2px; border: 4px solid var(--blue); cursor: pointer; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-submit-tfg:hover { background-color: var(--blue); color: var(--orange); transform: translateY(-3px); }
.btn-submit-tfg:active { transform: translateY(1px); }

/* ==========================================
   7. PAGINA ERRORE 404
   ========================================== */
.error-404-container { text-align: center; padding: 100px 20px; margin: 80px auto; max-width: 800px; background-color: var(--white); border: 4px solid var(--blue); }
.error-code { font-size: clamp(6rem, 15vw, 12rem); font-weight: 900; color: var(--orange); line-height: 0.8; margin-bottom: 20px; }
.error-title { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 900; color: var(--blue); text-transform: uppercase; margin-bottom: 25px; }
.error-divider { border: 0; border-top: 8px solid var(--blue); width: 100px; margin: 0 auto 30px; }
.error-desc { font-size: 1.1rem; color: var(--blue); margin-bottom: 50px; font-weight: 700; max-width: 500px; margin-left: auto; margin-right: auto; }

/* ==========================================
   8. TABELLE DATI (LISTINO CORSI)
   ========================================== */
.table-wrapper { 
    width: 100%; 
    max-width: 100%; /* Impedisce lo sfondamento del blocco */
    overflow-x: auto; 
    margin-top: 20px; 
    border: 4px solid var(--blue); 
    box-sizing: border-box; /* Cruciale per evitare che il bordo si sommi alla larghezza */
    display: block;
}
.tfg-table { width: 100%; border-collapse: collapse; background: var(--white); min-width: 600px; }
.tfg-table th { background: var(--blue); color: var(--white); padding: 18px 15px; text-align: left; font-weight: 900; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; }
.tfg-table td { padding: 15px; border-bottom: 2px solid #eee; font-size: 0.95rem; color: var(--blue); }
.tfg-table tr:last-child td { border-bottom: none; }

/* Effetto riga cliccabile */
.course-row { cursor: pointer; transition: background-color 0.2s ease; }
.course-row:hover td { background-color: #fff0d4 !important; }

/* ==========================================
   9. MOBILE OVERLAY & HAMBURGER
   ========================================== */
.nav-mobile-btn { display: none; cursor: pointer; }
.nav-mobile-btn span { display: block; width: 30px; height: 4px; background: var(--blue); margin: 6px 0; transition: 0.4s; }
.mobile-overlay { position: fixed; top: var(--header-h); left: 0; width: 100%; height: 0; background: var(--white); z-index: 999; overflow: hidden; transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; align-items: center; visibility: hidden; }
.mobile-overlay.active { height: calc(100vh - var(--header-h)); visibility: visible; padding-top: 50px; border-top: 3px solid var(--blue); }
.mobile-overlay a.nav-item { font-size: 1.8rem; font-weight: 900; color: var(--blue); text-decoration: none; margin-bottom: 25px; text-transform: uppercase; }
.mobile-overlay a.nav-item:hover { color: var(--orange); }

/* ==========================================
   10. FOOTER
   ========================================== */
.footer { padding: 80px 20px; border-top: 5px solid var(--blue); text-align: center; background: var(--white); }
.footer img { height: 70px; margin-bottom: 25px; }
.footer p { font-weight: 700; font-size: 0.9rem; color: var(--blue); }
.admin-link { display: inline-block; margin-top: 30px; color: var(--orange); font-weight: 900; text-decoration: none; font-size: 0.85rem; letter-spacing: 1px; border-bottom: 2px solid transparent; transition: 0.3s; }
.admin-link:hover { border-bottom: 2px solid var(--orange); }

/* ==========================================
   11. FILTRI LISTINO CORSI
   ========================================== */
.course-filters { background: var(--white); border: 4px solid var(--blue); padding: 20px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.filter-search { flex: 1; min-width: 250px; }
.filter-flags { display: flex; gap: 25px; }
.filter-flag-label { display: flex; align-items: center; gap: 10px; font-weight: 900; color: var(--blue); text-transform: uppercase; font-size: 0.85rem; cursor: pointer; }
.filter-flag-label input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--orange); cursor: pointer; }

/* ==========================================
   12. MODALE RICHIESTA INFO
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 10, 0.85);
    z-index: 2000;
    display: none; /* Nascosto di default */
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}
.modal-content {
    background: var(--white);
    border: 6px solid var(--blue);
    padding: 40px;
    width: 100%;
    max-width: 650px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--blue);
    cursor: pointer;
    transition: 0.3s;
    line-height: 1;
}
.modal-close:hover { color: var(--orange); }

/* ==========================================
   13. RESPONSIVE MEDIA QUERIES
   ========================================== */
@media (max-width: 991px) {
    .nav-links { display: none; }
    .nav-mobile-btn { display: block; }
}
@media (max-width: 768px) {
    .hero-image img { max-width: 300px; }
    .hero-caption h1 { font-size: 3.2rem; }
    .title-geometric { font-size: 1.8rem; }
    .form-row { flex-direction: column; align-items: flex-start; gap: 5px; }
    .form-row label { flex: none; width: 100%; text-align: left; }
    .course-filters { flex-direction: column; align-items: stretch; }
    .filter-flags { flex-direction: column; gap: 10px; }
    .modal-content { padding: 25px; }
}

/* ==========================================
   14. QUADROTTI PROMOZIONALI (HOME PAGE)
   ========================================== */
.promo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.promo-card {
    background: var(--white);
    border: 4px solid var(--blue);
    padding: 30px 20px 20px;
    position: relative;
    cursor: pointer;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 8px 0 var(--blue);
    display: flex;
    flex-direction: column;
}

.promo-card:hover {
    transform: translate(-5px, -5px);
    box-shadow: 13px 13px 0 var(--orange);
    border-color: var(--orange);
}

.promo-badge {
    position: absolute;
    top: -15px;
    left: -4px;
    background: var(--orange);
    color: var(--white);
    font-weight: 900;
    font-size: 0.75rem;
    padding: 5px 15px;
    border: 3px solid var(--blue);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.promo-cat {
    font-size: 0.8rem;
    color: #777;
    text-transform: uppercase;
    font-weight: 900;
    margin-bottom: 10px;
}

.promo-title {
    font-size: 1.2rem;
    color: var(--blue);
    font-weight: 900;
    text-transform: uppercase;
    line-height: 1.3;
    margin-bottom: 15px;
    flex-grow: 1; /* Spinge il prezzo in basso se i titoli hanno lunghezze diverse */
}

.promo-durata {
    font-size: 0.85rem;
    color: var(--blue);
    font-weight: 700;
    margin-bottom: 15px;
}

.promo-prezzo {
    font-size: 1.8rem;
    color: var(--orange);
    font-weight: 900;
    border-top: 2px dashed #ddd;
    padding-top: 15px;
    margin-bottom: 20px;
}

.promo-btn {
    background: var(--blue);
    color: var(--white);
    text-align: center;
    padding: 12px;
    font-weight: 900;
    font-size: 0.9rem;
    text-transform: uppercase;
    border: 3px solid var(--blue);
    transition: 0.3s;
}

.promo-card:hover .promo-btn {
    background: var(--orange);
    color: var(--white);
    border-color: var(--orange);
}

/* ==========================================
   15. CATALOGO E-LEARNING (PIATTAFORMA STUDIO)
   ========================================== */
.elearning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}
.elearning-card {
    background: var(--white);
    border: 4px solid var(--blue);
    display: flex;
    flex-direction: column;
    transition: 0.3s;
    box-shadow: 8px 8px 0 var(--blue);
    position: relative;
}
.elearning-card:hover {
    transform: translate(-5px, -5px);
    box-shadow: 13px 13px 0 var(--orange);
    border-color: var(--orange);
}
.elearning-img-box {
    height: 200px;
    background: var(--blue);
    border-bottom: 4px solid var(--blue);
    position: relative;
    overflow: hidden;
}
.elearning-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    transition: 0.5s ease;
}
.elearning-card:hover .elearning-img-box img {
    opacity: 1;
    transform: scale(1.05);
}
.elearning-price {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--orange);
    color: var(--white);
    padding: 5px 15px;
    font-weight: 900;
    border: 3px solid var(--blue);
    font-size: 1.2rem;
}
.elearning-content {
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.elearning-title {
    color: var(--blue);
    font-size: 1.2rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 15px;
    line-height: 1.3;
}
.elearning-desc {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 25px;
    line-height: 1.6;
    flex-grow: 1;
}
.elearning-btn {
    background: var(--blue);
    color: var(--white);
    text-align: center;
    padding: 15px;
    font-weight: 900;
    text-transform: uppercase;
    border: 3px solid var(--blue);
    transition: 0.3s;
    display: block;
    text-decoration: none;
}
.elearning-card:hover .elearning-btn {
    background: var(--orange);
    color: var(--white);
    border-color: var(--orange);
}

/* ==========================================
   OTTIMIZZAZIONE MOBILE (SMARTPHONE E TABLET)
   ========================================== */

@media screen and (max-width: 768px) {
    /* 1. Spaziature Generali */
    .container {
        padding: 15px !important;
        margin-top: 20px !important;
    }
    
    .content-block {
        padding: 20px !important;
    }

    /* 2. Hero Section (Home Page) */
    .hero-box {
        flex-direction: column; /* Incolonna l'immagine e il testo */
        text-align: center;
        padding: 30px 15px;
    }
    
    .hero-image {
        max-width: 70%;
        margin: 0 auto 20px auto;
    }
    
    .hero-caption h1 {
        font-size: 2.2rem;
        line-height: 1.2;
    }
    
    .hero-caption .btn-tfg {
        display: inline-block;
        width: 100%; /* Pulsante a larghezza piena per facilitare il tap */
        margin-top: 10px;
    }

    /* 3. Griglia Promozioni ed E-learning */
    .promo-grid,
    .elearning-grid {
        grid-template-columns: 1fr; /* Una sola colonna su mobile */
        gap: 25px;
    }

    /* 4. Tabelle (Listino Corsi) - Scorrimento Orizzontale */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Scorrimento fluido su iOS */
        border: 1px solid #ddd;
        border-radius: 8px;
        margin-bottom: 20px;
    }
    
    .tfg-table {
        min-width: 600px; /* Forza la tabella a non schiacciarsi, abilitando lo scroll laterale */
    }

    /* 5. Moduli e Modali (Pop-up) */
    .modal-content {
        width: 95%;
        padding: 25px 15px;
        margin: 15% auto;
    }
    
    .form-row {
        flex-direction: column; /* Incolonna le etichette sopra i campi di testo */
        align-items: flex-start !important;
        gap: 5px;
    }
    
    .form-control-tfg {
        width: 100%;
    }

    /* 6. Filtri di Ricerca Listino */
    .course-filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-flags {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    /* 7. Banner Superiore (se attivo) */
    .top-promo-banner {
        font-size: 0.75rem;
        padding: 8px 10px;
        text-align: center;
        flex-wrap: wrap; /* Permette al testo di andare a capo se troppo lungo */
    }
}

/* Ottimizzazioni per schermi piccolissimi (iPhone SE, vecchi Android) */
@media screen and (max-width: 480px) {
    .hero-caption h1 {
        font-size: 1.8rem;
    }
    
    .title-geometric {
        font-size: 1.5rem;
    }
    
    .promo-prezzo {
        font-size: 1.3rem;
    }
}