/* ==========================================================================
   Desktop Nav Bar + Mega Menu "Servizi"
   Visibile solo da 1025px in su. Il menu mobile resta invariato.
   ========================================================================== */

/* === DESKTOP NAV BAR === */
.desktop-nav {
	display: none;
}

@media (min-width: 1025px) {
	/* Mostra la nav bar desktop */
	.desktop-nav {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 3rem;
		height: 72px;
		background: #1A1A1A;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: 100;
	}

	/* Nascondi hamburger e search icon su desktop */
	.siteHeader .siteHeader__icon-bar,
	.siteHeader .searchIcon {
		display: none;
	}

	/* Riposiziona l'header originale sotto la desktop nav */
	.siteHeader {
		display: none !important;
	}

	/* Logo nella desktop nav */
	.desktop-nav__logo img {
		height: 40px;
		width: auto;
		display: block;
	}

	/* Nav links centrali */
	.desktop-nav__links {
		display: flex;
		align-items: center;
		gap: 2rem;
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.desktop-nav__links > li {
		position: relative;
	}

	.desktop-nav__links > li > a {
		color: #fff;
		text-decoration: none;
		font-family: 'Poppins', sans-serif;
		font-size: 15px;
		font-weight: 500;
		padding: 24px 0;
		display: flex;
		align-items: center;
		gap: 6px;
		transition: color 0.2s;
		white-space: nowrap;
	}

	.desktop-nav__links > li > a:hover {
		color: #53AD55;
	}

	/* Chevron per Servizi */
	.desktop-nav__chevron {
		width: 12px;
		height: 12px;
		transition: transform 0.3s;
		flex-shrink: 0;
	}

	.has-mega-menu.is-open .desktop-nav__chevron,
	.has-mega-menu:hover .desktop-nav__chevron {
		transform: rotate(180deg);
	}

	/* Azioni destra (lingua + CTA) */
	.desktop-nav__actions {
		display: flex;
		align-items: center;
		gap: 1.5rem;
	}

	.desktop-nav__lang {
		display: none; /* Nascosto fino a quando sarà attiva la versione inglese */
	}

	.desktop-nav__lang svg {
		width: 14px;
		height: 14px;
	}

	.desktop-nav__cta {
		display: inline-flex;
		align-items: center;
		background: #53AD55;
		color: #fff;
		font-family: 'Poppins', sans-serif;
		font-size: 14px;
		font-weight: 600;
		padding: 10px 24px;
		border-radius: 100px;
		text-decoration: none;
		transition: opacity 0.2s, transform 0.2s;
	}

	.desktop-nav__cta:hover {
		opacity: 0.9;
		transform: translateY(-1px);
	}

	/* Body offset per compensare la fixed nav */
	body {
		padding-top: 72px;
	}

	/* Fix: overlay menu non deve apparire su desktop se aperto accidentalmente */
	.siteHeader__nav {
		display: none !important;
	}

	/* === MEGA MENU PANEL === */
	.mega-menu-panel {
		position: fixed;
		top: 72px;
		left: 0;
		width: 100%;
		background: #fff;
		box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
		padding: 2.5rem 0;
		opacity: 0;
		visibility: hidden;
		transform: translateY(-8px);
		transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
		z-index: 99;
		pointer-events: none;
	}

	.has-mega-menu.is-open .mega-menu-panel,
	.has-mega-menu:hover .mega-menu-panel {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
		pointer-events: auto;
	}

	.mega-menu-inner {
		max-width: 1320px;
		margin: 0 auto;
		padding: 0 3rem;
		display: grid;
		grid-template-columns: repeat(6, 1fr);
		gap: 1.5rem 2.5rem;
		align-items: start;
	}

	/* Colonne — allineamento verticale top + spaziatura consistente */
	.mega-menu-column {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		padding: 0.5rem 0;
	}

	.mega-menu-column ul {
		list-style: none;
		padding: 0;
		margin: 0;
		width: 100%;
	}

	/* Badge colorati — ora sono <a> cliccabili */
	.mega-menu-badge {
		display: inline-block;
		padding: 6px 14px;
		border-radius: 6px;
		color: #fff;
		font-family: 'Poppins', sans-serif;
		font-size: 13px;
		font-weight: 600;
		margin-bottom: 14px;
		white-space: nowrap;
		text-decoration: none;
		transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
	}

	.mega-menu-badge:hover {
		opacity: 0.88;
		transform: translateY(-1px);
		box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
		color: #fff;
	}

	/* Colori badge — dalle variabili SCSS del tema */
	.mega-menu-badge--siti        { background: #00A3AD; }
	.mega-menu-badge--marketing   { background: #005AAD; }
	.mega-menu-badge--ecommerce   { background: #4C00AD; }
	.mega-menu-badge--software    { background: #8000AD; }
	.mega-menu-badge--seo         { background: #AD003E; }
	.mega-menu-badge--visual      { background: #AAAD00; }

	/* Sotto-voci — spaziatura migliorata */
	.mega-menu-column ul li {
		margin-bottom: 0;
	}

	.mega-menu-column ul li a {
		color: #444;
		font-family: 'Poppins', sans-serif;
		font-size: 13.5px;
		font-weight: 400;
		line-height: 1.4;
		padding: 5px 0;
		display: block;
		text-decoration: none;
		transition: color 0.2s, padding-left 0.2s;
	}

	.mega-menu-column ul li a:hover {
		color: #000;
		font-weight: 500;
		padding-left: 4px;
	}

	/* Hover su colonna: badge effect */
	.mega-menu-column:hover .mega-menu-badge {
		transform: translateY(-1px);
		box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
	}
}

/* === RESPONSIVE MEGA MENU === */
@media (min-width: 1025px) and (max-width: 1279px) {
	.desktop-nav {
		padding: 0 2rem;
	}

	.desktop-nav__links {
		gap: 1.25rem;
	}

	.desktop-nav__links > li > a {
		font-size: 14px;
	}

	.mega-menu-inner {
		gap: 1rem 1.5rem;
		padding: 0 2rem;
	}

	.mega-menu-badge {
		font-size: 11.5px;
		padding: 5px 10px;
	}

	.mega-menu-column ul li a {
		font-size: 12.5px;
		padding: 4px 0;
	}
}

/* === MOBILE: Non toccare nulla === */
@media (max-width: 1024px) {
	.desktop-nav {
		display: none !important;
	}

	.mega-menu-panel {
		display: none !important;
	}

	/* Ripristina header originale mobile */
	body {
		padding-top: 0 !important;
	}
}

/* === ADMIN BAR: Offset per WordPress admin bar === */
@media (min-width: 1025px) {
	.admin-bar .desktop-nav {
		top: 32px;
	}

	.admin-bar .mega-menu-panel {
		top: calc(72px + 32px);
	}

	.admin-bar body {
		padding-top: calc(72px + 32px);
	}
}

/* === FIX: Rimuovi margin-top su hero sections — il body padding-top: 72px
   già compensa la fixed nav. Questi margin erano per il vecchio header non-fixed. === */
@media (min-width: 1025px) {
	.bwHeroSection {
		margin-top: 0;
	}

	.bw-h-100 {
		margin-top: 0;
		height: calc(100vh - 72px);
	}

	.admin-bar .bw-h-100 {
		height: calc(100vh - 72px - 32px);
	}
}

/* === BACK BUTTON: Freccia accanto al titolo nelle pagine servizio child === */
.hero-title-row {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.hero__service .backTo-service {
	position: relative;
	top: auto;
	left: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 40px;
	max-width: 40px;
	flex-shrink: 0;
	margin-top: 4px;
	overflow: visible;
	border: 1.5px solid var(--primary_color, #000);
	border-radius: 50%;
	transition: background-color 0.2s, border-color 0.2s;
	background: transparent;
}

.hero__service .backTo-service:hover {
	background-color: var(--primary_color, #000);
	max-width: 40px;
	width: 40px;
	border-color: var(--primary_color, #000);
}

.hero__service .backTo-service:hover .arrow-back::before {
	background-color: #fff;
}

.hero__service .backTo-service .arrow-back {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	min-width: 16px;
	position: relative;
	left: 2px;
	height: 40px;
}

.hero__service .backTo-service .arrow-back::before {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 16px;
	height: 16px;
	background-color: var(--primary_color, #000);
}

/* Nascondi il testo del backTo-service (solo freccia) */
.hero__service .backTo-service .backTo-service__text,
.hero__service .backTo-service .screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* === ACCESSIBILITY: Focus styles === */
.desktop-nav__links > li > a:focus-visible,
.desktop-nav__cta:focus-visible,
.mega-menu-column ul li a:focus-visible {
	outline: 2px solid #53AD55;
	outline-offset: 2px;
	border-radius: 2px;
}
