/* ===== NAVIGATION OPTIMISÉE ===== */

/* Variables CSS pour la cohérence */
:root {
    --nav-bg: #ffffff;
    --nav-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --primary-color: #3b82f6;
    --secondary-color: #1d4ed8;
    --text-color: #374151;
    --border-color: #e2e8f0;
    --hover-bg: #f8fafc;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== HEADER COMPLET FIXE ===== */
.modern-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
}

/* ===== ESPACEMENT POUR CONTENU : main démarre juste sous la navbar ===== */
/* Hauteur réelle header ≈ breaking news (~56px) + navbar (~78px) = ~134px */
body {
    padding-top: 140px !important; /* Contenu démarre juste sous la navbar */
}

/* Premier bloc de contenu sans marge par défaut */
.main-content-wrap > *:first-child {
    margin-top: 0;
}

/* Bannière publicitaire en premier (accueil, articles, etc.) : léger dégap */
.main-content-wrap > .container.mt-1.pt-1:first-child {
    margin-top: 10px !important;
    padding-top: 6px !important;
    position: relative !important;
    z-index: 1002 !important;
}

@media (max-width: 768px) {
    body {
        padding-top: 125px !important; /* Mobile : juste sous la navbar */
    }
    
    .main-content-wrap > .container.mt-1.pt-1:first-child {
        margin-top: 12px !important;
        padding-top: 8px !important;
        z-index: 1002 !important;
    }
}

/* ===== BREAKING NEWS FIXE ===== */
.breaking-news {
    position: relative;
    z-index: 1001;
}

/* ===== CORRECTION BREAKING NEWS ROUGE ===== */
.breaking-news-label {
    background: #dc2626 !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.3) !important;
}

.breaking-news-label:hover {
    background: #b91c1c !important;
    color: white !important;
}

/* ===== NAVBAR PRINCIPALE ===== */
.main-navbar {
    background: var(--nav-bg) !important;
    border: none !important;
    padding: 0.5rem 0 !important;
    box-shadow: var(--nav-shadow) !important;
    min-height: 50px !important;
    z-index: 1000 !important;
    position: relative !important;
    /* Assurer que le menu utilisateur peut s'afficher */
    overflow: visible !important;
}

.main-navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    height: 100%;
    /* Assurer que le menu utilisateur peut s'afficher */
    overflow: visible !important;
    position: relative;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    /* Assurer que le menu utilisateur peut s'afficher */
    overflow: visible !important;
    position: relative;
}

/* ===== BOUTONS ET LOGO ===== */
.menu-toggle-btn {
    border: none;
    background: #0a0b0c;
    color: white;
    font-size: 0.9rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.menu-toggle-btn:hover {
    background: #4b5563;
    color: white;
}

.main-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 700;
    font-size: 1rem;
    margin-left: 0.25rem;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-image {
    height: 70px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    max-width: 400px;
}

/* ===== BARRE DE RECHERCHE ===== */
.search-container {
    display: flex;
    align-items: center;
}

.search-btn {
    background: linear-gradient(135deg, var(--nav-bg) 0%, var(--hover-bg) 100%);
    border: 2px solid var(--border-color);
    color: #64748b;
    font-size: 0.85rem;
    padding: 0.5rem;
    border-radius: 10px;
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.search-btn:hover {
    background: linear-gradient(135deg, var(--hover-bg) 0%, #f1f5f9 100%);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* ===== FILTRES DE RÉGIONS ===== */
.mobile-regions-filter {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 0.5rem;
    padding: 0 1rem;
    margin-bottom: 0;
    width: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: center;
    align-items: center;
}

.mobile-regions-filter::-webkit-scrollbar {
    display: none;
}

.region-filter-btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.25rem 0.5rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 500;
    text-align: center;
    min-height: 28px;
    max-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.region-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #f8fafc;
}

/* Couleurs dynamiques des régions - définies dans le HTML */

.region-filter-btn-all {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white !important;
    border-color: #3b82f6;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
}

.region-filter-btn-all .region-name {
    color: white !important;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.region-filter-btn-all:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    color: white !important;
}

.region-filter-btn-all:hover .region-name {
    color: white !important;
}

/* ===== BOUTON S'ABONNER ===== */
.subscribe-container {
    display: flex;
    align-items: center;
}

.subscribe-btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subscribe-btn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* ===== MENU UTILISATEUR ===== */
/* Section recréée proprement (minimal, prévisible) */
.user-container { display: flex; align-items: center; }

.user-dropdown-container {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.user-btn {
	background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
	color: #fff;
	border: 0;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.95rem;
	cursor: pointer;
	transition: var(--transition);
}

.user-btn:hover { transform: translateY(-1px); }

.user-dropdown-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 260px;
	background: #ffffff;
	border: 1px solid var(--border-color);
	border-radius: 12px;
	box-shadow: 0 12px 30px rgba(0,0,0,0.12);
	padding: 8px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
	z-index: 1003; /* NIVEAU 4 : Dropdowns et éléments flottants */
	overflow: hidden;
}

.user-dropdown-container.open .user-dropdown-menu,
.user-dropdown-container:focus-within .user-dropdown-menu,
.user-dropdown-container:hover .user-dropdown-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.dropdown-item { 
	display: flex; align-items: center; gap: .6rem;
	padding: .6rem .75rem; border-radius: 8px; color: var(--text-color); text-decoration: none; transition: var(--transition);
}
.dropdown-item:hover { background: var(--hover-bg); color: var(--secondary-color); }
.dropdown-divider { margin: .4rem 0; border-top: 1px solid var(--border-color); }
.dropdown-header { padding: .5rem .75rem; }
.user-info { display: flex; align-items: center; gap: .6rem; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e5e7eb; color: #6b7280; display: flex; align-items: center; justify-content: center; }
.user-name { font-weight: 600; }
.user-role { font-size: .8rem; color: #6b7280; }
.logout-item { width: 100%; text-align: left; background: none; border: 0; color: #dc2626; cursor: pointer; padding: .6rem .75rem; border-radius: 8px; }
.logout-item:hover { background: rgba(220,38,38,.08); }

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .navbar .mobile-regions-filter {
        gap: 0.4rem;
        padding: 0 0.5rem;
    }
    
    .navbar .region-filter-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
        min-height: 26px;
        max-height: 26px;
    }
    
    .navbar-right {
        gap: 0.5rem;
    }
    
    .subscribe-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 576px) {
    .navbar .mobile-regions-filter {
        gap: 0.25rem;
        padding: 0 0.25rem;
    }
    
    .navbar .region-filter-btn {
        padding: 0.25rem 0.25rem;
        font-size: 0.65rem;
        min-height: 24px;
        max-height: 24px;
    }
    
    .user-btn { width: 36px; height: 36px; }
    .user-dropdown-menu { min-width: 230px; }
    
    /* Logo plus grand sur mobile */
    .logo-image {
        height: 60px !important;
        max-width: 300px !important;
    }
}

@media (max-width: 480px) {
    .logo-image {
        height: 55px !important;
        max-width: 280px !important;
    }
}

@media (max-width: 375px) {
    .logo-image {
        height: 50px !important;
        max-width: 250px !important;
    }
}
