/* ============================================================
   MARKET SENTIMENT DASHBOARD — Drive Style Integration
   Compatible avec drive.css — Dark par défaut / body.light-mode
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   SECTION WRAPPER (remplace common.css .section)
════════════════════════════════════════════════════════════ */

.section {
    background: var(--avd-card);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg);
    padding: 28px 32px;
    margin-bottom: 24px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 800;
    color: var(--avd-text);
    margin-bottom: 22px;
}

/* ═══════════════════════════════════════════════════════════════
   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 — Drive-compatible
   ═══════════════════════════════════════════════════════════════ */

.refresh-btn {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 7px 14px !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: var(--avd-transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
    font-family: inherit !important;
}

.refresh-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
}

.refresh-btn i {
    font-size: 11px !important;
}

/* ═══════════════════════════════════════════════════════════════
   GLOBAL MARKET SENTIMENT — Glassmorphism
   ═══════════════════════════════════════════════════════════════ */

.global-sentiment-wrapper {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.12));
    border: 2px solid rgba(102, 126, 234, 0.4);
    border-radius: 28px;
    padding: 40px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.light-mode .global-sentiment-wrapper {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    border-color: rgba(102, 126, 234, 0.3);
    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: 6px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.global-title {
    font-size: 2.2rem;
    margin-bottom: 12px;
    text-align: center;
}

.global-subtitle {
    font-size: 1rem;
    color: var(--avd-text-muted);
    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
   ═══════════════════════════════════════════════════════════════ */

.sentiment-main-card {
    background: var(--avd-card);
    border-radius: 20px;
    padding: 32px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--avd-border);
    position: relative;
    z-index: 1;
}

body.light-mode .sentiment-main-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

.breakdown-title {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
    text-align: center;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   GRID LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.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: 300px;
    height: 300px;
    filter: drop-shadow(0 8px 24px rgba(102, 126, 234, 0.5));
}

#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: 3.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 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: 1rem;
    font-weight: 800;
    color: var(--avd-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ═══════════════════════════════════════════════════════════════
   SENTIMENT BREAKDOWN (BARRES)
   ═══════════════════════════════════════════════════════════════ */

.sentiment-breakdown {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.breakdown-item {
    background: var(--avd-input-bg);
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--avd-border);
    transition: var(--avd-transition);
}

.breakdown-item:hover {
    transform: translateX(6px);
    box-shadow: var(--avd-shadow);
    border-color: var(--avd-border-hover);
}

.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: 10px;
}

.breakdown-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    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: 1rem;
    font-weight: 700;
    color: var(--avd-text);
    text-align: left;
}

.breakdown-value {
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--avd-text);
    text-align: right;
}

.breakdown-bar {
    height: 7px;
    background: var(--avd-input-bg);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--avd-border);
}

.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: 14px;
    border-top: 1px solid var(--avd-border);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--avd-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.total-analyzed span {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.2rem;
    font-weight: 900;
}

/* ═══════════════════════════════════════════════════════════════
   AI INSIGHT CARD
   ═══════════════════════════════════════════════════════════════ */

.ai-insight-card {
    margin-top: 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.14), rgba(118, 75, 162, 0.14));
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 16px;
    padding: 24px 28px;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    text-align: left;
}

body.light-mode .ai-insight-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-color: rgba(102, 126, 234, 0.3);
}

.insight-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.insight-content {
    font-size: 1rem;
    font-weight: 500;
    color: var(--avd-text);
    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(--avd-text-muted);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   SENTIMENT PAR SECTEUR
   ═══════════════════════════════════════════════════════════════ */

.sector-sentiment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.sector-card {
    background: var(--avd-card);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--avd-border);
    transition: var(--avd-transition);
    position: relative;
    overflow: hidden;
}

.sector-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--sector-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sector-card:hover::before { opacity: 1; }

.sector-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--avd-shadow);
    border-color: var(--sector-color, var(--avd-border-hover));
}

.sector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.sector-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--avd-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sector-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: var(--sector-gradient);
    color: white;
}

.sector-score {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--sector-color, var(--avd-primary));
}

.sector-bar {
    height: 10px;
    background: var(--avd-input-bg);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    border: 1px solid var(--avd-border);
}

.sector-bar-fill {
    height: 100%;
    background: var(--sector-gradient);
    border-radius: 8px;
    transition: width 1s ease;
}

.sector-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--avd-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   SENTIMENT TABS
   ═══════════════════════════════════════════════════════════════ */

.sentiment-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 20px;
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: 12px;
    padding: 4px;
    flex-wrap: wrap;
}

.sentiment-tab {
    padding: 8px 18px;
    background: transparent;
    border: none;
    border-radius: 9px;
    font-weight: 700;
    font-size: 12px;
    color: var(--avd-text-muted);
    cursor: pointer;
    transition: var(--avd-transition);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.sentiment-tab:hover { color: var(--avd-text); }

.sentiment-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white !important;
    -webkit-text-fill-color: white !important;
}

.sentiment-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.sentiment-article-card {
    background: var(--avd-card);
    padding: 18px;
    border-radius: 12px;
    border-left: 4px solid var(--sentiment-color, var(--avd-primary));
    border-top: 1px solid var(--avd-border);
    border-right: 1px solid var(--avd-border);
    border-bottom: 1px solid var(--avd-border);
    transition: var(--avd-transition);
    cursor: pointer;
}

.sentiment-article-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--avd-shadow);
    border-color: var(--avd-border-hover);
}

.article-sentiment-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    background: var(--sentiment-gradient, linear-gradient(135deg, #667eea, #764ba2));
    margin-bottom: 10px;
}

.article-title-small {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--avd-text);
    margin-bottom: 8px;
    line-height: 1.4;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--avd-text-dim);
    flex-wrap: wrap;
    gap: 6px;
}

.article-source-small { font-weight: 600; }

.article-time-small {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ═══════════════════════════════════════════════════════════════
   ENTITY BADGES
   ═══════════════════════════════════════════════════════════════ */

.entity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: var(--avd-transition);
    margin-right: 5px;
    margin-bottom: 5px;
}

.company-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: white;
    border: 1px 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: 1px 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: 5px;
    margin-top: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE TABLETTE (< 1200px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .sentiment-visual-wrapper {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .sentiment-visual { justify-content: center; }

    .gauge-wrapper {
        width: 250px;
        height: 250px;
    }

    .gauge-value { font-size: 3rem; }
    .gauge-label { font-size: 0.9rem; }

    .breakdown-title {
        font-size: 1.2rem;
        margin-bottom: 18px;
    }

    .global-title { font-size: 1.8rem; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE (< 768px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .global-sentiment-wrapper { padding: 20px 16px; }

    .global-title { font-size: 1.5rem; }
    .global-subtitle { font-size: 0.9rem; }

    .sentiment-main-card { padding: 20px 14px; }

    .sentiment-visual-wrapper { gap: 18px; }

    .gauge-wrapper {
        width: 180px;
        height: 180px;
        margin: 0 auto;
    }

    .gauge-center { display: none; }

    .breakdown-title {
        font-size: 1.1rem;
        margin-bottom: 14px;
    }

    .breakdown-item { padding: 14px; }

    .breakdown-icon {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .breakdown-label { font-size: 0.9rem; }
    .breakdown-value { font-size: 1.4rem; }
    .breakdown-bar { height: 6px; }

    .total-analyzed {
        font-size: 0.88rem;
        flex-direction: column;
        gap: 3px;
    }

    .total-analyzed span { font-size: 1.1rem; }

    .sector-sentiment-grid { grid-template-columns: 1fr; }

    .sentiment-tabs {
        padding: 3px;
        gap: 2px;
    }

    .sentiment-tab {
        padding: 6px 12px;
        font-size: 11px;
    }

    .sentiment-articles-grid { grid-template-columns: 1fr; }

    .section { padding: 18px 16px; }

    .refresh-btn {
        padding: 6px 12px !important;
        font-size: 11px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE PETIT MOBILE (< 480px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .sentiment-main-card {
        padding: 16px 12px;
        border-radius: 14px;
    }

    .gauge-wrapper {
        width: 160px;
        height: 160px;
    }

    .gauge-center { display: none; }

    .breakdown-title {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .breakdown-item {
        padding: 12px;
        border-radius: 10px;
    }

    .breakdown-header {
        gap: 8px;
        margin-bottom: 8px;
    }

    .breakdown-icon {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .breakdown-label { font-size: 0.85rem; }
    .breakdown-value { font-size: 1.2rem; }
    .breakdown-bar { height: 5px; }

    .breakdown-item:hover { transform: translateX(3px); }
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════ */

body.light-mode .gauge-wrapper {
    filter: drop-shadow(0 8px 24px rgba(102, 126, 234, 0.3));
}

body.light-mode .breakdown-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}