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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f7fa;
    color: #2c3e50;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header h1 i {
    margin-right: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.controls {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.filter-section {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-section label {
    font-weight: 600;
    color: #4a5568;
}

.filter-section select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

.filter-section select:hover {
    border-color: #667eea;
}

.stats-section {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    flex-wrap: wrap;
}

.stat-card {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    flex: 1;
    min-width: 150px;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: #718096;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
    color: #2d3748;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-bottom: 30px;
}

#map {
    height: 500px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1;
}

.sidebar {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 500px;
    overflow-y: auto;
}

.sidebar h3 {
    color: #4a5568;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.project-details {
    margin-bottom: 25px;
}

.placeholder {
    color: #a0aec0;
    text-align: center;
    padding: 20px;
}

.funding-source-item {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.funding-source-item h4 {
    font-size: 1em;
    margin-bottom: 5px;
    color: #2d3748;
}

.funding-source-item .amount {
    font-weight: 700;
    color: #48bb78;
    margin-bottom: 3px;
}

.funding-source-item .type {
    font-size: 0.9em;
    color: #718096;
}

.research-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.research-section h2 {
    color: #4a5568;
    margin-bottom: 20px;
}

.research-section h2 i {
    margin-right: 10px;
    color: #667eea;
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.research-card {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    transition: transform 0.3s;
}

.research-card:hover {
    transform: translateY(-2px);
}

.research-card h4 {
    color: #2d3748;
    margin-bottom: 8px;
}

.research-card .institution {
    color: #718096;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.research-card .year {
    color: #48bb78;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.research-card .description {
    color: #4a5568;
    font-size: 0.95em;
    line-height: 1.5;
}

.custom-marker {
    background: #667eea;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    #map {
        height: 400px;
    }
    
    .filter-section {
        flex-direction: column;
    }

/* New styles for WASH Portal integration */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 1.1em;
}

.loading-spinner::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.research-card {
    position: relative;
    padding-top: 45px;
}

.research-card.preprint {
    border-left: 4px solid #9f7aea;
}

.research-card.journal {
    border-left: 4px solid #4299e1;
}

.research-card.publication {
    border-left: 4px solid #48bb78;
}

.research-card.project {
    border-left: 4px solid #ecc94b;
}

.research-card.workshop {
    border-left: 4px solid #ed64a6;
}

.card-header {
    position: absolute;
    top: 10px;
    right: 10px;
    left: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.type-badge {
    font-size: 0.7em;
    padding: 3px 8px;
    border-radius: 12px;
    background: #e2e8f0;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-badge.type-preprint {
    background: #9f7aea;
    color: white;
}

.type-badge.type-journal {
    background: #4299e1;
    color: white;
}

.type-badge.type-publication {
    background: #48bb78;
    color: white;
}

.type-badge.type-project {
    background: #ecc94b;
    color: #744210;
}

.type-badge.type-workshop {
    background: #ed64a6;
    color: white;
}

.investment-badge {
    font-size: 0.7em;
    padding: 3px 8px;
    border-radius: 12px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.research-link {
    display: inline-block;
    margin-top: 10px;
    color: #667eea;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.research-link:hover {
    text-decoration: underline;
}

.research-footer {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

.refresh-research-btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.refresh-research-btn:hover {
    background: #667eea;
    color: white;
}

.refresh-research-btn i {
    margin-right: 8px;
}

.data-source {
    font-size: 0.8em;
    color: #a0aec0;
}

.data-source a {
    color: #667eea;
    text-decoration: none;
}

.data-source a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .research-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
}    
    .stats-section {
        flex-direction: column;
    }
}

/* Currency toggle styles */
.currency-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: flex-end;
}

.currency-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.currency-btn:hover {
    background: #667eea;
    color: white;
}

.currency-btn-active {
    background: #667eea;
    color: white;
}

/* Update stat cards for better visibility */
.stat-card {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    flex: 1;
    min-width: 150px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
    color: #2d3748;
    transition: all 0.3s;
}

/* Funding source items */
.funding-source-item {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.funding-source-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.funding-source-item h4 {
    font-size: 1em;
    margin-bottom: 5px;
    color: #2d3748;
}

.funding-source-item .amount {
    font-weight: 700;
    color: #48bb78;
    margin-bottom: 3px;
    font-size: 1.1em;
}

.funding-source-item .type {
    font-size: 0.9em;
    color: #718096;
}
/* Last accessed display */
.last-accessed {
    margin-top: 15px;
    padding-top: 10px;
    font-size: 0.85em;
    color: #e2e8f0;
    border-top: 1px solid rgba(255,255,255,0.2);
    text-align: center;
}

.last-accessed a {
    color: #c3dafe;
    text-decoration: none;
}

.last-accessed a:hover {
    text-decoration: underline;
}

.last-accessed i {
    margin-right: 5px;
}

/* Refresh button */
.refresh-data-btn {
    background: #48bb78;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.refresh-data-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
}

/* Loading spinner */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #667eea;
}

.loading-spinner::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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