/**
 * ════════════════════════════════════════════════════════════════
 * MARKET SENTIMENT DASHBOARD - STYLES ULTRA-STYLISÉS (VERSION FINALE)
 * ════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════
   TITRES EN DÉGRADÉ BLEU/VIOLET
   ═══════════════════════════════════════════════════════════════ */

.gradient-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.gradient-title i {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   BOUTON REFRESH STYLISÉ
   ═══════════════════════════════════════════════════════════════ */

.refresh-btn {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 12px 24px !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}

.refresh-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6) !important;
}

.refresh-btn i {
    font-size: 1rem !important;
}

/* ═══════════════════════════════════════════════════════════════
   GLOBAL MARKET SENTIMENT (STYLISÉ AVEC GLASSMORPHISM)
   ═══════════════════════════════════════════════════════════════ */

.global-sentiment-wrapper {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 28px;
    padding: 40px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 32px rgba(102, 126, 234, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.global-sentiment-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.12) 0%, transparent 70%);
    animation: rotateGradient 20s linear infinite;
    pointer-events: none;
}

@keyframes rotateGradient {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.global-sentiment-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.global-title {
    font-size: 2.5rem;
    margin-bottom: 12px;
    text-align: center;
}

.global-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

.global-subtitle span {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* ═══════════════════════════════════════════════════════════════
   SENTIMENT MAIN CARD - VERSION RESPONSIVE OPTIMISÉE (CORRIGÉE)
   ═══════════════════════════════════════════════════════════════ */

.sentiment-main-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 32px 40px; /* ✅ Padding réduit en haut pour remonter le doughnut */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--glass-border);
    position: relative;
    z-index: 1;
}

/* ✅ HEADER CENTRÉ */
.breakdown-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px; /* ✅ Réduit de 32px à 24px */
    text-align: center;
    width: 100%;
}

/* ✅ GRID LAYOUT DESKTOP */
.sentiment-visual-wrapper {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 48px;
    align-items: center;
}

.sentiment-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gauge-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    filter: drop-shadow(0 8px 24px rgba(102, 126, 234, 0.3));
}

#sentimentGauge {
    transition: transform 0.3s ease;
}

#sentimentGauge:hover {
    transform: scale(1.05);
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.gauge-value {
    font-size: 4rem; /* ✅ Réduit de 5rem à 4rem pour meilleure lisibilité */
    font-weight: 900;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 8px; /* ✅ Réduit de 12px à 8px */
    filter: drop-shadow(0 4px 16px rgba(102, 126, 234, 0.5));
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        filter: drop-shadow(0 4px 16px rgba(102, 126, 234, 0.5));
    }
    50% {
        filter: drop-shadow(0 6px 24px rgba(102, 126, 234, 0.8));
    }
}

.gauge-label {
    font-size: 1.1rem; /* ✅ Réduit de 1.3rem à 1.1rem */
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px; /* ✅ Réduit de 2px à 1.5px */
}

/* ═══════════════════════════════════════════════════════════════
   SENTIMENT BREAKDOWN (BARRES)
   ═══════════════════════════════════════════════════════════════ */

.sentiment-breakdown {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.breakdown-item {
    background: var(--glass-bg);
    padding: 20px;
    border-radius: 16px;
    border: 2px solid var(--glass-border);
    transition: var(--transition-smooth);
}

.breakdown-item:hover {
    transform: translateX(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.breakdown-item.positive {
    border-left: 4px solid #10b981;
}

.breakdown-item.neutral {
    border-left: 4px solid #6b7280;
}

.breakdown-item.negative {
    border-left: 4px solid #ef4444;
}

.breakdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.breakdown-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.breakdown-item.positive .breakdown-icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.breakdown-item.neutral .breakdown-icon {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

.breakdown-item.negative .breakdown-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.breakdown-label {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
}

.breakdown-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-primary);
    text-align: right;
}

.breakdown-bar {
    height: 8px;
    background: var(--glass-bg);
    border-radius: 6px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease;
}

.breakdown-bar-fill.positive {
    background: linear-gradient(90deg, #10b981, #059669);
}

.breakdown-bar-fill.neutral {
    background: linear-gradient(90deg, #6b7280, #4b5563);
}

.breakdown-bar-fill.negative {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.total-analyzed {
    text-align: center;
    padding-top: 16px;
    border-top: 2px solid var(--glass-border);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.total-analyzed span {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.3rem;
    font-weight: 900;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE TABLETTE (< 1200px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .sentiment-visual-wrapper {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .sentiment-visual {
        justify-content: center;
    }
    
    .gauge-wrapper {
        width: 260px; /* ✅ Réduit de 280px */
        height: 260px;
    }
    
    .gauge-value {
        font-size: 3rem; /* ✅ Réduit de 4rem */
    }
    
    .gauge-label {
        font-size: 0.95rem; /* ✅ Réduit de 1.1rem */
    }
    
    .breakdown-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE (< 768px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .sentiment-main-card {
        padding: 24px 16px;
    }
    
    .sentiment-visual-wrapper {
        gap: 20px; /* ✅ Réduit de 24px */
    }
    
    .gauge-wrapper {
        width: 180px; /* ✅ Fortement réduit de 240px à 180px */
        height: 180px;
        margin: 0 auto;
    }
    
    /* ✅ TEXTE CENTRAL MASQUÉ SUR MOBILE (illisible) */
    .gauge-center {
        display: none; /* ✅ Complètement masqué sur mobile */
    }
    
    .breakdown-title {
        font-size: 1.2rem;
        margin-bottom: 16px; /* ✅ Réduit de 20px */
    }
    
    .breakdown-item {
        padding: 16px;
    }
    
    .breakdown-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .breakdown-label {
        font-size: 1rem;
    }
    
    .breakdown-value {
        font-size: 1.5rem;
    }
    
    .breakdown-bar {
        height: 6px;
    }
    
    .total-analyzed {
        font-size: 0.95rem;
        flex-direction: column;
        gap: 4px;
    }
    
    .total-analyzed span {
        font-size: 1.2rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE PETIT MOBILE (< 480px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .sentiment-main-card {
        padding: 20px 12px;
        border-radius: 16px;
    }
    
    .gauge-wrapper {
        width: 160px; /* ✅ Encore plus petit */
        height: 160px;
    }
    
    /* ✅ Texte central toujours masqué */
    .gauge-center {
        display: none;
    }
    
    .breakdown-title {
        font-size: 1.1rem;
        margin-bottom: 14px;
    }
    
    .breakdown-item {
        padding: 14px;
        border-radius: 12px;
    }
    
    .breakdown-header {
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .breakdown-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .breakdown-label {
        font-size: 0.95rem;
    }
    
    .breakdown-value {
        font-size: 1.3rem;
    }
    
    .breakdown-bar {
        height: 5px;
    }
    
    .breakdown-item:hover {
        transform: translateX(4px);
    }
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════════════ */

body.dark-mode .gauge-wrapper {
    filter: drop-shadow(0 8px 24px rgba(102, 126, 234, 0.5));
}

body.dark-mode .sentiment-main-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark-mode .breakdown-item {
    background: rgba(255, 255, 255, 0.03);
}

body.dark-mode .breakdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ═══════════════════════════════════════════════════════════════
   AI INSIGHT CARD (ALIGNEMENT CORRIGÉ)
   ═══════════════════════════════════════════════════════════════ */

.ai-insight-card {
    margin-top: 32px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    padding: 32px;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    text-align: left;
}

.insight-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.insight-content {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.8;
    text-align: left;
}

.insight-content strong {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.insight-content em {
    color: var(--text-secondary);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   SENTIMENT PAR SECTEUR
   ═══════════════════════════════════════════════════════════════ */

.sector-sentiment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.sector-card {
    background: var(--card-bg);
    padding: 28px;
    border-radius: 20px;
    border: 2px solid var(--glass-border);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.sector-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--sector-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sector-card:hover::before {
    opacity: 1;
}

.sector-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    border-color: var(--sector-color);
}

.sector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sector-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sector-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--sector-gradient);
    color: white;
}

.sector-score {
    font-size: 2rem;
    font-weight: 900;
    color: var(--sector-color);
}

.sector-bar {
    height: 12px;
    background: var(--glass-bg);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.sector-bar-fill {
    height: 100%;
    background: var(--sector-gradient);
    border-radius: 8px;
    transition: width 1s ease;
}

.sector-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   SENTIMENT TABS
   ═══════════════════════════════════════════════════════════════ */

.sentiment-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 4px;
    flex-wrap: wrap;
}

.sentiment-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sentiment-tab:hover {
    color: var(--text-primary);
}

.sentiment-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom-color: #667eea;
}

.sentiment-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.sentiment-article-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border-left: 4px solid var(--sentiment-color);
    transition: var(--transition-smooth);
    cursor: pointer;
}

.sentiment-article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
}

.article-sentiment-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    background: var(--sentiment-gradient);
    margin-bottom: 12px;
}

.article-title-small {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    flex-wrap: wrap;
    gap: 8px;
}

.article-source-small {
    font-weight: 600;
}

.article-time-small {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .sentiment-main-card {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .gauge-wrapper {
        width: 280px;
        height: 280px;
    }
    
    .gauge-value {
        font-size: 4rem;
    }
}

@media (max-width: 768px) {
    .global-sentiment-wrapper {
        padding: 24px;
    }
    
    .global-title {
        font-size: 2rem;
    }
    
    .global-subtitle {
        font-size: 1rem;
    }
    
    .sentiment-main-card {
        padding: 24px;
    }
    
    .gauge-wrapper {
        width: 240px;
        height: 240px;
    }
    
    .gauge-value {
        font-size: 3rem;
    }
    
    .breakdown-title {
        font-size: 1.2rem;
    }
    
    .sector-sentiment-grid {
        grid-template-columns: 1fr;
    }
    
    .sentiment-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .sentiment-tab {
        border-bottom: none;
        border-left: 3px solid transparent;
        padding-left: 16px;
    }
    
    .sentiment-tab.active {
        border-left-color: #667eea;
        border-bottom-color: transparent;
    }
    
    .sentiment-articles-grid {
        grid-template-columns: 1fr;
    }
    
    .refresh-btn {
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    .gauge-wrapper {
        width: 200px;
        height: 200px;
    }
    
    .gauge-value {
        font-size: 2.5rem;
    }
    
    .gauge-label {
        font-size: 1rem;
    }
    
    .breakdown-value {
        font-size: 1.5rem;
    }
    
    .refresh-btn {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════ */

body.dark-mode .global-sentiment-wrapper {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.12));
    border-color: rgba(102, 126, 234, 0.4);
}

body.dark-mode .sentiment-main-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark-mode .ai-insight-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border-color: rgba(102, 126, 234, 0.5);
}

body.dark-mode .breakdown-item {
    background: rgba(255, 255, 255, 0.03);
}

body.dark-mode .breakdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ✅ BADGES ENTREPRISES & PAYS (Market Sentiment & Trending Topics) */
.entity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s ease;
    margin-right: 6px;
    margin-bottom: 6px;
}

.company-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: white;
    border: 2px solid rgba(59, 130, 246, 0.3);
}

.company-badge:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.country-badge {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white;
    border: 2px solid rgba(16, 185, 129, 0.3);
}

.country-badge:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.entity-badge i {
    font-size: 0.7em;
    opacity: 0.9;
}

.article-entities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

