/* ============================================================
   HEADER MEMBRE - STYLES (VERSION PRO AMÉLIORÉE)
   ============================================================ */

/* --- Conteneur principal du header --- */
.bps-member-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 8px 20px;
    position: sticky;
    top: 0;
    z-index: 99999;
    border-bottom: 3px solid #800020;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bps-header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

/* --- Partie gauche (Avatar + Infos) --- */
.bps-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bps-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #800020;
    object-fit: cover;
    flex-shrink: 0;
}

.bps-header-name {
    font-weight: 500;
    font-size: 14px;
    color: #fff;
}

.bps-header-badge {
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}

.bps-header-badge.vip {
    background: #ef4444;
    color: #fff;
}

.bps-header-badge.standard {
    background: #3b82f6;
    color: #fff;
}

.bps-header-stats {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    margin-left: 5px;
}

/* --- Partie droite (Toggle + Dropdown) --- */
.bps-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.bps-header-user-menu {
    position: relative;
    display: inline-block;
}

/* --- Bouton Toggle (▼) --- */
.bps-header-toggle {
    background: rgba(255,255,255,0.08);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.25s ease, transform 0.2s ease;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
}

.bps-header-toggle:hover {
    background: rgba(255,255,255,0.16);
    transform: scale(1.02);
}

.bps-header-toggle:active {
    transform: scale(0.96);
}

.bps-header-toggle:focus {
    outline: 2px solid #800020;
    outline-offset: 2px;
}

.bps-header-toggle.active {
    background: rgba(255,255,255,0.15);
}

.bps-header-arrow {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
    margin-left: 4px;
}

.bps-header-toggle.active .bps-header-arrow {
    transform: rotate(180deg);
}

/* ============================================================
   MENU DÉROULANT (DROPDOWN) - CENTRÉ
   ============================================================ */

.bps-member-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 50%;
    transform: translateX(50%);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    min-width: 280px;
    max-width: 340px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
    z-index: 100000;
    animation: bpsDropdownIn 0.25s ease;
}

.bps-member-dropdown.active {
    display: block !important;
}

@keyframes bpsDropdownIn {
    from { opacity: 0; transform: translateX(50%) translateY(-12px) scale(0.97); }
    to { opacity: 1; transform: translateX(50%) translateY(0) scale(1); }
}

/* --- EN-TÊTE DU DROPDOWN --- */
.bps-dropdown-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 14px;
}

.bps-dropdown-avatar {
    flex-shrink: 0;
}

.bps-dropdown-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #800020;
    object-fit: cover;
    display: block;
}

.bps-dropdown-user {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bps-dropdown-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
    line-height: 1.3;
    margin: 0;
}

.bps-dropdown-email {
    font-size: 12px;
    color: #6b7280;
    word-break: break-all;
    line-height: 1.3;
    margin: 0;
}

.bps-dropdown-level {
    font-size: 12px;
    margin: 0;
}

.bps-dropdown-level .member-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.bps-dropdown-level .member-badge.vip {
    background: #fee2e2;
    color: #991b1b;
}

.bps-dropdown-level .member-badge.standard {
    background: #dbeafe;
    color: #1e40af;
}

.bps-dropdown-stats {
    font-size: 11px;
    color: #6b7280;
    margin: 0;
}

/* --- SÉPARATEURS --- */
.bps-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 10px;
}

.bps-dropdown-divider.danger-divider {
    margin-top: 2px;
    background: #fca5a5;
}

/* --- ÉLÉMENTS DU MENU (LIENS) - TEXTE À GAUCHE --- */
.bps-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s ease;
    font-size: 14px;
    font-family: inherit;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    line-height: 1.4;
}

.bps-dropdown-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.bps-dropdown-item:focus {
    background: #f3f4f6;
    outline: 2px solid #800020;
    outline-offset: -2px;
}

.bps-dropdown-item .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    color: #4b5563;
    transition: color 0.2s ease;
}

.bps-dropdown-item:hover .icon {
    color: #800020;
}

.bps-dropdown-item .label {
    flex: 0 1 auto;
    color: #374151;
    font-weight: 500;
    text-align: left;
}

/* --- ZONE DANGER (DÉCONNEXION) --- */
.bps-dropdown-item.danger {
    color: #dc3545;
    border-top: 1px solid #f3f4f6;
    margin-top: 4px;
    padding-top: 12px;
}

.bps-dropdown-item.danger:hover {
    background: #fef2f2;
    color: #dc3545;
}

.bps-dropdown-item.danger .icon {
    color: #dc3545;
}

.bps-dropdown-item.danger:hover .icon {
    color: #b91c1c;
}

.bps-dropdown-item.danger .label {
    color: #dc3545;
}

/* ============================================================
   RESPONSIVE - ADAPTATION MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .bps-member-header { padding: 6px 14px; }
    .bps-header-name { font-size: 12px; }
    .bps-header-avatar { width: 28px; height: 28px; }
    .bps-header-badge { font-size: 8px; padding: 1px 10px; }
    
    .bps-member-dropdown {
        right: 0;
        transform: none;
        min-width: 240px;
        max-width: 300px;
    }
    
    @keyframes bpsDropdownIn {
        from { opacity: 0; transform: translateY(-12px) scale(0.97); }
        to { opacity: 1; transform: translateY(0) scale(1); }
    }
    
    .bps-dropdown-item { padding: 8px 16px; font-size: 13px; }
    .bps-dropdown-header { padding: 12px 16px; }
    .bps-dropdown-name { font-size: 14px; }
    .bps-dropdown-email { font-size: 11px; }
    .bps-dropdown-avatar img { width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    .bps-member-header { padding: 4px 10px; }
    .bps-header-name { font-size: 11px; }
    .bps-header-badge { font-size: 7px; padding: 1px 8px; }
    .bps-header-avatar { width: 24px; height: 24px; }
    
    .bps-member-dropdown {
        right: -5px;
        transform: none;
        min-width: 200px;
        max-width: 280px;
        border-radius: 12px;
    }
    
    .bps-dropdown-item { padding: 8px 14px; font-size: 12px; }
    .bps-dropdown-item .icon { font-size: 16px; width: 20px; }
    .bps-dropdown-header { padding: 10px 14px; }
    .bps-dropdown-name { font-size: 13px; }
    .bps-dropdown-email { font-size: 10px; }
    .bps-dropdown-avatar img { width: 36px; height: 36px; }
}