/* Fichier : css/header.css */

header {
    /* 1. POSITION STICKY (COLLANT) */
    position: sticky;
    top: 0;
    left: 0;
    z-index: 10000;
    
    /* 2. DIMENSIONS ET SCROLL */
    width: 100%;
    min-width: 1000px; /* Force la largeur pour ne pas écraser le contenu */
    height: 70px;
    
    /* 3. ESTHÉTIQUE */
    background-color: #ffffff; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 0 20px;
    box-sizing: border-box;
    
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    /* 4. SCROLLBAR (Firefox) */
    scrollbar-width: thin;
    scrollbar-color: #adb5bd #f1f1f1;
}

/* Responsive Mobile: ne pas forcer 1000px sur petits écrans */
@media (max-width: 768px) {
    header {
        min-width: 0;
        width: 100%;
        height: 60px;
        padding: 0 12px;
    }
}

/* --- DESIGN BARRE DE DÉFILEMENT (Chrome, Edge, Safari) --- */
header::-webkit-scrollbar {
    height: 10px; /* Hauteur confortable pour la souris */
}

header::-webkit-scrollbar-track {
    background: #f1f1f1; /* Fond du rail (Gris très clair) */
}

header::-webkit-scrollbar-thumb {
    background-color: #adb5bd; /* Le curseur (Gris moyen) */
    border-radius: 4px;
    border: 2px solid #ffffff; /* Petite marge blanche autour */
}

header::-webkit-scrollbar-thumb:hover {
    background-color: #17a2b8; /* Devient CYAN au survol ! */
    cursor: grab;
}

/* --- LE RESTE DE TON STYLE (INCHANGÉ) --- */

header h1, 
.header-actions {
    flex-shrink: 0; 
}

.simulation-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, #e8f7fb 0%, #f2fcff 100%);
    border: 1px solid #b6ecf7;
    color: #0c5460;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(12, 84, 96, 0.12);
    white-space: nowrap;
    overflow: hidden;
}

.simulation-indicator.hidden {
    display: none;
}

.simulation-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #17a2b8;
    box-shadow: 0 0 0 6px rgba(23, 162, 184, 0.15);
}

.simulation-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.simulation-date {
    color: #0c5460;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.simulation-indicator.simulation-indicator--compact {
    gap: 6px;
    padding: 6px 8px;
    font-size: 0.82rem;
}

.simulation-indicator.simulation-indicator--compact .simulation-label {
    display: none;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #343a40;
    font-weight: 700;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
}

.header-brand-logo {
    width: 44px;
    height: auto;
    margin-right: 10px;
    flex: 0 0 auto;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

@media (max-width: 768px) {
    .header-brand-logo {
        width: 36px;
        margin-right: 8px;
    }
}

.header-actions {
    display: flex;
    gap: 10px;
}

#header-kyc-alerts-btn.kyc-has-notifs {
    animation: kycEnvelopePulse 1.8s ease-in-out infinite;
}

@keyframes kycEnvelopePulse {
    0%, 100% {
        opacity: 1;
        filter: brightness(1);
    }
    50% {
        opacity: 0.82;
        filter: brightness(1.12);
    }
}

@media (prefers-reduced-motion: reduce) {
    #header-kyc-alerts-btn.kyc-has-notifs {
        animation: none;
    }
}

.header-actions button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    color: white;
    transition: transform 0.1s, opacity 0.2s;
}

.header-actions button:active {
    transform: scale(0.98);
}

/* Couleurs spécifiques */
#import-xlsx-btn { background-color: #17a2b8; }
#import-csv-btn { background-color: #6610f2; }
#export-csv-btn { background-color: #ffc107; color: #333 !important; }
#logout-button { 
    transition: background-color 0.2s, transform 0.1s;
}
#logout-button:hover {
    background-color: rgba(220, 53, 69, 0.1);
}
#logout-button:active {
    transform: scale(0.95);
}

/* Inputs cachés */
#import-xlsx-input, 
#import-csv-input {
    display: none;
}

/* --- DROPDOWN EXPORTER --- */
.dropdown-exporter {
    position: relative;
    display: inline-block;
    z-index: 2000;
}

.btn-exporter {
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-exporter:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.dropdown-menu-exporter {
    position: fixed;
    top: 75px;
    right: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 0;
    width: max-content;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 3000 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-menu-exporter.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.dropdown-section {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-section:last-child {
    border-bottom: none;
}

.dropdown-section strong {
    display: block;
    color: #495057;
    font-size: 0.8rem;
    margin: 0 16px 8px 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    display: flex !important;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: #212529 !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    transition: all 0.2s;
    border-radius: 0;
    white-space: nowrap;
    gap: 8px;
}

.dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #0056b3 !important;
    padding-left: 20px;
}

.dropdown-item:active {
    background-color: #e9ecef;
}

.dropdown-timestamp {
    display: block;
    color: #6c757d;
    font-size: 0.75rem;
    font-style: italic;
    margin: 4px 16px 0 16px;
    padding-bottom: 4px;
}

/* Focus visible sur les actions de la modal de déconnexion */
#logout-confirm-yes:focus-visible {
    outline: 3px solid #17a2b8;
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.35);
}

#logout-confirm-no:focus-visible {
    outline: 3px solid #adb5bd;
}

/* Fallback pour navigateurs sans :focus-visible */
#logout-confirm-yes:focus {
    outline: 3px solid #17a2b8;
}
#logout-confirm-no:focus {
    outline: 3px solid #adb5bd;
}