/* ==========================================================================
   Health Inequality Visualization - Styles
   ========================================================================== */

/* === Root Variables === */
:root {
    /* Colors - Enhanced vibrant palette */
    --color-primary: #1e3a8a;
    --color-secondary: #3b82f6;
    --color-success: #059669;
    --color-warning: #f59e0b;
    --color-danger: #dc2626;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-bg: #ffffff;
    --color-bg-alt: #f9fafb;
    --color-border: #e5e7eb;
    
    /* Gradient colors */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-danger: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    
    /* Borders */
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background-color: var(--color-bg-alt);
    line-height: 1.6;
    overflow-x: hidden;
}

/* === Container === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* === Header === */
.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
    color: white;
    padding: var(--spacing-xl) var(--spacing-md);
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: headerShine 3s infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes headerShine {
    0% { left: -100%; }
    100% { left: 200%; }
}

.main-title {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.5px;
    animation: titleFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes titleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.subtitle {
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: var(--spacing-md);
    opacity: 0.95;
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.research-question {
    max-width: 900px;
    margin: var(--spacing-md) auto 0;
    font-size: 1.05rem;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.research-question strong {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Statistics Dashboard === */
.stats-dashboard {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: var(--spacing-xl) 0;
    border-bottom: 3px solid var(--color-border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-lg);
}

.stat-card {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transform: scaleX(0);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card.stat-success::before {
    background: linear-gradient(90deg, #10b981, #059669);
}

.stat-card.stat-danger::before {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.stat-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--spacing-xs);
    font-variant-numeric: tabular-nums;
}

.stat-card.stat-success .stat-value {
    color: #059669;
}

.stat-card.stat-danger .stat-value {
    color: #dc2626;
}

.stat-label {
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* === Controls Section === */
.controls-section {
    background: var(--color-bg);
    padding: var(--spacing-lg) 0;
    border-bottom: 2px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.control-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-input {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background: linear-gradient(to bottom, white, #f9fafb);
    color: var(--color-text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    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='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.control-input:hover {
    border-color: var(--color-secondary);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.control-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1), 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-info {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    font-weight: 600;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.btn-info:hover {
    background: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-info .icon {
    font-size: 1.3rem;
}

/* === Visualization Section === */
.viz-section {
    padding: var(--spacing-xl) 0;
}

#map-container {
    position: relative;
    background: var(--color-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
}

#map-svg {
    width: 100%;
    height: 700px;
    display: block;
}

/* === Map Styles === */
.county {
    stroke: #ffffff;
    stroke-width: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.county:hover {
    stroke: #1f2937;
    stroke-width: 2.5px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)) brightness(1.1);
    cursor: pointer !important;
}

.county.filtered {
    opacity: 0.15;
    pointer-events: none;
    filter: grayscale(0.5);
    transition: all 0.5s ease;
}

/* Extreme performance highlighting */
.county.extreme-over {
    animation: pulseGreen 2s ease-in-out infinite;
}

.county.extreme-under {
    animation: pulseRed 2s ease-in-out infinite;
}

.county.extreme-over:hover,
.county.extreme-under:hover {
    animation: none !important;
}

@keyframes pulseGreen {
    0%, 100% {
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(46, 160, 67, 0.8)) brightness(1.1);
    }
}

@keyframes pulseRed {
    0%, 100% {
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(239, 71, 111, 0.8)) brightness(1.1);
    }
}

.state-border {
    fill: none;
    stroke: #374151;
    stroke-width: 1.5px;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* === Tooltip === */
.tooltip {
    position: absolute;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(31, 41, 55, 0.98));
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    pointer-events: none;
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 320px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2) inset;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    animation: tooltipSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tooltip strong {
    font-size: 1rem;
    display: block;
    margin-bottom: var(--spacing-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: var(--spacing-xs);
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
}

.tooltip-label {
    color: rgba(255, 255, 255, 0.8);
}

.tooltip-value {
    font-weight: 600;
    margin-left: var(--spacing-sm);
}

/* === Legend === */
#legend-container {
    margin-bottom: var(--spacing-lg);
}

.legend {
    background: var(--color-bg);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.legend-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--color-primary);
}

.legend-content {
    margin-bottom: var(--spacing-md);
}

.legend-gradient {
    height: 40px;
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
}

#deviation-gradient {
    background: linear-gradient(
        to right,
        #dc2626 0%,
        #f87171 20%,
        #fef3c7 50%,
        #86efac 80%,
        #059669 100%
    );
    position: relative;
    overflow: hidden;
}

#deviation-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.legend-label-center {
    text-align: center;
    font-weight: 600;
}

.legend-description {
    font-size: 0.95rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

/* === Info Card === */
.info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    animation: gradientPulse 10s ease infinite;
    color: white;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.info-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes gradientPulse {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

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

.info-card h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: var(--spacing-sm);
    position: relative;
    z-index: 1;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.info-card p {
    margin: var(--spacing-xs) 0;
    position: relative;
    z-index: 1;
    line-height: 1.6;
}

.info-card strong {
    font-weight: 600;
}

.info-note {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    opacity: 0.9;
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    overflow-y: auto;
    padding: var(--spacing-lg);
    animation: fadeIn var(--transition-normal);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--color-bg);
    max-width: 900px;
    margin: var(--spacing-xl) auto;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp var(--transition-normal);
    padding: var(--spacing-lg);
    overflow-wrap: break-word;
    box-sizing: border-box;
}

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

.modal-info {
    max-width: 800px;
}

.modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--color-text-light);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
    transform: rotate(90deg);
}

.modal-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    padding: var(--spacing-xl) var(--spacing-lg);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-header h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-xs);
}

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

.modal-body {
    padding: var(--spacing-lg);
}

.modal-body section {
    margin-bottom: var(--spacing-xl);
}

.modal-body h3 {
    font-size: 1.4rem;
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: var(--spacing-sm);
}

/* === Prediction Section === */
.prediction-section {
    background: var(--color-bg-alt);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-xl);
}

.prediction-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-md);
}

.prediction-bar-container {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 2px solid #bae6fd;
    position: relative;
    overflow: hidden;
}

.prediction-bar-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    animation: slideBar 2s ease-in-out infinite;
}

@keyframes slideBar {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.prediction-bar {
    height: 80px;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
}

.prediction-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.stat {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.deviation-stat .stat-value {
    font-size: 1.8rem;
}

.deviation-stat.positive .stat-value {
    color: var(--color-success);
}

.deviation-stat.negative .stat-value {
    color: var(--color-danger);
}

.deviation-explanation {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: white;
    border-left: 4px solid var(--color-primary);
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* === Metrics Grid === */
.metrics-section {
    background: var(--color-bg-alt);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.metric-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-color: #3b82f6;
}

.metric-card:hover::before {
    transform: scaleX(1);
}

.metric-name {
    font-size: 0.8rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: var(--spacing-xs) 0;
}

.metric-comparison {
    font-size: 0.75rem;
    font-weight: 600;
    margin: var(--spacing-xs) 0;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

.metric-comparison.better {
    background: #d1fae5;
    color: #065f46;
}

.metric-comparison.worse {
    background: #fee2e2;
    color: #991b1b;
}

.metric-bar-bg {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    margin: var(--spacing-xs) 0;
    overflow: hidden;
    position: relative;
}

.metric-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.metric-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: barShimmer 2s infinite;
}

@keyframes barShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.metric-bar.bar-good {
    background: linear-gradient(90deg, #10b981, #059669);
}

.metric-bar.bar-bad {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.metric-category {
    font-size: 0.7rem;
    color: var(--color-text-light);
    margin-top: var(--spacing-xs);
    font-style: italic;
    opacity: 0.8;
}

/* === Factors Section === */
.factors-section {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    border: 2px solid var(--color-border);
}

#factors-list {
    list-style: none;
    padding: 0;
}

#factors-list li {
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background: var(--color-bg-alt);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--border-radius-sm);
}

#factors-list li::before {
    content: "→ ";
    font-weight: 700;
    color: var(--color-primary);
    margin-right: var(--spacing-xs);
}

/* === Info Modal Sections === */
.info-section {
    margin-bottom: var(--spacing-xl);
}

.info-section h3 {
    font-size: 1.3rem;
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: var(--spacing-sm);
}

.info-section ul {
    padding-left: var(--spacing-lg);
    line-height: 1.8;
}

.info-section li {
    margin-bottom: var(--spacing-sm);
}

/* === Write-up Section === */
.writeup-section {
    background: var(--color-bg);
    padding: var(--spacing-xl) 0;
    border-top: 3px solid var(--color-primary);
}

.writeup-section h2 {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.writeup-subsection {
    margin-bottom: var(--spacing-xl);
}

.writeup-subsection h3 {
    font-size: 1.6rem;
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: var(--spacing-sm);
}

.writeup-subsection h4 {
    font-size: 1.2rem;
    color: var(--color-text);
    margin: var(--spacing-lg) 0 var(--spacing-md);
}

.writeup-subsection p {
    margin-bottom: var(--spacing-md);
    line-height: 1.8;
    font-size: 1.05rem;
}

.writeup-subsection ul, .writeup-subsection ol {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-xl);
    line-height: 1.8;
}

.writeup-subsection li {
    margin-bottom: var(--spacing-sm);
}

.writeup-subsection strong {
    color: var(--color-primary);
    font-weight: 600;
}

/* === Team Table === */
.team-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-lg) 0;
    box-shadow: var(--shadow-md);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.team-table thead {
    background: var(--color-primary);
    color: white;
}

.team-table th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
}

.team-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.team-table tbody tr:hover {
    background: var(--color-bg-alt);
}

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

/* === Footer === */
.site-footer {
    background: var(--color-text);
    color: white;
    padding: var(--spacing-xl) 0;
    text-align: center;
}

.site-footer p {
    margin-bottom: var(--spacing-sm);
}

.site-footer a {
    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.site-footer a:hover {
    color: white;
    text-decoration: underline;
}

/* === Responsive Design === */
@media (max-width: 1024px) {
    .main-title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.3rem;
    }
    
    #map-svg {
        height: 600px;
    }
    
    .prediction-comparison {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .research-question {
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: var(--spacing-md);
    }
    
    .stat-card {
        padding: var(--spacing-lg);
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    #map-svg {
        height: 500px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        padding: var(--spacing-sm);
    }
    
    .modal-content {
        margin: var(--spacing-sm) auto;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .team-table {
        font-size: 0.85rem;
    }
    
    .team-table th,
    .team-table td {
        padding: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .site-header {
        padding: var(--spacing-lg) var(--spacing-sm);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .stat-card {
        padding: var(--spacing-md);
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    #map-svg {
        height: 400px;
    }
    
    .legend-labels {
        flex-direction: column;
        gap: var(--spacing-xs);
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* === Print Styles === */
@media print {
    .controls-section,
    .modal,
    .btn-info,
    .modal-close {
        display: none !important;
    }
    
    .site-header {
        background: white !important;
        color: black !important;
    }
    
    #map-svg {
        height: 500px;
    }
}

/* === Accessibility === */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

*:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 2px;
}

/* === Loading State === */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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