/* Styles pour le Mega Menu amélioré */

/* Container principal du mega dropdown */
.mega-dropdown {
    position: relative;
}

/* Menu déroulant mega */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 600px;
    background: #ffffff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 0;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: 1px solid #e8ecef;
}

/* Animation d'apparition */
.mega-dropdown:hover .mega-menu,
.mega-dropdown.open .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Contenu du mega menu */
.mega-menu-content {
    padding: 24px;
}

/* En-tête du mega menu */
.mega-menu-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f8f9fa;
}

.mega-menu-header h4 {
    color: #2048ad;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mega-menu-header p {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
    font-style: italic;
}

/* Grille des éléments */
.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    max-width: 100%;
}

/* Éléments individuels */
.mega-menu-item {
    position: relative;
}

/* Liens du mega menu */
.mega-menu-link {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Effet hover sur les liens */
.mega-menu-link:hover {
    background: #ffffff;
    border-color: #2048ad;
    color: #2048ad;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(32, 72, 173, 0.15);
}

/* Icônes */
.mega-menu-icon {
    font-size: 20px;
    margin-right: 12px;
    transition: transform 0.3s ease;
}

.mega-menu-link:hover .mega-menu-icon {
    transform: scale(1.1);
}

/* Élément principal (catégorie principale) */
.mega-menu-item.featured .mega-menu-link {
    background: linear-gradient(135deg, #2048ad 0%, #1a3d8f 100%);
    color: #ffffff;
    font-weight: 600;
    border-color: #2048ad;
}

.mega-menu-item.featured .mega-menu-link:hover {
    background: linear-gradient(135deg, #1a3d8f 0%, #153570 100%);
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(32, 72, 173, 0.3);
}

/* Effet de brillance sur l'élément principal */
.mega-menu-item.featured .mega-menu-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.mega-menu-item.featured .mega-menu-link:hover::before {
    left: 100%;
}

/* Responsive design */
@media (max-width: 768px) {
    .mega-menu {
        min-width: 320px;
        left: -50px;
    }
    
    .mega-menu-content {
        padding: 16px;
    }
    
    .mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .mega-menu-link {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .mega-menu-header h4 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .mega-menu {
        min-width: 280px;
        left: -80px;
    }
}

/* Animation de chargement pour les icônes */
@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.mega-menu-icon {
    animation: iconPulse 2s ease-in-out infinite;
}

.mega-menu-link:hover .mega-menu-icon {
    animation: none;
}

/* Flèche du dropdown */
.mega-dropdown .caret {
    transition: transform 0.3s ease;
}

.mega-dropdown:hover .caret,
.mega-dropdown.open .caret {
    transform: rotate(180deg);
}

/* Amélioration de l'accessibilité */
.mega-menu-link:focus {
    outline: 2px solid #2048ad;
    outline-offset: 2px;
}

/* Effet de survol sur le container principal */
.mega-dropdown > a {
    transition: all 0.3s ease;
}

.mega-dropdown:hover > a {
    background-color: rgba(32, 72, 173, 0.1);
    border-radius: 6px;
    padding: 8px 12px;
    margin: -8px -12px;
}

/* Intégration avec Bootstrap et navigation principale */
.nav-item.dropdown .dropdown-toggle::after {
    display: none; /* Masquer la flèche Bootstrap par défaut */
}

.nav-item.mega-dropdown .nav-link {
    position: relative;
}

/* Assurer que le mega menu s'affiche au-dessus des autres éléments */
.main-navigation {
    position: relative;
    z-index: 100;
}

.mega-menu {
    z-index: 1050; /* Au-dessus des modales Bootstrap */
}

/* Styles pour les liens de navigation avec dropdown */
.nav-link.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link .caret {
    font-size: 12px;
    opacity: 0.7;
}