/* Base Styles */
:root {
    --primary-color: #1a365d;
    --secondary-color: #2b6cb0;
    --accent-color: #ed8936;
    --success-color: #38a169;
    --warning-color: #d69e2e;
    --danger-color: #e53e3e;
    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-500: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --gray-900: #1a202c;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-section h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.back-link {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.9;
    display: inline-block;
    margin-bottom: 0.5rem;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 1;
}

nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.nav-link:hover {
    opacity: 1;
}

/* Main Content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Map Section */
.map-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.controls {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.control-group {
    flex: 1;
    min-width: 250px;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.control-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.control-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.control-group select:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.map-container {
    position: relative;
    display: flex;
    gap: 1rem;
}

#map {
    flex: 1;
    height: 550px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.legend {
    width: 200px;
    background: var(--gray-50);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--gray-200);
}

.legend h4 {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-hint {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-style: italic;
}

/* Country List */
.country-list-section {
    margin-bottom: 2rem;
}

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

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

.country-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.country-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

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

.country-card p {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Info Sections */
.info-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.info-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-section h3 {
    font-size: 1.1rem;
    color: var(--gray-700);
    margin: 1.5rem 0 0.75rem;
}

.info-section p {
    color: var(--gray-700);
    margin-bottom: 1rem;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--gray-700);
}

.info-section li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 8px;
    color: white;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Country Page Styles */
.country-main {
    padding-top: 1rem;
}

.country-overview {
    margin-bottom: 2rem;
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.overview-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.card-label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.card-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Indicators Section */
.indicators-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.indicators-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.theme-filter {
    margin-bottom: 1.5rem;
}

.theme-filter label {
    font-weight: 600;
    margin-right: 0.75rem;
    color: var(--gray-700);
}

.theme-filter select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.95rem;
    min-width: 250px;
}

.indicators-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.theme-group {
    margin-bottom: 1.5rem;
}

.theme-group h3 {
    font-size: 1.1rem;
    color: var(--secondary-color);
    padding: 0.75rem 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1rem;
}

.indicator-card {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--gray-300);
    margin-bottom: 0.75rem;
}

.indicator-card.yes {
    border-left-color: var(--success-color);
}

.indicator-card.no {
    border-left-color: var(--danger-color);
}

.indicator-card.partial {
    border-left-color: var(--warning-color);
}

.indicator-card.na {
    border-left-color: var(--gray-400);
}

.indicator-topic {
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.indicator-value {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.indicator-value.yes {
    background: #c6f6d5;
    color: #22543d;
}

.indicator-value.no {
    background: #fed7d7;
    color: #822727;
}

.indicator-value.partial {
    background: #feebc8;
    color: #744210;
}

.indicator-value.na {
    background: var(--gray-200);
    color: var(--gray-600);
}

.indicator-source {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

.source-badge {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Summary Section */
.summary-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.summary-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.summary-card {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 1.25rem;
}

.summary-card h4 {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

.summary-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.summary-stat:last-child {
    border-bottom: none;
}

.summary-stat span:first-child {
    color: var(--gray-600);
}

.summary-stat span:last-child {
    font-weight: 600;
    color: var(--primary-color);
}

/* Footer */
footer {
    background: var(--gray-800);
    color: var(--gray-300);
    padding: 2rem;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 1rem;
}

.popup-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.popup-info {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

.popup-link {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.popup-link:hover {
    background: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .logo-section h1 {
        font-size: 1.4rem;
    }

    main {
        padding: 1rem;
    }

    .map-container {
        flex-direction: column;
    }

    .legend {
        width: 100%;
    }

    #map {
        height: 400px;
    }

    .controls {
        flex-direction: column;
    }

    .control-group {
        min-width: 100%;
    }
}
