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

:root {
    --primary-color: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --dark: #1f2937;
    --light: #f3f4f6;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
}

/* Header */
.header {
    background: white;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo svg {
    color: var(--primary-color);
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    line-height: 1;
}

.tagline {
    color: var(--dark);
    opacity: 0.7;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.subtitle {
    color: var(--dark);
    opacity: 0.7;
    font-size: 0.95rem;
}

/* Controls Panel */
.controls-panel {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Map View Controls */
.map-view-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label {
    font-weight: 500;
    color: var(--dark);
    font-size: 0.9rem;
    white-space: nowrap;
}

.control-select {
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: white;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5563' d='M6 9L1.5 4.5h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    min-width: 180px;
}

.control-select:hover {
    border-color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.02);
}

.control-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

#country-search {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

#country-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--light);
}

.control-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-1px);
}

.btn-warning {
    background: #fbbf24;
    color: #92400e;
}

.btn-warning:hover {
    background: #f59e0b;
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b4299 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-toggle {
    background: var(--light);
    color: var(--dark);
    border: 2px solid var(--border);
}

.btn-toggle:hover {
    background: var(--border);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-toggle.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
    font-weight: 600;
}

.btn-toggle.active:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

#view-news-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-weight: 600;
    animation: subtle-pulse 2s infinite;
}

@keyframes subtle-pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
    }
}

#view-news-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    animation: none;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.projection-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.projection-selector label {
    font-weight: 500;
    color: var(--dark);
}

.projection-selector select {
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: 0.375rem;
    background: white;
    cursor: pointer;
}

/* Map Container */
.map-container {
    position: relative;
    height: calc(100vh - 140px);
    background: #f0f4f8;
    overflow: hidden;
}

#world-map {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#world-map.grabbing {
    cursor: grabbing;
}

/* Country Styles */
.country {
    fill: #e0e7ff;
    stroke: #6366f1;
    stroke-width: 0.5;
    transition: all 0.3s ease;
    cursor: pointer;
}

.country:hover {
    fill: #c7d2fe;
    stroke-width: 1;
}

.country.selected {
    fill: #818cf8;
    stroke: #4f46e5;
    stroke-width: 2;
}

.country.dragging {
    fill: rgba(129, 140, 248, 0.3);
    stroke: #4f46e5;
    stroke-width: 2;
    opacity: 0.5;
    cursor: move;
}

.country-clone {
    fill: rgba(59, 130, 246, 0.5);
    stroke: #2563eb;
    stroke-width: 2;
    pointer-events: none;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4));
    cursor: move;
}

.country-overlay {
    fill: rgba(59, 130, 246, 0.4);
    stroke: #2563eb;
    stroke-width: 2;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    cursor: pointer;
    transition: all 0.2s ease;
    animation: pulse-overlay 2s infinite;
}

@keyframes pulse-overlay {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.country-overlay:hover {
    fill: rgba(99, 102, 241, 0.5);
    stroke: #4f46e5;
    stroke-width: 3;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4));
}

/* Comparison Panel */
.comparison-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border-radius: 0.75rem;
    padding: 1.25rem;
    min-width: 280px;
    max-width: 350px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.comparison-panel.active {
    transform: translateX(0);
}

.comparison-panel h3 {
    margin-bottom: 1rem;
    color: var(--dark);
    font-size: 1.1rem;
}

.comparison-item {
    padding: 0.75rem;
    background: var(--light);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.comparison-item .country-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.comparison-item .country-area {
    font-size: 0.9rem;
    color: #6b7280;
}

.comparison-ratio {
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.5rem;
    text-align: center;
    margin-top: 1rem;
}

.comparison-ratio .ratio-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.comparison-ratio .ratio-text {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Info Panel */
.info-panel {
    background: white;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.info-content h3,
.selected-countries h3 {
    margin-bottom: 0.75rem;
    color: var(--dark);
}

.info-content ul {
    list-style: none;
}

.info-content li {
    padding: 0.5rem 0;
    color: #4b5563;
}

.selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selected-country-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--light);
    border-radius: 0.375rem;
    font-size: 0.9rem;
}

.selected-country-tag button {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
}

.placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(31, 41, 55, 0.95);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

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

    .controls-panel {
        padding: 1rem;
    }

    .map-view-controls {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

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

    .control-select {
        min-width: 140px;
        font-size: 0.85rem;
        padding: 0.4rem 2rem 0.4rem 0.6rem;
    }

    .info-panel {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .comparison-panel {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .map-container {
        height: calc(100vh - 250px);
    }
}

/* Drag Ghost */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    opacity: 0.7;
    z-index: 10000;
}

/* Timeline Controls */
.timeline-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    background: linear-gradient(90deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
    border-radius: 0.5rem;
    margin: 0 1rem;
}

.year-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.year-display {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.year-slider {
    width: 200px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    outline: none;
}

.year-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.year-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #ef4444;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.modal-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.loading-spinner.hidden {
    display: none;
}

/* Historical Grid */
.historical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.country-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.3s;
    position: relative;
}

.country-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.country-card h3 {
    margin: 0 0 1rem 0;
    color: var(--dark);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.country-flag {
    font-size: 1.75rem;
}

.stat-grid {
    display: grid;
    gap: 1rem;
}

.stat-item {
    padding: 0.75rem;
    background: var(--light);
    border-radius: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}

.stat-change {
    font-size: 0.8rem;
    margin-left: 0.5rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    background: #10b981;
    color: white;
}

.stat-change.negative {
    background: #ef4444;
}

.historical-context {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102,126,234,0.05) 0%, rgba(118,75,162,0.05) 100%);
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
}

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

.context-text {
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.6;
}

/* Citations and Sources */
.citation {
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 2px;
    transition: all 0.2s;
}

.citation:hover {
    color: #764ba2;
    text-decoration: underline;
}

.citation-tooltip {
    position: fixed;
    background: rgba(31, 41, 55, 0.95);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    max-width: 300px;
    z-index: 100000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
}

.sources-section {
    grid-column: 1 / -1;
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(102,126,234,0.03) 0%, rgba(118,75,162,0.03) 100%);
    border-radius: 0.75rem;
    border: 1px solid rgba(102,126,234,0.2);
}

.sources-title {
    margin: 0 0 1rem 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.sources-list {
    margin: 0 0 1rem 1.5rem;
    padding: 0;
    list-style-type: decimal;
}

.source-item {
    padding: 0.5rem 0;
    color: #4b5563;
    font-size: 0.85rem;
    line-height: 1.5;
}

.source-link {
    color: var(--primary-color);
    text-decoration: none;
    margin-left: 0.25rem;
    font-size: 0.8rem;
}

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

.source-date {
    color: #9ca3af;
    font-size: 0.8rem;
}

.sources-note {
    margin: 0;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(102,126,234,0.1);
    color: #6b7280;
    font-size: 0.85rem;
    font-style: italic;
}

/* No Data Card */
.country-card.no-data {
    background: linear-gradient(135deg, rgba(239,68,68,0.05) 0%, rgba(252,165,165,0.05) 100%);
    border-color: rgba(239,68,68,0.3);
}

.no-data-message {
    padding: 1rem;
    text-align: center;
}

.no-data-message p {
    margin: 0.5rem 0;
    color: #6b7280;
}

.no-data-message .suggestion {
    font-style: italic;
    color: #9ca3af;
    font-size: 0.9rem;
}

/* Event Items */
.event-item {
    margin: 0.5rem 0;
    padding-left: 1rem;
    position: relative;
}

.event-item::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.event-date {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.event-description {
    color: #4b5563;
}

/* Stat Notes */
.stat-note {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    font-style: italic;
}

/* Error Message */
.error-message {
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(239,68,68,0.05) 0%, rgba(252,165,165,0.05) 100%);
    border-radius: 0.75rem;
    border: 1px solid rgba(239,68,68,0.2);
}

.error-message h3 {
    color: #dc2626;
    margin-bottom: 1rem;
}

.error-message ul {
    text-align: left;
    display: inline-block;
    margin-top: 1rem;
}

.error-message li {
    color: #6b7280;
    margin: 0.5rem 0;
}

/* Academic Comparison Tabs */
.academic-comparison {
    padding: 10px;
}

.comparison-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: #4a90e2;
    background: rgba(74, 144, 226, 0.05);
}

.tab-btn.active {
    color: #4a90e2;
    border-bottom-color: #4a90e2;
    background: rgba(74, 144, 226, 0.08);
}

.tab-content {
    animation: fadeIn 0.3s ease;
    max-height: 500px;
    overflow-y: auto;
}

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

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.data-table tr:hover td {
    background: rgba(74, 144, 226, 0.03);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Metric Cards */
.metric-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.metric-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.metric-change {
    font-size: 13px;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.metric-change.positive {
    color: #00c853;
    background: rgba(0, 200, 83, 0.1);
}

.metric-change.negative {
    color: #ff5252;
    background: rgba(255, 82, 82, 0.1);
}

.metric-change.neutral {
    color: #888;
    background: rgba(136, 136, 136, 0.1);
}

/* Country Comparison Grid */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.country-card {
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.country-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4a90e2, #667eea);
}

.country-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.country-flag {
    font-size: 24px;
}

/* Data Quality Indicators */
.data-quality {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.data-quality.high {
    background: rgba(0, 200, 83, 0.1);
    color: #00c853;
}

.data-quality.medium {
    background: rgba(255, 193, 7, 0.1);
    color: #ff9800;
}

.data-quality.low {
    background: rgba(255, 82, 82, 0.1);
    color: #ff5252;
}

/* Citation Links */
.citation {
    font-size: 11px;
    color: #4a90e2;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(74, 144, 226, 0.08);
    transition: background 0.2s ease;
}

.citation:hover {
    background: rgba(74, 144, 226, 0.15);
    text-decoration: underline;
}

.citation::after {
    content: '↗';
    font-size: 10px;
}

/* Comparative Highlights */
.comparison-highlight {
    background: linear-gradient(135deg, #ffd54f 0%, #ffca28 100%);
    color: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    font-size: 12px;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Key Difference Indicators */
.key-difference {
    position: relative;
    padding-left: 20px;
}

.key-difference::before {
    content: '⚡';
    position: absolute;
    left: 0;
    color: #ff9800;
    animation: flash 1.5s ease infinite;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* News Modal Styles */
.news-modal .modal-content {
    max-width: 900px;
}

.news-modal-content {
    background: white;
    border-radius: 1.25rem;
    overflow: hidden;
}

.news-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 0;
}

.news-header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
}

.country-flag-container {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.news-title-section h2 {
    color: white;
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.news-subtitle {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.news-badge {
    background: #ef4444;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

.news-time {
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
}

.news-close {
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.news-close:hover {
    color: white;
    opacity: 1;
}

/* News Body */
.news-body {
    padding: 0;
    max-height: 60vh;
    overflow-y: auto;
}

/* Loading State */
.news-loading {
    padding: 3rem;
    text-align: center;
}

.news-skeleton {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.skeleton-item {
    height: 80px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-text {
    color: #6b7280;
    font-size: 1rem;
}

/* News Categories */
.news-categories {
    display: flex;
    gap: 0.5rem;
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    background: #f9fafb;
}

.category-tab {
    padding: 0.5rem 1.25rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.category-tab:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.category-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* News Articles */
.news-articles {
    padding: 1.5rem 2rem;
}

.news-article {
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.news-article::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    transform: translateX(-100%);
    transition: transform 0.3s;
}

.news-article:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateX(4px);
}

.news-article:hover::before {
    transform: translateX(0);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.article-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.4;
    margin: 0;
}

.article-category {
    background: var(--light);
    color: #6b7280;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.article-category.politics {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.article-category.economy {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.article-category.culture {
    background: rgba(168, 85, 247, 0.1);
    color: #9333ea;
}

.article-category.sports {
    background: rgba(251, 146, 60, 0.1);
    color: #ea580c;
}

.article-summary {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.article-source {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.article-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
}

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

/* No News State */
.no-news {
    padding: 4rem 2rem;
    text-align: center;
}

.no-news svg {
    color: #d1d5db;
    margin-bottom: 1rem;
}

.no-news p {
    color: #6b7280;
    font-size: 1rem;
}

/* Citations */
.news-citations {
    padding: 1.5rem 2rem;
    background: #f9fafb;
    border-top: 1px solid var(--border);
}

.news-citations h4 {
    margin: 0 0 1rem 0;
    color: var(--dark);
    font-size: 1rem;
}

.citations-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.citation-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #4b5563;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.citation-item:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

/* News Footer */
.news-footer {
    background: #f9fafb;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#news-source-indicator {
    color: #6b7280;
    font-size: 0.85rem;
}

.cache-badge {
    background: #10b981;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.btn-refresh {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-refresh svg {
    animation: none;
}

.btn-refresh:hover svg {
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .news-modal .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .news-header-content {
        padding: 1rem;
    }

    .news-articles {
        padding: 1rem;
    }

    .news-footer {
        flex-direction: column;
        gap: 1rem;
    }
}