:root {
    --giallo: #FFE200;
    --blu: #2B3087;
    --bianco: #ffffff;
    --grigio: #f4f4f4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Segoe UI', sans-serif; overflow-x: hidden; }

/* HEADER */
header { position: fixed; top: 0; width: 100%; z-index: 9999; background: rgba(0, 0, 0, 0.5); padding: 15px 0; transition: 0.4s; }
header.scrolled { background: var(--bianco); padding: 10px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.nav-container { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.logo { height: 50px; }

nav ul { list-style: none; display: flex; gap: 20px; align-items: center; }
nav ul li a { text-decoration: none; color: white; font-weight: bold; transition: 0.3s; }
header.scrolled nav ul li a { color: var(--blu); }

/* DROPDOWN FIX - Sottomenu ora visibile */
.has-dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: 100%; left: 0; background: var(--bianco); min-width: 220px;
    display: flex; flex-direction: column; opacity: 0; visibility: hidden;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2); transition: 0.3s; z-index: 10000;
    padding: 10px 0; border-top: 3px solid var(--giallo);
}
.has-dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; }
.dropdown-menu li a { color: var(--blu) !important; padding: 12px 20px; display: block; font-size: 0.95rem; }
.dropdown-menu li a:hover { background: var(--grigio); }

.btn-contatti { background: var(--giallo) !important; padding: 8px 18px !important; border-radius: 4px; color: var(--blu) !important; }

/* SLIDER */
.hero-slider { position: relative; height: 100vh; overflow: hidden; background: #000; }
.slide { position: absolute; inset: 0; opacity: 0; transition: 1.5s; display: flex; align-items: center; justify-content: center; }
.slide.active { opacity: 1; z-index: 10; }
.image-container { position: absolute; inset: 0; background-size: cover; background-position: center; transition: 8s linear; }
.slide.active .ken-burns { transform: scale(1.15); }
.hero-content { position: relative; z-index: 20; background: rgba(43, 48, 135, 0.8); padding: 40px; border-radius: 8px; text-align: center; color: white; }
.hero-content h1 { font-size: 3rem; color: var(--giallo); }
.prev, .next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 30; background: rgba(255,255,255,0.1); color: white; border: none; padding: 20px; cursor: pointer; }
.next { right: 0; }

/* SEZIONI */
.section { padding: 40px 20px; width: 100%; }
.container { max-width: 1100px; margin: 0 auto; }
.title { text-align: center; margin-bottom: 40px; font-size: 2.2rem; color: var(--blu); font-weight: bold; }
.white-text { color: var(--bianco) !important; }

/* CHI SIAMO */
.flex-row { display: flex; gap: 40px; flex-wrap: wrap; align-items: center; }
.responsive-img { width: 100%; border-radius: 10px; }
.grid-2 {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 30px;
}
.text-centercol {
	text-align: center !important;
}
.text-centercol p {
	margin: auto;
}

/* LAVORAZIONI - Effetto dinamico ripristinato */
.grid-2x2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 25px; }
.card { background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.1); transition: 0.4s; cursor: pointer;}
.card:hover { transform: translateY(-10px); box-shadow: 0 8px 20px rgba(0,0,0,0.2); }
.card img { width: 100%; height: 250px; object-fit: cover; transition: 0.5s; }
.card:hover img { transform: scale(1.1); }
.card h3 { padding: 15px; text-align: center; color: var(--blu); }

/* CERTIFICAZIONI */
.cert-flex { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 20px; text-align: center; }
.cert-item i { font-size: 3rem; color: var(--blu); margin-bottom: 10px; display: block; }

/* CONTATTI */
.bg-blue { background-color: var(--blu); color: white; }
.contact-flex { display: flex; gap: 50px; flex-wrap: wrap; }
.contact-form { flex: 1.5; min-width: 300px; display: flex; flex-direction: column; gap: 15px; }
.btn-submit { background: var(--giallo); color: var(--blu); font-weight: bold; padding: 15px; border: none; border-radius: 5px; cursor: pointer; transition: 0.3s; }
.btn-submit:hover { background: var(--bianco); }
.info-contatti { flex: 1; line-height: 2; }
.map-container { margin-top: 40px; border-radius: 10px; overflow: hidden; border: 2px solid var(--giallo); }

/* Descrizione LAVORAZIONI */
.tech-card {
	margin-top:20px;
	
}
.tech-card ul {
	margin-top:10px;
	padding-left:20px;
}

/* Animazione superiore */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.hero-content h1 {
    animation: fadeInDown 1.2s ease-out;
}
.hero-content p {
    animation: fadeInDown 1.5s ease-out;
}


/* MOBILE */
.menu-toggle { display: none; font-size: 1.8rem; color: white; cursor: pointer; z-index: 10001; }
header.scrolled .menu-toggle { color: var(--blu); }

@media (max-width: 768px) {
    .menu-toggle { display: block; }
    nav { position: absolute; top: 100%; left: 0; width: 100%; background: white; display: none; flex-direction: column; padding: 10px 0; box-shadow: 0 5px 10px rgba(0,0,0,0.1); }
    nav.active { display: flex; }
    nav ul { flex-direction: column; width: 100%; gap: 0; }
    nav ul li a { color: var(--blu) !important; padding: 15px; text-align: center; width: 100%; display: block; border-bottom: 1px solid #eee; }
    .dropdown-menu { position: static; display: none; opacity: 1; visibility: visible; box-shadow: none; background: #f9f9f9; }
    .has-dropdown.active .dropdown-menu { display: flex; }
    .grid-2x2 { grid-template-columns: 1fr; }
    .contact-flex { flex-direction: column; }
	.grid-2 {
		display: grid;
		grid-template-columns: 1fr !important;
	}
}

footer { padding: 30px; background: #1a1a1a; color: white; text-align: center; }

/* Sezione Certificazioni */
.cert-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 50px; /* Distanza tra i loghi */
    margin-top: 50px;
    flex-wrap: wrap; /* Importante per mobile */
}

.cert-item {
    flex: 0 1 250px; /* Larghezza base per ogni logo */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.img-cert {
    max-width: 100%;
    height: 110px;      /* Altezza bilanciata per i tre loghi */
    object-fit: contain; /* Evita che le immagini si schiaccino */
    padding: 10px;      /* Crea un po' di respiro intorno ai loghi */
    transition: transform 0.3s ease;
}
.img-cert:hover {
    transform: scale(1.1); /* Effetto zoom leggero al passaggio del mouse */
}

.cert-item:hover .img-cert {
    filter: grayscale(0%); /* Torna a colori al passaggio del mouse */
    opacity: 1;
    transform: scale(1.05);
}

.cert-item p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* Adattamento Mobile */
@media (max-width: 768px) {
    .cert-grid {
        gap: 30px;
    }
    .cert-item {
        flex: 0 1 100%; /* Un logo per riga su mobile */
    }
}

/* Per la gallery */
/* Layout Pagina Lavorazioni */
.hero-small { padding: 120px 20px 60px; text-align: center; color: white; background-size: cover; background-position: center; }
.hero-small h1 { font-size: 3rem; color: var(--giallo); margin-bottom: 10px; }

/* Galleria Grid */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; padding: 20px 0; }
.gallery-item { height: 200px; overflow: hidden; border-radius: 8px; cursor: pointer; position: relative; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: 0.4s; }
.gallery-item:hover img { transform: scale(1.1); filter: brightness(0.8); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.9); display: none; align-items: center; justify-content: center; z-index: 10000; padding: 20px; }
.lightbox.active { display: flex; }
.lightbox-content { max-width: 90%; max-height: 80vh; border-radius: 5px; border: 3px solid var(--giallo); }
.close-lightbox { position: absolute; top: 30px; right: 40px; color: white; font-size: 40px; cursor: pointer; }

/* Fix menu per pagine interne */
.page-lavorazioni header { background: var(--bianco); box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.page-lavorazioni nav ul li a { color: var(--blu); }

/* Stile Frecce Lightbox */
.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(43, 48, 135, 0.7); /* Blu GDS trasparente */
    color: var(--giallo);
    border: none;
    font-size: 2.5rem;
    padding: 20px 15px;
    cursor: pointer;
    z-index: 10001;
    transition: 0.3s;
    border-radius: 5px;
}

.lightbox-prev:hover, .lightbox-next:hover {
    background: var(--giallo);
    color: var(--blu);
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* Adattamento per Mobile */
@media (max-width: 768px) {
    .lightbox-prev, .lightbox-next {
        font-size: 1.5rem;
        padding: 10px;
    }
    .lightbox-content {
        max-width: 100%;
    }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: -100%; /* Nascosto inizialmente */
    left: 0;
    width: 100%;
    background: rgba(43, 48, 135, 0.95); /* Blu GDS */
    color: white;
    padding: 20px 0;
    z-index: 99999;
    transition: 0.5s ease-in-out;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.3);
}

.cookie-banner.active {
    bottom: 0;
}

.cookie-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
}

.btn-cookie {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.btn-cookie.accept { background: var(--giallo); color: var(--blu); }
.btn-cookie.reject { background: transparent; border: 1px solid white; color: white; }

.btn-cookie:hover { opacity: 0.8; transform: translateY(-2px); }

@media (max-width: 768px) {
    .cookie-content { text-align: center; justify-content: center; }
}

/* Stile Pagine Legali */
.legal-content h2 {
    color: var(--blu);
    margin: 30px 0 15px;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--giallo);
    display: inline-block;
}

.legal-content p, .legal-content li {
    line-height: 1.8;
    color: #444;
    margin-bottom: 10px;
}

.legal-content ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.page-legal .hero-small {
    padding: 100px 20px 40px;
}