/* ==========================================================================
   VARIABILI GLOBALI
   ========================================================================== */
:root {
	--sidebar-width: 90px;
	--topbar-height: 80px;
	--toolbar-height: 40px; 
	--brand-box-height: 80px;
}

/* ==========================================================================
   BRAND BOX (PITTOGRAMMA D'ANGOLO)
   ========================================================================== */
.custom-header-wrapper .brand-corner-box {
	position: fixed;
	top: 40px;
	left: 0;
	width: var(--sidebar-width);
	height: var(--brand-box-height);
	background-color: #ffffff; /* Sfondo bianco di default, sovrascrivibile */
	z-index: 10010; /* Sopra a tutto per creare l'incrocio visivo perfetto */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px;
	border-right: 1px solid #e5e5e5;
	border-bottom: 1px solid #e5e5e5;
	box-sizing: border-box;
}
.custom-header-wrapper .brand-corner-box img { max-width: 45px; height: auto; display: block; }

/* ==========================================================================
   BARRA LATERALE (SIDEBAR)
   ========================================================================== */
.custom-header-wrapper .side-nav {
	position: fixed; top: var(--brand-box-height); left: 0; width: var(--sidebar-width); height: calc(100vh - var(--brand-box-height));
	background-color: #1a1a1a; color: #fff; z-index: 10000; display: flex; flex-direction: column; align-items: center; 
	padding: 20px 0 40px 0; border-right: 1px solid rgba(255,255,255,0.1);
}
.custom-header-wrapper .side-nav-menu { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 25px; flex: 1; width: 100%; }
.custom-header-wrapper .side-nav .nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 12px 5px; background: none; border: none; cursor: pointer; color: inherit; transition: color 0.2s ease; }
.custom-header-wrapper .side-nav .nav-btn-text { font-size: 0.85rem; text-align: center; white-space: normal; word-wrap: break-word; line-height: 1.2; padding: 0 5px; }
.custom-header-wrapper .nav-btn-icon { display: flex; align-items: center; justify-content: center; }
.custom-header-wrapper .nav-btn-icon svg { width: 24px; height: 24px; fill: currentColor; transition: all 0.2s ease; }
.custom-header-wrapper .nav-btn-icon i { font-size: 22px; transition: all 0.2s ease; }

/* ==========================================================================
   TOOLBAR SUPERIORE
   ========================================================================== */
.custom-header-wrapper .top-toolbar {
	position: fixed; top: 0; left: 0; width: 100%;
	height: var(--toolbar-height); background-color: #f4f4f4; z-index: 9990; display: flex;
	align-items: center; justify-content: flex-end; padding: 0 40px; border-bottom: 1px solid #e5e5e5;
}
.custom-header-wrapper .toolbar-items { display: flex; align-items: center; gap: 25px; }
.custom-header-wrapper .toolbar-item { font-size: 0.8rem; text-decoration: none; color: #555; font-weight: 500; transition: all 0.2s ease; }
.custom-header-wrapper .toolbar-item.tb-text:hover { color: #ffca28; }
.custom-header-wrapper .toolbar-item.tb-btn { background-color: #1a1a1a; color: #fff; padding: 6px 18px; border-radius: 50px; font-weight: 600; }
.custom-header-wrapper .toolbar-item.tb-btn:hover { background-color: #ffca28; color: #1a1a1a; }

/* ==========================================================================
   BARRA SUPERIORE (TOPBAR)
   ========================================================================== */
.custom-header-wrapper .top-nav {
	position: fixed; top: 0; left: var(--sidebar-width); width: calc(100% - var(--sidebar-width));
	height: var(--topbar-height); background-color: #ffffff; border-bottom: 1px solid #e5e5e5; z-index: 9980; 
	display: flex; align-items: center; justify-content: space-between; padding: 0 40px; transition: top 0.3s ease;
}
.custom-header-wrapper.has-toolbar .top-nav { top: var(--toolbar-height); }
.custom-header-wrapper .top-nav-left { flex: 1; display: flex; justify-content: flex-start; align-items: center; }
.custom-header-wrapper .top-nav-logo img { max-height: 40px; width: auto; display: block; }
.custom-header-wrapper .top-nav-center { flex: 0 0 auto; display: flex; align-items: center; gap: 30px; }
.custom-header-wrapper .top-nav-center .nav-btn { background: none; border: none; font-weight: 600; font-size: 0.95rem; cursor: pointer; color: #333; padding: 10px 5px; display: inline-block; transition: color 0.2s ease; }
.custom-header-wrapper .top-nav-center .nav-btn:hover { color: #ffca28; }
.custom-header-wrapper .top-nav-right { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 20px; }
.custom-header-wrapper .top-icon-btn { color: #333; cursor: pointer; text-decoration: none; display: flex; align-items: center; justify-content: center; transition: color 0.2s ease; }
.custom-header-wrapper .top-icon-btn:hover { color: #ffca28; }
.custom-header-wrapper .top-icon-btn svg { width: 22px; height: 22px; fill: currentColor; transition: fill 0.2s ease; }
.custom-header-wrapper .top-icon-btn i { font-size: 20px; }

/* ==========================================================================
   OVERLAY E PANNELLI MODALI DESKTOP
   ========================================================================== */
.custom-header-wrapper .menu-overlay {
	position: fixed; bottom: 0; left: 0; width: 100%; height: calc(100% - 120px);
	background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 9991;
	opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.custom-header-wrapper .menu-overlay.active { opacity: 1; visibility: visible; }
.custom-header-wrapper .mega-panel {
	position: fixed; bottom: 0; left: var(--sidebar-width); height: calc(100vh - 120px);
	width: max-content; background-color: #ffffff; z-index: 9995; 
	box-shadow: 15px 0 40px rgba(0,0,0,0.15);
	transform: translateX(-100%); opacity: 0; visibility: hidden;
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.custom-header-wrapper .mega-panel.active { transform: translateX(0); opacity: 1; visibility: visible; }
.custom-header-wrapper .close-panel {
	position: absolute; top: 5px; right: 5px; background: none; border: none;
	font-size: 1.1rem; cursor: pointer; color: #000000; font-weight: 700; z-index: 10;
}

.custom-header-wrapper .close-panel:hover { color: #111; }

.custom-header-wrapper .panel-columns { display: flex; height: 100%; }
.custom-header-wrapper .col-info { width: 350px; padding: 70px 40px; background-color: #ffffff; display: flex; flex-direction: column; gap: 15px; }
.custom-header-wrapper .col-info h3 { margin: 0; font-size: 1.6rem; color: #000000; font-family: 'Montserrat'; font-weight: 500; }
.custom-header-wrapper .col-info p { margin: 0; color: #000000; line-height: 1.5; font-size: 0.95rem; font-family: 'Montserrat'; }
.custom-header-wrapper .cta-button {
	align-self: flex-start; padding: 12px 24px; background: #f39005; color: #fff; text-decoration: none; font-weight: 600;
    font-family: 'Montserrat'; font-size: 1rem; border-radius: 4px; transition: background 0.2s; margin-top: 10px; border-radius: 50px; }
.custom-header-wrapper .cta-button:hover { background: #000000; color: #ffffff; }

.custom-header-wrapper .col-submenu { 
	width: 300px; padding: 70px 40px; background-color: #fafafa; border-left: 1px solid #eee; 
}
.custom-header-wrapper .col-submenu-tertiary { width: 0; padding: 70px 0; background-color: #f4f4f4; border-left: none; opacity: 0; visibility: hidden; overflow: hidden; transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1); }
.custom-header-wrapper .col-submenu-tertiary.active { width: 300px; padding: 70px 40px; border-left: 1px solid #e0e0e0; opacity: 1; visibility: visible; }
.custom-header-wrapper .col-submenu ul, .custom-header-wrapper .col-submenu-tertiary ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 15px; }
.custom-header-wrapper .col-submenu ul li a, .custom-header-wrapper .col-submenu-tertiary ul li a { 
	text-decoration: none; color: #000000; font-family: 'Montserrat'; font-weight: 500; 
	transition: all 0.2s; display: block; font-size: 0.9rem; }
.custom-header-wrapper .col-submenu ul li a:hover, .custom-header-wrapper .col-submenu-tertiary ul li a:hover { color: #f39005; }
.custom-header-wrapper .menu-item-with-submenu { display: flex; align-items: center; justify-content: space-between; }
.custom-header-wrapper .submenu-toggle { background: none; border: none; font-size: 0.9rem; cursor: pointer; color: #aaa; transition: all 0.3s ease; padding: 5px; }
.custom-header-wrapper .submenu-toggle:hover, .custom-header-wrapper .submenu-toggle.active { color: #f39005; }
.custom-header-wrapper .submenu-container { display: none; }


/* ==========================================================================
   MEDIA QUERY MOBILE (Tablet & Smartphone) < 1024px
   ========================================================================== */
.custom-header-wrapper .mobile-hamburger { display: none; background: none; border: none; color: inherit; cursor: pointer; padding: 5px; margin-left: 15px; }
.custom-header-wrapper .mobile-canvas-menu { display: none; }

@media (max-width: 1024px) {
	
	.custom-header-wrapper .brand-corner-box,
	.custom-header-wrapper .side-nav,
	.custom-header-wrapper .top-toolbar,
	.custom-header-wrapper .top-nav-center,
	.custom-header-wrapper .mega-panel { display: none !important; }

	.custom-header-wrapper .top-nav { left: 0; width: 100%; top: 0 !important; height: 70px; padding: 0 20px; }
	.custom-header-wrapper .top-nav-logo img { max-height: 40px !important; }
	.custom-header-wrapper .mobile-hamburger { display: flex; align-items: center; justify-content: center; margin-left: 0; }
	.custom-header-wrapper .mobile-hamburger svg path { fill: #ffffff; }

	.custom-header-wrapper .mobile-canvas-menu { display: flex; flex-direction: column; position: fixed; top: 0; left: 0; width: 100%; height: 100dvh; background: #ffffff; z-index: 10050; transform: translateX(100%); transition: transform 0.35s ease; overflow: hidden; }
	.custom-header-wrapper .mobile-canvas-menu.active { transform: translateX(0); }

	.custom-header-wrapper .mobile-canvas-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid #eaeaea; background: #ffffff; }
	.custom-header-wrapper .mobile-canvas-title { font-size: 1.2rem; font-family: "Montserrat", Sans-serif; font-weight: 600; color: #F39005; }
	.custom-header-wrapper .mobile-close-btn { background: none; border: none; font-size: 20px !important; color: #F39005; cursor: pointer; padding: 0; }

	.custom-header-wrapper .mobile-canvas-root { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }

	/* Navigazione Orizzontale Mobile */
	.custom-header-wrapper .mobile-nav-horizontal { display: flex; overflow-x: auto; gap: 15px; padding: 15px 20px; background-color: #F39005CC; }
	.custom-header-wrapper .mobile-nav-horizontal::-webkit-scrollbar { display: none; }
	.custom-header-wrapper .mobile-root-btn { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0px; background: none; border: none; color: #005a9c; min-width: 70px; cursor: pointer; padding: 0; }
	.custom-header-wrapper .mob-btn-icon svg { width: 40px; height: 40px; fill: #ffffff; }
	.custom-header-wrapper .mob-btn-text { font-size: 0.7rem; text-align: center; text-wrap: auto; font-family: 'Montserrat'; text-transform: uppercase; font-weight: 600; color: #fff; }

	/* Navigazione Verticale Mobile */
	.custom-header-wrapper .mobile-nav-vertical { display: flex; flex-direction: column; padding: 10px 20px; }
	.custom-header-wrapper .mobile-list-btn { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; background: none; border: none; border-bottom: 1px solid rgb(0 0 0 / 20%); border-radius: 0; color: #F39005; cursor: pointer; font-family: "Montserrat", Sans-serif; font-size: 1rem; font-weight: 600; text-transform: none; font-style: normal; text-decoration: none; line-height: 1.02em; letter-spacing: 0.1px; }
	.custom-header-wrapper .mobile-list-btn .arrow { font-size: 0.9rem; }

	/* Footer Toolbar */
	.custom-header-wrapper .mobile-nav-footer { margin-top: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px; background: #000000; }
	.custom-header-wrapper .mobile-tb-link { color: #fff; font-family: 'Montserrat'; text-align: center; font-weight: 500; text-decoration: none; font-size: 0.9rem; }
	.custom-header-wrapper .mobile-tb-link:nth-child(2) { background: #f39005; padding: 7px; border-radius: 3px; font-weight: 400; }

	/* PANNELLI DI DETTAGLIO SCORREVOLI */
	.custom-header-wrapper .mobile-panel-detail { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #ffffff; z-index: 10; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1); }
	.custom-header-wrapper .mobile-panel-detail.active { transform: translateX(0); }
	.custom-header-wrapper .mobile-back-btn { background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 1rem; font-family: "Montserrat", Sans-serif; font-weight: 600; color: #F39005; padding: 0; }
	.custom-header-wrapper .mobile-back-btn .arrow { font-size: 1rem; }
	.custom-header-wrapper .mobile-panel-content { flex: 1; overflow-y: auto; }

	.custom-header-wrapper .mobile-panel-info { padding: 30px 20px; background-color: #ffffff; }
	.custom-header-wrapper .mobile-panel-info p { margin: 0 0 20px 0; font-size: 1rem; font-family: 'Montserrat'; color: #000000; line-height: 1.5; }
	.custom-header-wrapper .mobile-panel-info .cta-button { display: inline-block; padding: 10px 20px; color: #ffffff; background: #F39005; font-family: 'Montserrat'; text-decoration: none; font-size: 0.85rem; font-weight: 500; border-radius: 50px; }

	/* --- SOTTOMENU AD ACCORDION PER IL MOBILE --- */
	.custom-header-wrapper .mobile-panel-submenu { background-color: #f2f2f2; padding: 10px 20px; min-height: 100%; }
	.custom-header-wrapper .mobile-panel-submenu ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
	.custom-header-wrapper .mobile-panel-submenu ul li { border-top: 1px solid rgb(0 0 0 / 20%); }
	.custom-header-wrapper .mobile-panel-submenu ul li:nth-child(1) { border-top: 0; }
	
	/* Layout della riga per allineare link e freccia */
	.custom-header-wrapper .mobile-panel-submenu .menu-item-with-submenu { display: flex; justify-content: space-between; align-items: center; width: 100%; }
	.custom-header-wrapper .mobile-panel-submenu a { display: block; padding: 10px 0; text-decoration: none; font-size: 1rem; font-family: 'Montserrat'; color: #000000;         font-weight: 500; flex: 1; }
	
	/* Il bottone freccia */
	.custom-header-wrapper .mobile-panel-submenu .submenu-toggle { display: block; background: none; border: none; font-size: 0.9rem; color: #000000; padding: 0px 0 0px 10px; cursor: pointer; transition: transform 0.3s ease; }
	.custom-header-wrapper .mobile-panel-submenu .submenu-toggle.active { transform: rotate(90deg); }

	/* Il contenitore che si apre a fisarmonica */
	.custom-header-wrapper .mobile-panel-submenu .submenu-container { 
		max-height: 0; overflow: hidden; transition: max-height 0.4s ease;
		display: block; width: 100%; box-sizing: border-box;
	}
	
	.custom-header-wrapper .mobile-panel-submenu .submenu-container ul { padding-bottom: 10px; }
	.custom-header-wrapper .mobile-panel-submenu .submenu-container ul li { border: none; }
	.custom-header-wrapper .mobile-panel-submenu .submenu-container ul li a { font-size: 0.95rem; color: #555; padding: 7px 0; }
}