/**
 * Z-INDEX FIX GLOBAL - VERSION SMART
 * Corrige l'ordre des couches sur tout le site
 * Ordre: Admin Bar > Header/Menu > Bannières > Contenu
 * VERSION 2.0: Détection automatique de la hauteur du header
 */

/* COUCHE 1: WordPress Admin Bar - TOUT EN HAUT */
#wpadminbar {
	z-index: 99999 !important;
	position: fixed !important;
}

/* COUCHE 2: Header FIXED - Position fixe */
.site-header,
.site-header.site-header--magazine,
header.site-header {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	z-index: 9000 !important;
	width: 100% !important;
}

/* Body padding INTELLIGENT - Utilise la hauteur réelle du header */
body {
	/* Hauteur par défaut du header (sera override par JavaScript) */
	--niyapress-header-actual-h: 140px;
	padding-top: var(--niyapress-header-actual-h) !important;
}

/* Si admin bar visible, décaler le header SEULEMENT */
body.admin-bar .site-header,
body.admin-bar .site-header.site-header--magazine {
	top: 32px !important;
}

@media screen and (max-width: 782px) {
	body.admin-bar .site-header,
	body.admin-bar .site-header.site-header--magazine {
		top: 46px !important;
	}
}

/* Body padding quand admin bar - PAS de double padding! */
body.admin-bar {
	/* Le body garde le même padding, seul le header est décalé */
	padding-top: var(--niyapress-header-actual-h) !important;
}

/* COUCHE 3: Menu et navigation - DANS le header */
.site-header .main-nav,
.site-header nav,
.menu-primary-container,
.main-navigation,
.nav-menu {
	position: relative !important;
	z-index: 9100 !important;
}

/* Sous-menus dropdown */
.menu-primary-container .sub-menu,
.main-navigation .sub-menu,
.nav-menu .sub-menu {
	z-index: 9200 !important;
}

/* COUCHE 4: Bannières publicitaires - SOUS le header fixed */
.niyapress-lachtv-leaderboard,
.ad-banner,
.header-banner,
.header-ad-banner,
.site-banner,
[class*="banner"],
[class*="ad-slot"],
.widget_media_image,
.home-youtube-banner {
	position: relative !important;
	z-index: 100 !important;
	margin-top: 0 !important;
}

/* COUCHE 5: Contenu principal - BASE */
.site-content,
.site-main,
main,
article {
	position: relative !important;
	z-index: 10 !important;
	margin-top: 0 !important;
}

/* Correction: Premier élément après le header ne doit pas avoir de marge supplémentaire */
.site-content > *:first-child,
.site-main > *:first-child {
	margin-top: 0 !important;
}

/* COUCHE 6: Footer - SOUS tout */
.site-footer,
footer {
	position: relative !important;
	z-index: 5 !important;
}

/* Modals et overlays - AU DESSUS de tout sauf admin bar */
.modal,
.overlay,
.lightbox,
[role="dialog"] {
	z-index: 10000 !important;
}

/* Tooltips - AU DESSUS des modals */
.tooltip,
[role="tooltip"] {
	z-index: 10100 !important;
}

/* MOBILE: Réduction du padding si nécessaire */
@media screen and (max-width: 600px) {
	body {
		--niyapress-header-actual-h: 120px;
	}
}
