/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

/* Header */
header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

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

/* Navigation */
nav {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

nav li {
    margin: 0 1rem;
}

nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

nav a:hover {
    background: #2a5298;
    color: white;
}

/* Sections */
.section {
    padding: 4rem 0;
}

.section:nth-child(even) {
    background: white;
}

.section h2 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: #1e3c72;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.summary-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card h3 {
    font-size: 3rem;
    color: #2a5298;
    margin-bottom: 0.5rem;
}

.summary-card p {
    font-size: 1.1rem;
    color: #666;
}

/* Key Findings */
.key-findings {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.key-findings h3 {
    color: #1e3c72;
    margin-bottom: 1rem;
}

.key-findings ul {
    list-style: none;
}

.key-findings li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.key-findings li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

/* Map Controls */
.map-controls {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.map-controls label {
    font-weight: 500;
}

.map-controls input, .map-controls select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-left: 0.5rem;
}

#yearSlider {
    width: 200px;
}

/* Map Legend */
.map-legend {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.legend-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.legend-scale span {
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

.legend-low { background: #90EE90; }
.legend-medium { background: #FFD700; }
.legend-high { background: #FFA500; }
.legend-very-high { background: #FF6B6B; }

/* Chart Containers */
.chart-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: #1e3c72;
}

.chart-container canvas {
    max-height: 400px;
}

/* Trends Summary */
.trends-summary {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.trend-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.trend-card {
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 5px solid;
}

.trend-card.decreasing {
    background: #d4edda;
    border-left-color: #28a745;
}

.trend-card.increasing {
    background: #f8d7da;
    border-left-color: #dc3545;
}

.trend-card h4 {
    margin-bottom: 0.5rem;
}

.trend-card ul {
    margin-top: 1rem;
    padding-left: 1rem;
}

/* Factors Grid */
.factors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.factor-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    transition: transform 0.3s ease;
}

.factor-card:hover {
    transform: translateY(-5px);
}

.factor-rank {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #2a5298;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.factor-card h3 {
    color: #1e3c72;
    margin-bottom: 1rem;
    padding-right: 2rem;
}

.correlation {
    background: #e9ecef;
    padding: 0.5rem;
    border-radius: 5px;
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: center;
}

.mechanism {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.9rem;
    color: #666;
}

.correlation-chart-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Research Paper Section */
.paper-preview {
    background: white;
    padding: 3rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.paper-preview h3 {
    color: #1e3c72;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.paper-abstract {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    text-align: justify;
    color: #555;
}

.paper-sections {
    margin-bottom: 2rem;
}

.paper-sections h4 {
    color: #1e3c72;
    margin-bottom: 1rem;
}

.paper-sections ul {
    padding-left: 2rem;
}

.paper-sections li {
    margin-bottom: 0.5rem;
}

.download-section {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.download-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.download-note {
    margin-top: 1rem;
    color: #666;
    font-size: 0.9rem;
}

/* Footer */
footer {
    background: #1e3c72;
    color: white;
    text-align: center;
    padding: 2rem 0;
}

footer p {
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    nav li {
        margin: 0.25rem 0;
    }
    
    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .map-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .factors-grid {
        grid-template-columns: 1fr;
    }
    
    .trend-cards {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    nav, .map-controls, .download-section {
        display: none;
    }
    
    .section {
        page-break-inside: avoid;
        padding: 1rem 0;
    }
    
    body {
        background: white;
    }
    
    .summary-card, .factor-card, .chart-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2a5298;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
a:focus, button:focus, input:focus, select:focus {
    outline: 2px solid #2a5298;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .summary-card, .factor-card, .chart-container {
        border: 2px solid #000;
    }
    
    .correlation {
        border: 1px solid #000;
    }
}