/**
 * FluxStrategiques - Styles CSS
 * Theme: Mission Control (GEOPOL)
 * Couleur primaire: #f59e0b (amber)
 */

/* ================================================
   VARIABLES CSS
   ================================================ */
:root {
    --flux-primary: #f59e0b;
    --flux-primary-dark: #d97706;
    --flux-dark: #0f172a;
    --flux-slate: #1e293b;
    --flux-slate-light: #334155;
    --flux-border: #475569;
    --flux-text: #e2e8f0;
    --flux-text-muted: #94a3b8;

    /* Niveaux de risque */
    --risk-critical: #ef4444;
    --risk-high: #f97316;
    --risk-moderate: #eab308;
    --risk-low: #22c55e;
}

/* ================================================
   LAYOUT PRINCIPAL
   ================================================ */
#flux-strategiques-app {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--flux-dark) 0%, #1a1f3a 100%);
}

.flux-header {
    position: relative;
    overflow: hidden;
}

.flux-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* ================================================
   NAVIGATION TABS
   ================================================ */
.flux-tab {
    color: var(--flux-text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.flux-tab:hover {
    color: var(--flux-text);
    background: rgba(255, 255, 255, 0.05);
}

.flux-tab.active {
    color: var(--flux-primary);
    border-bottom-color: var(--flux-primary);
    background: rgba(245, 158, 11, 0.1);
}

/* ================================================
   MODE TOGGLE (Debutant/Expert)
   ================================================ */
.mode-btn {
    color: var(--flux-text-muted);
    background: transparent;
}

.mode-btn:hover {
    color: var(--flux-text);
}

.mode-btn.active {
    color: white;
    background: var(--flux-primary);
}

/* Contenu conditionnel selon le mode */
[data-mode="beginner"] [data-mode-expert] {
    display: none !important;
}

[data-mode="expert"] [data-mode-beginner] {
    display: none !important;
}

/* ================================================
   CARTES ET CONTENEURS
   ================================================ */
.flux-card {
    background: linear-gradient(135deg, var(--flux-slate) 0%, var(--flux-slate-light) 100%);
    border: 1px solid var(--flux-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.flux-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--flux-primary);
}

.flux-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--flux-border);
    background: rgba(0, 0, 0, 0.2);
}

.flux-card-body {
    padding: 1.5rem;
}

/* ================================================
   KPI CARDS
   ================================================ */
.kpi-card {
    background: linear-gradient(135deg, var(--flux-slate) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 1px solid var(--flux-border);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.kpi-card.critical::before { background: var(--risk-critical); }
.kpi-card.high::before { background: var(--risk-high); }
.kpi-card.moderate::before { background: var(--risk-moderate); }
.kpi-card.low::before { background: var(--risk-low); }

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.kpi-label {
    color: var(--flux-text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ================================================
   BADGES DE RISQUE
   ================================================ */
.risk-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.risk-badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.risk-badge.high {
    background: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.risk-badge.moderate {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.risk-badge.low {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ================================================
   LISTE DES MATERIAUX
   ================================================ */
.material-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--flux-slate);
    border: 1px solid var(--flux-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.material-item:hover {
    background: var(--flux-slate-light);
    border-color: var(--flux-primary);
    transform: translateX(4px);
}

.material-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.material-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.material-icon.rare-earth {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
}

.material-icon.semiconductor {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    color: white;
}

.material-icon.critical-metal {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
}

.material-score {
    font-size: 1.5rem;
    font-weight: 700;
}

/* ================================================
   GRAPHIQUES
   ================================================ */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container.tall {
    height: 400px;
}

/* ================================================
   CARTE MONDIALE
   ================================================ */
#world-map {
    height: 450px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--flux-border);
}

/* Style Leaflet sombre */
.leaflet-container {
    background: var(--flux-dark);
}

.leaflet-popup-content-wrapper {
    background: var(--flux-slate);
    color: var(--flux-text);
    border-radius: 8px;
}

.leaflet-popup-tip {
    background: var(--flux-slate);
}

.producer-marker {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ================================================
   TABLEAUX
   ================================================ */
.flux-table {
    width: 100%;
    border-collapse: collapse;
}

.flux-table th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--flux-text-muted);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--flux-border);
}

.flux-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(71, 85, 105, 0.5);
    color: var(--flux-text);
}

.flux-table tbody tr:hover {
    background: rgba(245, 158, 11, 0.1);
}

/* ================================================
   JAUGE DE SCORE (Mode Debutant)
   ================================================ */
.score-gauge {
    width: 200px;
    height: 200px;
    position: relative;
}

.score-gauge-circle {
    fill: none;
    stroke: var(--flux-border);
    stroke-width: 12;
}

.score-gauge-value {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 1s ease;
}

.score-gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-gauge-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

/* ================================================
   GRAPHIQUE RADAR (Mode Expert)
   ================================================ */
.radar-container {
    height: 350px;
    position: relative;
}

/* ================================================
   ALERTES
   ================================================ */
.alert-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--flux-slate);
    border-radius: 8px;
    border-left: 4px solid;
    margin-bottom: 0.75rem;
}

.alert-item.critical {
    border-left-color: var(--risk-critical);
    background: rgba(239, 68, 68, 0.1);
}

.alert-item.high {
    border-left-color: var(--risk-high);
    background: rgba(249, 115, 22, 0.1);
}

.alert-item.warning {
    border-left-color: var(--risk-moderate);
    background: rgba(234, 179, 8, 0.1);
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-item.critical .alert-icon { background: var(--risk-critical); }
.alert-item.high .alert-icon { background: var(--risk-high); }
.alert-item.warning .alert-icon { background: var(--risk-moderate); }

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: var(--flux-text);
    margin-bottom: 0.25rem;
}

.alert-description {
    font-size: 0.875rem;
    color: var(--flux-text-muted);
}

.alert-time {
    font-size: 0.75rem;
    color: var(--flux-text-muted);
}

/* ================================================
   COMPARAISON
   ================================================ */
.comparison-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--flux-slate);
    border-radius: 8px;
}

.material-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--flux-slate-light);
    border: 1px solid var(--flux-border);
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.material-chip:hover {
    border-color: var(--flux-primary);
}

.material-chip.selected {
    background: var(--flux-primary);
    border-color: var(--flux-primary);
    color: white;
}

.material-chip .remove-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* ================================================
   MODE PEDAGOGIQUE (Debutant)
   ================================================ */
.pedagogy-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.pedagogy-box-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #93c5fd;
    margin-bottom: 0.75rem;
}

.pedagogy-box-content {
    color: var(--flux-text);
    line-height: 1.6;
}

/* ================================================
   BOUTONS
   ================================================ */
.flux-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.flux-btn-primary {
    background: linear-gradient(135deg, var(--flux-primary) 0%, var(--flux-primary-dark) 100%);
    color: white;
}

.flux-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.flux-btn-secondary {
    background: var(--flux-slate);
    color: var(--flux-text);
    border: 1px solid var(--flux-border);
}

.flux-btn-secondary:hover {
    background: var(--flux-slate-light);
    border-color: var(--flux-primary);
}

/* ================================================
   ANIMATIONS
   ================================================ */
@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-slideIn {
    animation: slideIn 0.3s ease-out;
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1024px) {
    .flux-header .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .flux-header .flex.items-center.space-x-4:last-child {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .kpi-card {
        padding: 1rem;
    }

    .kpi-value {
        font-size: 1.75rem;
    }

    #world-map {
        height: 300px;
    }

    .flux-tab {
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
    }

    .flux-tab i {
        display: none;
    }
}

/* ================================================
   SCROLLBAR
   ================================================ */
#flux-strategiques-app ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#flux-strategiques-app ::-webkit-scrollbar-track {
    background: var(--flux-dark);
    border-radius: 4px;
}

#flux-strategiques-app ::-webkit-scrollbar-thumb {
    background: var(--flux-border);
    border-radius: 4px;
}

#flux-strategiques-app ::-webkit-scrollbar-thumb:hover {
    background: var(--flux-primary);
}
