
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 50%, #1f3a2d 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 90px;
    overflow-x: hidden;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d5a3d;
}

.challenge-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1a472a, #2d5a3d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-buttons {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    padding: 0.5rem 1.5rem;
    border: 2px solid transparent;
    background: transparent;
    color: #666;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #f0f4f1;
    color: #1a472a;
}

.nav-btn.active {
    background: linear-gradient(135deg, #2d5a3d, #1a472a);
    color: white;
    box-shadow: 0 4px 15px rgba(29, 90, 61, 0.4);
}

/* Loader */
.loader-container {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-content {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid #e8f5e9;
    border-top: 4px solid #2d5a3d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Main content */
.main-section {
    max-width: 100%;
    width: 100%;
    margin: 2rem 0;
    padding: 0 2rem;
    box-sizing: border-box;
}

/* Première ligne : Composition énergétique (25% gauche) + Carte mondiale (75% droite) */
.viz-row-main {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.viz-energy {
    flex: 1 1 25%;
    order: 1;
    min-width: 0;
    max-width: 40%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.viz-map {
    flex: 1 1 75%;
    order: 2;
    min-width: 0;
    max-width: 60%;
}

/* Deuxième ligne : PIB/Émissions (50%) + Kaya Identity (50%) */
.viz-row-secondary {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.viz-row-secondary .viz-card {
    flex: 1 1 50%;
    min-width: 0;
    max-width: calc(50% - 0.75rem);
}

/* Cartes de visualisation */
.viz-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Sous-cartes pour la colonne de gauche */
.viz-subcard {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.viz-subcard:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.viz-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.viz-card h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #1a472a;
    font-weight: 700;
    flex-shrink: 0;
}

.viz-subcard h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #1a472a;
    font-weight: 700;
    flex-shrink: 0;
}

.viz-card .subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    font-style: italic;
    flex-shrink: 0;
}

.viz-subcard .subtitle {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.8rem;
    font-style: italic;
    flex-shrink: 0;
}

.viz-description {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e8f5e9;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.5;
    flex-shrink: 0;
}

.vis-container {
    width: 100%;
    min-height: 350px;
    flex-grow: 1;
}

/* Conteneurs pour les visualisations dans la colonne de gauche */
.vis-container-small {
    width: 100%;
    min-height: 250px;
    flex-grow: 1;
}

/* Ajustement pour la carte mondiale qui a besoin de plus d'espace */
.viz-map .vis-container {
    min-height: 450px;
}

/* Timeline fixée en bas */
.timeline-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 0.6rem 0;
}

.timeline-content {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

.timeline-content label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #1a472a;
    font-size: 0.85rem;
}

/* Slider personnalisé */
input[type="range"] {
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, #e8f5e9, #2d5a3d);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #2d5a3d, #1a472a);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(29, 90, 61, 0.4);
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #2d5a3d, #1a472a);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(29, 90, 61, 0.4);
    border: none;
}

/* Tooltip */
#tooltip {
    position: absolute;
    background: rgba(26, 71, 42, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10000;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#tooltip strong {
    display: block;
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: #a8d5ba;
}

/* Documentation */
.doc-content {
    background: white;
    border-radius: 12px;
    padding: 3rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    max-width: 1000px;
    margin: 0 auto;
}

.doc-content h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #1a472a, #2d5a3d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.doc-content h2 {
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #1a472a;
}

.doc-content h3 {
    font-size: 1.3rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    color: #2d5a3d;
}

.doc-content p {
    margin-bottom: 1rem;
}

.doc-content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.doc-content li {
    margin-bottom: 0.5rem;
}

.doc-content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.doc-content a {
    color: #2d5a3d;
    text-decoration: none;
    border-bottom: 1px solid #2d5a3d;
}

.doc-content a:hover {
    color: #1a472a;
    border-bottom-color: #1a472a;
}

.doc-content code {
    background: #e8f5e9;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #1a472a;
}

.members {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border-left: 4px solid #2d5a3d;
    padding: 2.5rem;
    margin: 1.5rem 0 !important;
    border-radius: 8px;
}

.members li {
    font-weight: 500;
    color: #1a472a;
}

.highlight-box {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border-left: 4px solid #2d5a3d;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
}

.highlight-box strong {
    color: #1a472a;
    display: block;
    margin-bottom: 0.5rem;
}

/* Éléments D3 */
.country {
    cursor: pointer;
    transition: all 0.2s ease;
}

.country:hover {
    filter: brightness(0.85);
}

.axis path,
.axis line {
    stroke: #ccc;
}

.axis text {
    fill: #666;
    font-size: 11px;
}

.axis-label {
    fill: #333;
    font-size: 12px;
    font-weight: 500;
}

/* Responsive */
/* Tablettes et écrans moyens */
@media (max-width: 1200px) {
    .main-section {
        padding: 0 1.5rem;
    }
    
    .viz-row-main {
        flex-direction: column;
    }
    
    .viz-energy {
        flex: 1 1 100%;
        order: 0;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .viz-map {
        flex: 1 1 100%;
        order: 0;
        max-width: 100%;
    }
    
    .viz-row-secondary {
        flex-direction: column;
    }
    
    .viz-row-secondary .viz-card {
        flex: 1 1 100%;
        max-width: 100%;
    }
    
    .vis-container,
    .viz-map .vis-container {
        min-height: 400px;
    }
    
    .vis-container-small {
        min-height: 300px;
    }
}

/* Petits écrans et mobiles */
@media (max-width: 768px) {
    .main-section {
        padding: 0 1rem;
    }
    
    .nav-content {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0.6rem 1rem;
    }
    
    .navbar h1 {
        font-size: 1rem;
        text-align: center;
        line-height: 1.4;
    }
    
    .challenge-title {
        font-size: 1.3rem;
    }
    
    .viz-card {
        padding: 1rem;
    }
    
    .viz-card h2 {
        font-size: 1.2rem;
    }
    
    .doc-content {
        padding: 1.5rem;
    }
    
    .timeline-content {
        padding: 0 1rem;
    }
    
    .vis-container,
    .viz-map .vis-container {
        min-height: 300px;
    }
    
    body {
        padding-bottom: 110px;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    .main-section {
        padding: 0 0.5rem;
    }
    
    .nav-content {
        padding: 0.5rem 0.5rem;
    }
    
    .viz-card {
        padding: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .viz-card h2 {
        font-size: 1.1rem;
    }
    
    .viz-description {
        font-size: 0.8rem;
    }
    
    .navbar h1 {
        font-size: 0.9rem;
    }
    
    .challenge-title {
        font-size: 1.2rem;
    }
    
    .timeline-content {
        padding: 0 0.5rem;
    }
    
    .nav-btn {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
    
    body {
        padding-bottom: 100px;
    }
}
