/**
 * PHASE 5 : BANDEAU FLASH INFOS - STYLES CSS
 * Le Bulletin Économique
 * Fichier: assets/css/flash-news.css
 * 
 * Design inspiré des chaînes d'info en continu (CNN, BFM, etc.)
 * Bandeau rouge avec animation fluide
 */

/* =============================================================================
   1. CONTENEUR PRINCIPAL DU BANDEAU FLASH
   ============================================================================= */

.flash-news-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    display: flex;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-family: var(--font-heading, 'Inter', sans-serif);
    transition: transform 0.3s ease-out;
}

/* État fermé (slide up) */
.flash-news-wrapper.is-closed {
    transform: translateY(-100%);
}

/* Ajuster le contenu du site pour compenser la hauteur du bandeau */
body.has-flash-news {
    padding-top: 50px;
}

body.has-flash-news.flash-closed {
    padding-top: 0;
}


/* =============================================================================
   2. LABEL "FLASH INFO" FIXE À GAUCHE
   ============================================================================= */

.flash-label {
    background: rgba(0, 0, 0, 0.3);
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    color: #ffffff;
    text-transform: uppercase;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.flash-icon svg {
    animation: flashPulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

@keyframes flashPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}


/* =============================================================================
   3. ZONE DE DÉFILEMENT (TICKER)
   ============================================================================= */

.flash-ticker-container {
    flex-grow: 1;
    overflow: hidden;
    height: 100%;
    position: relative;
}

.flash-ticker-track {
    display: flex;
    height: 100%;
    align-items: center;
    width: max-content;
    /* L'animation sera gérée par JavaScript (GSAP) */
}

/* État de pause au survol */
.flash-ticker-container:hover .flash-ticker-track {
    animation-play-state: paused;
}


/* =============================================================================
   4. ITEMS INDIVIDUELS (CHAQUE FLASH INFO)
   ============================================================================= */

.flash-item {
    padding: 0 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #ffffff;
    white-space: nowrap;
    font-size: 15px;
    line-height: 1.4;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    transition: background-color 0.2s ease;
}

.flash-item:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

/* Heure de publication */
.flash-time {
    font-weight: 700;
    font-size: 13px;
    color: #fef3c7;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px 10px;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}

/* Texte de la flash info */
.flash-text {
    font-weight: 500;
    color: #ffffff;
}

/* Lien cliquable */
.flash-text a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.flash-text a:hover {
    opacity: 0.85;
    text-decoration: underline;
}

/* Badge de catégorie (optionnel) */
.flash-category {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}


/* =============================================================================
   5. NIVEAUX D'URGENCE (COULEURS DIFFÉRENTES)
   ============================================================================= */

/* Normal - Rouge standard (déjà défini) */
.flash-item.urgency-normal {
    /* Couleur par défaut du bandeau */
}

/* Important - Orange vif */
.flash-news-wrapper.has-important {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
}

/* Urgent - Rouge intense + animation */
.flash-news-wrapper.has-urgent {
    background: linear-gradient(135deg, #dc2626 0%, #7f1d1d 100%);
    animation: urgentPulse 1.5s ease-in-out infinite;
}

@keyframes urgentPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(220, 38, 38, 0.5);
    }
    50% {
        box-shadow: 0 4px 24px rgba(220, 38, 38, 0.8);
    }
}


/* =============================================================================
   6. CONTRÔLES (PAUSE / FERMER)
   ============================================================================= */

.flash-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 15px;
    flex-shrink: 0;
}

.flash-control-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.flash-control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.flash-control-btn:active {
    transform: scale(0.95);
}

/* État "pause" actif */
.flash-control-btn.is-paused {
    background: rgba(255, 255, 255, 0.3);
}


/* =============================================================================
   7. ÉTAT DE CHARGEMENT
   ============================================================================= */

.flash-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 30px;
    color: #ffffff;
    font-size: 14px;
}

.flash-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* =============================================================================
   8. ANIMATION D'APPARITION POUR NOUVELLES FLASH INFOS
   ============================================================================= */

@keyframes flashSlideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.flash-item.is-new {
    animation: flashSlideIn 0.5s ease-out;
}

/* Effet de brillance sur nouvelle flash */
.flash-item.is-new::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shine 1s ease-in-out;
}

@keyframes shine {
    to {
        left: 100%;
    }
}


/* =============================================================================
   9. RESPONSIVE DESIGN
   ============================================================================= */

/* Tablettes et petits écrans */
@media (max-width: 768px) {
    .flash-news-wrapper {
        height: 44px;
    }
    
    body.has-flash-news {
        padding-top: 44px;
    }
    
    .flash-label {
        padding: 0 12px;
        font-size: 12px;
    }
    
    .flash-text {
        display: none; /* Cacher le mot "FLASH INFO" */
    }
    
    .flash-item {
        padding: 0 20px;
        font-size: 14px;
    }
    
    .flash-time {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    .flash-category {
        display: none; /* Économiser de l'espace */
    }
}

/* Mobiles */
@media (max-width: 480px) {
    .flash-news-wrapper {
        height: 40px;
    }
    
    body.has-flash-news {
        padding-top: 40px;
    }
    
    .flash-item {
        padding: 0 15px;
        font-size: 13px;
    }
    
    .flash-controls {
        padding: 0 10px;
        gap: 3px;
    }
    
    .flash-control-btn {
        width: 28px;
        height: 28px;
    }
}


/* =============================================================================
   10. MODE SOMBRE (DARK MODE)
   ============================================================================= */

@media (prefers-color-scheme: dark) {
    .flash-news-wrapper {
        /* Le bandeau reste rouge même en dark mode pour visibilité */
    }
    
    .flash-time {
        color: #fef3c7;
    }
}


/* =============================================================================
   11. ACCESSIBILITÉ
   ============================================================================= */

/* Focus visible pour navigation clavier */
.flash-control-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.flash-text a:focus {
    outline: 2px solid #fef3c7;
    outline-offset: 2px;
}

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .flash-news-wrapper,
    .flash-item,
    .flash-control-btn,
    .flash-icon svg {
        animation: none !important;
        transition: none !important;
    }
}


/* =============================================================================
   12. PRINT STYLES (CACHER LE BANDEAU À L'IMPRESSION)
   ============================================================================= */

@media print {
    .flash-news-wrapper {
        display: none !important;
    }
    
    body.has-flash-news {
        padding-top: 0 !important;
    }
}
