/* ============================================================================
   HEADER - Barre de navigation principale
   Architecture: BEM (Block Element Modifier)
   ============================================================================ */

/* ============================================================================
   BLOCK: header
   ============================================================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ============================================================================
   ELEMENT: header__logo
   ============================================================================ */
.header__logo {
    flex-shrink: 0;
}

.header__logo-link {
    font-size: 28px;
    color: #000;
    font-weight: bold;
    text-decoration: none;
    transition: color 0.2s;
}

.header__logo-link:hover {
    color: #024735;
}

/* ============================================================================
   ELEMENT: header__menu (Navigation)
   ============================================================================ */
.header__menu {
    flex: 1;
    display: flex;
    justify-content: center;
}

.header__menu-list {
    display: flex;
    gap: 15px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header__menu-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #000;
    padding: 10px 15px;
    border-radius: 5px;
    transition: all 0.2s;
}

.header__menu-link:hover {
    background: #f7f7f7;
}

.header__menu-icon {
    margin-right: 10px;
    font-size: 18px;
}

.header__menu-text {
    font-size: 14px;
}

/* MODIFIER: header__menu-item--active */
.header__menu-item--active .header__menu-link {
    background: #f7f7f7;
}

/* ============================================================================
   ELEMENT: header__actions (Zone droite: recherche + profil)
   ============================================================================ */
.header__actions {
    display: flex;
    align-items: center;
    position: relative;
    gap: 15px;
    flex-shrink: 0;
}

/* ============================================================================
   ELEMENT: header__avatar (Avatar utilisateur)
   ============================================================================ */
.header__avatar {
    width: 40px;
    height: 40px;
    background: #A7ACB4;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.header__avatar:hover {
    background: #8b9099;
}

.header__avatar-text {
    font-size: 14px;
    text-transform: uppercase;
}

/* ============================================================================
   ELEMENT: header__dropdown (Menu déroulant profil)
   ============================================================================ */
.header__dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    border: 1px solid #eee;
    border-radius: 5px;
    width: 180px;
    padding: 0;
    margin: 0;
    list-style: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
}

.header__dropdown-link {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    color: #000;
    transition: background 0.2s;
}

.header__dropdown-link:hover {
    background: #f8f9fa;
}

/* ============================================================================
   RESPONSIVE - Mobile
   ============================================================================ */
@media (max-width: 1024px) {
    .header {
        position: static;
    }

    .header__menu {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        border-top: 1px solid #eee;
        border-bottom: none;
        z-index: 999;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    }

    .header__menu-list {
        gap: 0;
        width: 100%;
    }

    .header__menu-item {
        flex: 1;
    }

    .header__menu-link {
        border-radius: 0;
        flex-direction: column;
        padding: 8px 0;
        font-size: 10px;
        color: #777;
        align-items: center;
        justify-content: center;
    }

    .header__menu-icon {
        margin-right: 0;
        margin-bottom: 4px;
        font-size: 20px;
    }

    .header__menu-text {
        font-size: 11px;
    }

    .header__menu-item--active .header__menu-link {
        color: #024735;
        background: transparent;
    }
}

/* ============================================================================
   COMPOSANT: SEARCH BAR (depuis search-bar.php)
   ============================================================================ */
.header__search-trigger {
    font-size: 24px;
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: background 0.2s;
}

.header__search-trigger:hover {
    background: #f1f5f9;
}

.header__search-dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 300px;
    max-width: 80vw;
    z-index: 999;
}

.header__search-label {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.header__search-suggestions {
    max-height: 350px;
    overflow-y: auto;
    margin-top: 10px;
    display: none;
}

/* MODIFIER: is-active (État actif géré par JavaScript) */
.header__search-suggestions.is-active {
    display: block;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

/* États actifs pour les dropdowns */
.header__search-dropdown.is-active,
.header__dropdown.is-active,
.header__notification-dropdown.is-active {
    display: block;
}

.header__search-suggestion-item {
    display: flex;
    align-items: center;
    padding: 10px;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.2s;
}

.header__search-suggestion-item:hover {
    background: #f8f9fa;
}

.header__search-suggestion-avatar {
    background-color: #024735;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.header__search-suggestion-info {
    flex: 1;
    min-width: 0;
}

.header__search-suggestion-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #000;
    margin-bottom: 2px;
}

.header__search-suggestion-subtitle {
    font-size: 12px;
    color: #888;
}

.header__search-suggestion-empty {
    padding: 12px 0;
    text-align: center;
    color: #666;
    font-size: 0.9em;
    font-style: italic;
    border-bottom: 1px solid #eee;
}

.header__search-suggestion-footer {
    padding: 10px;
    text-align: center;
    font-size: 13px;
    color: #000;
    font-weight: 600;
    cursor: pointer;
    margin-top: 5px;
    background: #f8f9fa;
    border-radius: 5px;
    transition: background 0.2s;
}

.header__search-suggestion-footer:hover {
    background: #eee;
}

/* ============================================================================
   COMPOSANT: NOTIFICATIONS (depuis notifications.php)
   ============================================================================ */
.header__notification-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    text-decoration: none;
    transition: background 0.3s ease;
    cursor: pointer;
}

.header__notification-trigger:hover {
    background-color: #f1f5f9;
}

.header__notification-trigger i {
    font-size: 24px;
    line-height: 1;
    color: #000;
}

.header__notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    border: 2px solid #fff;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header__notification-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    width: 360px;
    max-width: 80vw;
    background: #ffffff;
    border-radius: 5px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    z-index: 999;
}

.header__notification-title {
    padding: 15px 20px;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid #f1f5f9;
}

.header__notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.header__notification-item {
    display: flex;
    padding: 16px 20px;
    position: relative;
    transition: background 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.header__notification-item:hover {
    background-color: #f8fafc;
}

/* MODIFIER: header__notification-item--unread */
.header__notification-item--unread {
    background-color: #f0f7ff;
}

.header__notification-avatar {
    width: 42px;
    height: 42px;
    background-color: #9d66ff;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
}

.header__notification-avatar i {
    color: white;
    font-size: 18px;
}

.header__notification-content {
    flex: 1;
    min-width: 0;
}

.header__notification-content p {
    margin: 0;
    font-size: 14px;
    color: #1e293b;
    line-height: 1.4;
}

.header__notification-content p strong {
    font-weight: 700;
}

.header__notification-time {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.header__notification-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: #000;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-top: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.header__notification-footer:hover {
    background-color: #f8fafc;
    text-decoration: none;
}
