
body {
    background: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
}

.main-container {
    max-width: 1600px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.global-viz-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 14px;
    background: #e6f7ff;
    padding: 15px 30px;
    border-radius: 12px;
    border: 3px solid #667eea;
    margin: 20px auto 40px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: fit-content;
}

.global-viz-controls input[type="range"] {
    width: 400px;
    cursor: pointer;
}

.global-year-display {
    font-size: 22px;
    font-weight: 700;
    color: #4c78a8;
    min-width: 120px;
    text-align: center;
    transition: all 0.3s;
}

.global-year-display.animating {
    color: #2563eb;
    font-size: 24px;
    text-shadow: 0 0 10px rgba(37, 99, 235, 0.6);
}

.play-button-large {
    padding: 10px 22px;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid #4c78a8;
    cursor: pointer;
    background: #fff;
    color: #4c78a8;
    font-weight: 600;
    transition: all 0.2s;
}

.play-button-large:hover {
    background: #4c78a8;
    color: white;
}

.play-button-large.playing {
    background: #4c78a8;
    color: white;
    border-color: #38a169;
    box-shadow: 0 0 10px rgba(76, 120, 168, 0.5);
}

/* Visualization Sections */
.viz-section {
    background: #fff;
    border-radius: 12px;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.viz-header {
    margin-bottom: 10px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.viz-title-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.viz-number {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
}

.viz-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 8px 0;
}

.viz-question {
    font-size: 14px;
    color: #555;
    font-style: italic;
    margin-top: 8px;
}

/* Layouts */
.viz-layout-single {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-top: 20px;
}

.viz-layout-double {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 20px;
}

.viz-pair-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.map-container {
    background: #fafafa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e0e0e0;
}

.map-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.map-svg-container {
    width: 100%;
    height: 400px;
    position: relative;
}

.year-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
}

.year-indicator.active {
    opacity: 1;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.legend-box {
    background: #fafafa;
    border-radius: 8px;
    padding: 15px 18px;
    border: 1px solid #e0e0e0;
}

.legend-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-align: center;
}

.legend-gradient {
    height: 20px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #666;
}

.bar-chart-box {
    background: #fafafa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e0e0e0;
}

/* VIZ 2 & 3 bar styles */
.bar-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    padding: 6px;
    border-radius: 4px;
    transition: background 0.15s;
    cursor: pointer;
}

.bar-item:hover {
    background: #fff3cd;
}

.bar-item.bar-highlighted {
    background: #fff3cd;
}

.bar-rank {
    width: 24px;
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-right: 8px;
}

.bar-label {
    width: 90px;
    font-size: 12px;
    color: #333;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.bar-viz {
    flex: 1;
    height: 24px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-right: 8px;
}

.bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    transition: width 0.5s ease-out, background 0.5s ease-out;
}

.bar-value {
    font-size: 11px;
    color: #555;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

/* VIZ 1 butterfly styles */
.bar-chart-group-diverging {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.bar-diverging-container {
    padding: 5px 0;
    font-size: 12px;
    margin: 0 auto;
    max-width: 100%;
}

.paired-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0;
    padding: 4px 0;
    transition: background 0.15s;
}

.paired-row:hover {
    background: #fff3cd;
}

.paired-row.bar-highlighted {
    background: #fff3cd;
}

.recipient-label {
    text-align: right;
    font-weight: 600;
    font-size: 12px;
    color: #333;
    width: 60px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-right: 2px;
    cursor: pointer;
}

.recipient-rank {
    width: 15px;
    text-align: right;
    font-size: 11px;
    color: #999;
    padding-right: 5px;
}

.donor-rank {
    width: 15px;
    text-align: left;
    font-size: 11px;
    color: #999;
    padding-left: 5px;
}

.donor-label {
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #333;
    width: 60px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-left: 2px;
    cursor: pointer;
}

.central-axis {
    display: flex;
    align-items: center;
    flex-grow: 1;
    height: 20px;
    border-left: 1px solid #aaa;
    border-right: 1px solid #aaa;
}

.recipient-bar-area {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex: 1;
    height: 100%;
}

.donor-bar-area {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex: 1;
    height: 100%;
}

.bar-segment {
    height: 80%;
    position: relative;
    border-radius: 2px;
    transition: width 0.5s ease-out, background 0.5s ease-out;
    display: flex;
    align-items: center;
    min-width: 1px;
    max-width: 100%;
}

.donor-bar-segment {
    justify-content: flex-end;
    margin-right: 1px;
}

.recipient-bar-segment {
    justify-content: flex-start;
    margin-left: 1px;
}

.bar-value-text {
    font-size: 10px;
    font-weight: 600;
    position: absolute;
    z-index: 2;
    padding: 0 4px;
    white-space: nowrap;
}

.donor-value-text {
    right: 0;
}

.recipient-value-text {
    left: 0;
}

.summary-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 18px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 15px;
}

.summary-box strong {
    font-weight: 700;
}

.country-path {
    stroke: #999;
    stroke-width: 0.4;
    cursor: pointer;
    transition: stroke 0.2s, stroke-width 0.2s, fill 0.5s ease-out;
}

.country-path:hover {
    stroke: #000;
    stroke-width: 1.5;
}

.highlighted {
    stroke: #ff6b6b !important;
    stroke-width: 2.5 !important;
    filter: drop-shadow(0 0 4px rgba(255,107,107,0.8));
}

.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.92);
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    max-width: 280px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.tooltip-country {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.35);
    padding-bottom: 4px;
}

.purpose-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 6px;
}

.purpose-selector label {
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

.purpose-selector select {
    flex: 1;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
    cursor: pointer;
}

@media (max-width: 1200px) {
    .viz-layout-single, .viz-layout-double {
        grid-template-columns: 1fr;
    }
}
