/* ===== Base (come style.css) ===== */
:root {
    --rosso: #a72626;
    --oro: #FFD700;
    --header-h: 110px; /* aggiornata dallo script con l'altezza reale dell'header */
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: var(--header-h); }

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    font-family: Arial, Montserrat, sans-serif;
    display: flex;
    overflow-x: hidden;
    background-color: #f4f4f4;
    background-image: linear-gradient(to bottom right, black, red, black, red);
    background-attachment: fixed;
}

/* spazio sotto l'header fisso (classe aggiunta dallo script) */
body.pagina-interna { padding-top: var(--header-h); }

img, video { max-width: 100%; height: auto; }

.site-header a { color: inherit; text-decoration: none; }

/* ===== HEADER FISSO (barra contatti + menu), identico a index.php ===== */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}

.site-header::before,
.site-header::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    transition: opacity .35s ease;
}

/* colorazione piena: appare allo scroll */
.site-header::before { background: linear-gradient(135deg, #000, #c00 50%, #000); opacity: 0; }
/* velo scuro leggero in alto: sparisce allo scroll */
.site-header::after { background: linear-gradient(rgba(0, 0, 0, .65), rgba(0, 0, 0, 0)); }

.site-header.scrolled::before,
.site-header.menu-open::before { opacity: 1; }
.site-header.scrolled::after,
.site-header.menu-open::after { opacity: 0; }
.site-header.scrolled { box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }

.barra_contenitore {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 16px;
    padding: 6px clamp(12px, 3vw, 30px);
    font-size: .9rem;
}

.barra1 span { margin-right: 20px; color: var(--oro); white-space: nowrap; }
.barra_social a { margin-left: 15px; color: #eee; transition: color .3s; }
.barra_social a:hover { color: var(--oro); }

.logo {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 4px clamp(12px, 3vw, 30px) 8px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: clamp(70px, 11vw, 155px); }

/* ---------- MENU ---------- */
.menu_principale ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: clamp(12px, 2vw, 28px);
}

.menu_principale li { position: relative; }

.menu_principale a {
    display: block;
    padding: 10px 0;
    font-weight: 700;
    font-size: 1.05rem;
    text-transform: uppercase;
    transition: color .3s;
}

.menu_principale a:hover,
.menu_principale a:focus-visible { color: var(--oro); }

.sotto_menu1 {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    padding: 6px 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #000, #b00, #000);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .5);
}

.sotto_menu1 a { padding: 8px 16px; font-weight: 400; text-transform: none; white-space: nowrap; }

.sotto_menu:hover > .sotto_menu1,
.sotto_menu:focus-within > .sotto_menu1,
.sotto_menu.open > .sotto_menu1 { display: block; }

.nav-toggle {
    display: none;
    background: none;
    border: 0;
    color: #fff;
    font-size: 1.7rem;
    padding: 8px;
    cursor: pointer;
}

/* il bottone del modulo (button { ... } più sotto) non deve toccare il pulsante del menu */
.nav-toggle,
.nav-toggle:hover {
    width: auto;
    margin: 0;
    padding: 8px;
    background: none;
    border-radius: 0;
    color: #fff;
    font-size: 1.7rem;
}

/* ===== Pagina Info ===== */
.contenitore_info {
    width: 100%;
    display: flex;
}

.box_corsi {
    text-align: center;
    background: white;
    padding: 8px;
    margin: 10px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 25%;
    max-width: 600px;
}

.contenitore {
    background: white;
    padding: 8px;
    margin: 10px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 50%;
    max-width: 600px;
}

h1 {
    text-align: center;
    color: #333;
}

h2 {
    display: center;
    text-align: center;
    color: #333;
}

.form-group {
    margin-bottom: 2px;
}

label {
    margin: 0 0 0 4%;
    display: block;
    margin-bottom: 5px;
    color: #555;
}

input,
select,
textarea {
    margin: 0 0 0 4%;
    width: 90%;
    padding: 0.8em;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

textarea {

    resize: vertical;
    height: 100px;
}

button {
    width: 30%;
    padding: 2%;
    margin: 1% 0 0 30%;
    border: none;
    background-color: #007BFF;
    color: #fff;
    border-radius: 15px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0056b3;
}

#message {
    margin-top: 2px;
    text-align: center;
    font-weight: bold;
}

.success {
    color: green;
}

.error {
    color: red;
}



.sidebar {

    position: static;
    width: 100%;
    height: 600px;
    background-color: aliceblue;
    padding: 5px;
    margin: 10px;
    box-shadow: 3px 0 0px black;
    z-index: 1;
    flex-direction: column;
    border-radius: 15px;
    color: rgb(0, 0, 0);

}

.sidebar2 {
    padding: 10px 0px 0px 0px;
    position: static;
    width: 50%;
    max-height: 650px;
    background-color: aliceblue;
    margin: 2px 0 0 0;
    box-shadow: 3px 0 5px black;
    z-index: 1;
    flex-direction: column;
    border-radius: 15px;
    color: rgb(0, 0, 0);

}

/* elimina i pallini */
.main-menu ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/*Posiziona le voci del menu laterale */
.menu-item {
    cursor: pointer;
    padding: 5px;
    font-weight: bold;
    border-bottom: 1px solid gold;
    font-size: 1.2em;

}

.submenu {
    list-style-type: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    font-size: 0.9em;
    /* Nasconde il Sottomenu */
    transition: max-height 0.3s ease-out;
}

.menu-item:hover>.submenu {
    max-height: 1200px;
    /* Abbastanza grande da mostrare tutti gli elementi */
    transition: max-height 0.5s ease-in;
}

.submenu li {
    padding: 8px 5px;
    font-weight: normal;
    font-size: 0.9em;
    cursor: pointer;
}

.submenu li:hover {
    color: #f40202;
}

.box_corsi { overflow-wrap: anywhere; }
.box_corsi iframe { width: 100%; height: 250px; border: 0; }

/* i sottomenu si aprono anche col click/tap (classe .open messa dallo script) */
@media (hover: none) {
    .menu-item:hover > .submenu { max-height: 0; }
}
.menu-item.open > .submenu { max-height: 1200px; }

/* ===== TABLET E TELEFONO (stessi breakpoint di style.css) ===== */
@media (max-width: 1024px) {
    .nav-toggle { display: block; }

    .menu_principale {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
        background: rgba(10, 10, 10, .97);
    }
    .site-header.menu-open .menu_principale { display: block; }

    .menu_principale ul { flex-direction: column; gap: 0; padding: 8px 20px 16px; }
    .menu_principale a { padding: 14px 0; border-bottom: 1px solid #333; }

    .sotto_menu1 { position: static; min-width: 0; padding: 0 0 0 16px; background: none; box-shadow: none; }
    .sotto_menu:hover > .sotto_menu1 { display: none; } /* su touch si apre solo col tap */
    .sotto_menu.open > .sotto_menu1 { display: block; }
}

@media (max-width: 900px) {
    /* le tre colonne diventano una sotto l'altra: prima il modulo, poi corsi e contatti */
    .contenitore_info { flex-direction: column; }
    .box_corsi, .contenitore { width: auto; max-width: none; }
    .contenitore { order: -1; }
}

@media (max-width: 600px) {
    .barra1 span:nth-child(2) { display: none; } /* e-mail: si legge già nei contatti */

    .box_corsi, .contenitore { margin: 8px; }
    h1 { font-size: 1.5rem; }

    button[type="submit"] {
        display: block;
        width: min(92%, 260px);
        margin: 14px auto 6px;
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header::before, .site-header::after { transition: none; }
}
