/* ============================================
   HOME PAGE - CARTE INTERACTIVE AFRIQUE
   FARM Observatory
   ============================================ */

:root {
    --primary-color: #2c5282;
    --secondary-color: #48bb78;
    --accent-color: #ed8936;
    --text-dark: #1a202c;
    --text-light: #4a5568;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --country-available: #48bb78;
    --country-hover: #38a169;
    --country-unavailable: #cbd5e0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.header-content h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
    font-weight: 400;
}

/* ============================================
   INSTRUCTIONS
   ============================================ */

.instructions {
    margin-bottom: 30px;
}

.info-card {
    background: var(--bg-white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--secondary-color);
}

.info-card h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.info-card p {
    color: var(--text-light);
    font-size: 1rem;
}

/* ============================================
   MAP SECTION
   ============================================ */

.map-section {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.map-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: #f0f4f8;
    border-radius: 10px;
    overflow: hidden;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
    border-radius: 10px;
}

/* Styles Leaflet personnalisés */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
    margin: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.popup-country-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--secondary-color);
}

.popup-stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.9rem;
}

.popup-stat label {
    color: var(--text-light);
    font-weight: 500;
}

.popup-stat value {
    color: var(--text-dark);
    font-weight: 600;
}

.popup-action {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.popup-btn {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.popup-btn:hover {
    background: var(--country-hover);
}

/* ============================================
   LOADING
   ============================================ */

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* ============================================
   LEGEND
   ============================================ */

.legend {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
}

.legend h3 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    font-weight: 600;
}

.legend-items {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.legend-color.available {
    background: var(--country-available);
}

.legend-color.unavailable {
    background: var(--country-unavailable);
}

/* ============================================
   COUNTRIES LIST (Alternative)
   ============================================ */

.countries-list-section {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.countries-list-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.country-card {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
}

.country-card:hover {
    border-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(72, 187, 120, 0.2);
}

.country-card h3 {
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 5px;
}

.country-card .region {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    background: var(--bg-white);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.footer p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.footer-note {
    font-size: 0.8rem;
    color: #718096;
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .map-container {
        min-height: 400px;
    }

    .tooltip {
        min-width: 200px;
        max-width: 90vw;
        font-size: 0.85rem;
    }

    .legend-items {
        flex-direction: column;
        gap: 12px;
    }

    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 20px;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .info-card {
        padding: 15px;
    }

    .map-section {
        padding: 15px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header, .info-card, .map-section, .footer {
    animation: fadeIn 0.6s ease-out;
}

.info-card {
    animation-delay: 0.1s;
}

.map-section {
    animation-delay: 0.2s;
}

.footer {
    animation-delay: 0.3s;
}
