/* ========================================
   UNIFIED HEADER - Design Moderne et Professionnel Responsive
   Congrégation des Augustins de l'Assomption - Province d'Afrique
   Un seul design unifié pour tous les appareils
   ======================================== */

/* ====== Variables de Design ====== */
:root {
    --header-height: 80px;
    --header-height-scrolled: 70px;
    --header-bg-primary: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    --header-bg-scrolled: rgba(30, 64, 175, 0.95);
    --header-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --header-shadow-scrolled: 0 2px 15px rgba(0, 0, 0, 0.2);
    --mega-menu-width: 1140px;
    --transition-speed: 0.3s;
    --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --primary-color: #1e40af;
    --primary-light: #3b82f6;
    --accent-color: #60a5fa;
}

/* ====== Reset Bootstrap Navbar ====== */
.navbar-collapse {
    flex-grow: 1;
    align-items: center;
    display: flex;
    justify-content: flex-end;
}

.navbar-collapse .navbar-nav {
    align-items: center;
    height: 100%;
}

/* ====== Navigation Principal ====== */
.navbar {
    background: var(--header-bg-primary) !important;
    box-shadow: var(--header-shadow);
    padding: 0.75rem 0 !important;
    transition: all var(--transition-speed) var(--transition-ease);
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-height: 80px;
    display: flex;
    align-items: center;
}

.navbar .container {
    display: flex;
    align-items: center;
    width: 100%;
    flex-wrap: nowrap;
}

/* Effet au scroll */
.navbar.scrolled {
    background: var(--header-bg-scrolled) !important;
    box-shadow: var(--header-shadow-scrolled);
    padding: 0.5rem 0 !important;
}

/* Animation d'apparition au chargement */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.navbar {
    animation: slideDown 0.5s var(--transition-ease);
}

/* ====== Logo / Brand ====== */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: white !important;
    transition: all var(--transition-speed) var(--transition-ease);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.5rem 0;
    line-height: 1.5;
    height: 100%;
    min-height: 45px;
}

.navbar-brand:hover {
    transform: translateY(-2px);
}

.navbar-brand i {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #f4d03f 0%, #f39c12 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: all var(--transition-speed) var(--transition-ease);
}

.navbar-brand:hover i {
    transform: scale(1.1) rotate(5deg);
}

.brand-text {
    color: white;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ====== Navigation Links ====== */
.navbar-nav {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1.2rem !important;
    margin: 0 0.2rem;
    border-radius: 8px;
    position: relative;
    transition: all var(--transition-speed) var(--transition-ease);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    white-space: nowrap;
    height: 100%;
    min-height: 45px;
}

/* Effet de fond au hover */
.navbar-nav .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-speed) var(--transition-ease);
    z-index: -1;
    border-radius: 8px;
}

.navbar-nav .nav-link:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.navbar-nav .nav-link:hover {
    color: white !important;
    transform: translateY(-2px);
}

/* Ligne animée sous le lien actif */
.navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 3px;
    background: linear-gradient(90deg, #f4d03f 0%, #f39c12 100%);
    border-radius: 2px;
    animation: expandWidth 0.5s var(--transition-ease);
}

@keyframes expandWidth {
    from {
        width: 0;
        left: 50%;
    }
    to {
        width: calc(100% - 2rem);
        left: 1rem;
    }
}

/* Icônes dans les liens */
.navbar-nav .nav-link i {
    transition: transform var(--transition-speed) var(--transition-ease);
    margin-right: 0.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    font-size: 1rem;
    line-height: 1;
    width: 18px;
    text-align: center;
}

.navbar-nav .nav-link:hover i {
    transform: scale(1.15);
}

/* Alignement du texte dans les liens */
.navbar-nav .nav-link {
    text-align: left;
}

.navbar-nav .nav-link span,
.navbar-nav .nav-link:not(:has(i)) {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* ====== Mega Menu Design (Desktop >= 992px) ====== */
@media (min-width: 992px) {
    .mega-menu {
        position: static !important;
    }

    .mega-dropdown {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        background: white;
        border: none;
        border-radius: 0 0 15px 15px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        padding: 2rem 0;
        margin-top: 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-20px);
        transition: all var(--transition-speed) var(--transition-ease);
        max-width: var(--mega-menu-width);
        margin-left: auto;
        margin-right: auto;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 1050;
    }

    /* Desktop hover */
    .mega-menu:hover .mega-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* Show class pour compatibilité */
    .mega-menu.show .mega-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* Animation d'apparition progressive */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Styles Desktop pour le mega menu (>= 992px) */
@media (min-width: 992px) {
    .mega-dropdown.show .dropdown-item,
    .mega-menu:hover .mega-dropdown .dropdown-item {
        animation: fadeInUp 0.4s var(--transition-ease) forwards;
    }

    .mega-dropdown .dropdown-item:nth-child(1) { animation-delay: 0.05s; }
    .mega-dropdown .dropdown-item:nth-child(2) { animation-delay: 0.1s; }
    .mega-dropdown .dropdown-item:nth-child(3) { animation-delay: 0.15s; }
    .mega-dropdown .dropdown-item:nth-child(4) { animation-delay: 0.2s; }
    .mega-dropdown .dropdown-item:nth-child(5) { animation-delay: 0.25s; }

    /* En-têtes des sections du mega menu */
    .mega-dropdown .dropdown-header {
        color: var(--primary-color);
        font-weight: 700;
        font-size: 1rem;
        padding: 0.5rem 1.5rem;
        margin-bottom: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        position: relative;
        border-left: 4px solid var(--primary-light);
        background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, transparent 100%);
    }

    .mega-dropdown .dropdown-header i {
        color: var(--primary-light);
        margin-right: 0.5rem;
        font-size: 1.1rem;
    }

    /* Items du mega menu */
    .mega-dropdown .dropdown-item {
        color: #4b5563;
        padding: 0.75rem 1.5rem;
        margin: 0.25rem 0.5rem;
        border-radius: 8px;
        transition: all var(--transition-speed) var(--transition-ease);
        font-weight: 500;
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: center;
        background: transparent;
        border: none;
    }

    .mega-dropdown .dropdown-item::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-color) 100%);
        transform: scaleY(0);
        transition: transform var(--transition-speed) var(--transition-ease);
    }

    .mega-dropdown .dropdown-item:hover::before {
        transform: scaleY(1);
    }

    .mega-dropdown .dropdown-item:hover {
        background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, transparent 100%);
        color: var(--primary-color);
        padding-left: 2rem;
    }

    .mega-dropdown .dropdown-item i {
        color: var(--primary-light);
        margin-right: 0.75rem;
        width: 20px;
        text-align: center;
        transition: all var(--transition-speed) var(--transition-ease);
    }

    .mega-dropdown .dropdown-item:hover i {
        transform: translateX(5px) scale(1.1);
    }
}

/* ====== Search Button ====== */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all var(--transition-speed) var(--transition-ease);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.search-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.search-btn:hover::before {
    width: 100%;
    height: 100%;
}

.search-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.search-btn i {
    position: relative;
    z-index: 1;
    font-size: 1.1rem;
}

/* ====== Donation Button ====== */
.btn-donation {
    background: linear-gradient(135deg, #f4d03f 0%, #f39c12 100%);
    border: none;
    border-radius: 25px;
    padding: 0.6rem 1.8rem;
    color: #1a1a2e;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition-speed) var(--transition-ease);
    box-shadow: 0 4px 15px rgba(244, 208, 63, 0.4);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    line-height: 1.5;
    height: 45px;
    flex-shrink: 0;
}

.btn-donation::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.btn-donation:hover::before {
    left: 100%;
}

.btn-donation:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: #1a1a2e;
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(244, 208, 63, 0.5);
}

.btn-donation i {
    color: #e74c3c;
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    10%, 30% { transform: scale(1.1); }
    20%, 40% { transform: scale(0.95); }
}

.btn-donation:hover i {
    animation: heartbeat 0.8s infinite;
}

/* ====== Mobile Menu Toggle ====== */
.navbar-toggler {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: all var(--transition-speed) var(--transition-ease);
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ====== RESPONSIVE DESIGN ====== */

/* ====== Tablette (< 1200px) ====== */
@media (max-width: 1199.98px) {
    .navbar-brand {
        font-size: 1.3rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.6rem 0.9rem !important;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .search-btn {
        width: 40px;
        height: 40px;
    }
    
    .btn-donation {
        padding: 0.5rem 1.5rem;
        font-size: 0.9rem;
        height: 40px;
    }
    
    .btn-outline-light {
        height: 40px;
        padding: 0.4rem 0.9rem;
    }
}

/* ====== MOBILE (< 992px) - Menu Simple et Direct ====== */
@media (max-width: 991.98px) {
    /* Navbar container */
    .navbar {
        padding: 0.5rem 0 !important;
    }
    
    /* Collapse container - Menu mobile simplifié */
    .navbar-collapse {
        background: linear-gradient(135deg, rgba(26, 32, 44, 0.98) 0%, rgba(45, 55, 72, 0.98) 50%, rgba(74, 85, 104, 0.98) 100%);
        margin-top: 1rem;
        padding: 0.75rem;
        border-radius: 15px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .navbar-nav {
        gap: 0;
    }
    
    /* ====== MOBILE: Cacher les menus parents (À Propos, Formation, etc.) ====== */
    .mega-menu > .nav-link.dropdown-toggle {
        display: none !important;
    }
    
    /* ====== MOBILE: Afficher tous les liens directement ====== */
    .mega-dropdown {
        /* Toujours visible sur mobile */
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        max-height: none !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: none !important;
    }
    
    .mega-dropdown .container {
        padding: 0;
        max-width: 100%;
    }
    
    .mega-dropdown .row {
        margin: 0;
    }
    
    .mega-dropdown .col-lg-4,
    .mega-dropdown .col-lg-6 {
        padding: 0;
        margin: 0;
    }
    
    /* ====== Headers de sections - Style séparateurs ====== */
    .mega-dropdown .dropdown-header {
        color: rgba(96, 165, 250, 0.9);
        background: transparent;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
        padding: 0.75rem 0.5rem 0.4rem;
        margin: 0.5rem 0 0.25rem;
    }
    
    .mega-dropdown .dropdown-header:first-child {
        margin-top: 0;
    }
    
    .mega-dropdown .dropdown-header i {
        display: none; /* Cacher les icônes des headers pour gagner de l'espace */
    }
    
    /* ====== Liens mobiles - Liste simple et directe ====== */
    .navbar-nav .nav-link,
    .mega-dropdown .dropdown-item {
        color: rgba(255, 255, 255, 0.95) !important;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        margin: 0.2rem 0;
        padding: 0.75rem 0.9rem !important;
        border-radius: 8px;
        display: flex;
        align-items: center;
        font-size: 0.9rem;
        font-weight: 500;
        transition: all 0.2s ease;
    }
    
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link:active,
    .mega-dropdown .dropdown-item:hover,
    .mega-dropdown .dropdown-item:active {
        background: rgba(96, 165, 250, 0.2) !important;
        border-color: rgba(96, 165, 250, 0.3);
        color: white !important;
        transform: translateX(3px);
    }
    
    /* Icônes des liens */
    .navbar-nav .nav-link i,
    .mega-dropdown .dropdown-item i {
        color: var(--accent-color);
        margin-right: 0.6rem;
        font-size: 1rem;
        width: 20px;
        text-align: center;
    }
    
    /* Lien actif */
    .navbar-nav .nav-link.active,
    .mega-dropdown .dropdown-item.active {
        background: rgba(96, 165, 250, 0.25) !important;
        border-color: rgba(96, 165, 250, 0.4);
        font-weight: 600;
    }
    
    /* Actions container (search & donation) */
    .navbar-nav ~ .d-flex {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        gap: 1rem;
        justify-content: center;
    }
    
    .search-container {
        flex: 1;
        max-width: 150px;
    }
    
    .search-btn {
        width: 100%;
        border-radius: 10px;
        height: 45px;
    }
    
    .btn-donation {
        flex: 1;
        max-width: 150px;
        text-align: center;
        justify-content: center;
    }
}

/* ====== Smartphone (< 768px) ====== */
@media (max-width: 767.98px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-brand i {
        font-size: 1.5rem;
    }
    
    .navbar-collapse {
        padding: 1rem;
    }
    
    .mega-dropdown .dropdown-header {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    .mega-dropdown .dropdown-item {
        font-size: 0.85rem;
        padding: 0.6rem 0.85rem;
    }
}

/* ====== Très petit écran (< 576px) ====== */
@media (max-width: 575.98px) {
    .navbar {
        padding: 0.4rem 0 !important;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .brand-text {
        max-width: 200px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .navbar-collapse {
        padding: 0.85rem;
        margin-top: 0.75rem;
    }
    
    /* Stack search and donation vertically on very small screens */
    .navbar-nav ~ .d-flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-container,
    .btn-donation {
        max-width: 100%;
        width: 100%;
    }
}

/* ====== Effets de Performance ====== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ====== Accessibilité ====== */
.navbar-nav .nav-link:focus,
.search-btn:focus,
.btn-donation:focus,
.navbar-toggler:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.dropdown-item:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Mode sombre automatique (optionnel) */
@media (prefers-color-scheme: dark) {
    .mega-dropdown {
        background: #1f2937;
        color: #e5e7eb;
    }
    
    .mega-dropdown .dropdown-item {
        color: #d1d5db;
    }
    
    .mega-dropdown .dropdown-item:hover {
        background: rgba(59, 130, 246, 0.2);
        color: #f9fafb;
    }
}

/* ====== Animations Supplémentaires ====== */

/* Pulse pour attirer l'attention sur le bouton de don */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(244, 208, 63, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(244, 208, 63, 0.6);
    }
}

.btn-donation {
    animation: pulse 3s infinite;
}

/* ====== Bouton Pensée du Jour ====== */
.btn-outline-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    line-height: 1.5;
    height: 45px;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    flex-shrink: 0;
}

.btn-outline-light i {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 0.4rem;
    font-size: 1rem;
    line-height: 1;
}

/* ====== Container des actions (Search, Pensée, Don) ====== */
.navbar .d-flex.align-items-center {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem;
    flex-wrap: nowrap;
    margin-left: 1rem;
}

/* ====== Dropdown Toggle Alignment ====== */
.navbar-nav .nav-link.dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.5rem;
    vertical-align: middle;
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
    transition: transform var(--transition-speed) var(--transition-ease);
}

.navbar-nav .nav-link.dropdown-toggle:hover::after,
.navbar-nav .nav-link.dropdown-toggle.show::after {
    transform: rotate(180deg);
}

/* ====== Amélioration de l'alignement vertical global ====== */
@media (min-width: 992px) {
    .navbar .container {
        align-items: center;
    }
    
    .navbar-nav .nav-link {
        align-items: center;
        vertical-align: middle;
    }
    
    /* S'assurer que tous les éléments sont alignés sur la même ligne de base */
    .navbar-brand,
    .navbar-nav .nav-link,
    .search-btn,
    .btn-outline-light,
    .btn-donation {
        vertical-align: middle;
    }
}

/* ====== Print Styles ====== */
@media print {
    .navbar,
    .search-container,
    .btn-donation {
        display: none;
    }
}

