/* TI Visual Identity Typography - Oswald for headings, Open Sans for body */
#time-series-chart > div.chart-content > svg{
margin-bottom: -200px}

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

:root {
    /* TI Official Brand Colors - Per Visual Identity Guidelines */
    /* Primary Palette */
    --ti-blue: #3695d8;                /* TI Blue - CMYK: 72/30/0/0, PANTONE: 2381 C */
    --ti-black: #000000;               /* TI Black - CMYK: 0/0/0/100 */
    --ti-white: #FFFFFF;               /* TI White - CMYK: 0/0/0/0 */

    /* Secondary Palette (converted from CMYK) */
    --ti-yellow: #FFFF00;              /* Yellow - CMYK: 0/0/100/0, PANTONE: 102 C */
    --ti-light-orange: #FFB800;        /* Light Orange - CMYK: 0/28/100/0, PANTONE: 1235 C */
    --ti-dark-orange: #FA6600;         /* Dark Orange - CMYK: 2/60/100/0, PANTONE: 1788 C */
    --ti-lime-green: #A6D900;          /* Lime Green - CMYK: 35/0/100/0, PANTONE: 389 C */
    --ti-purple: #E300BD;              /* Purple - CMYK: 11/100/26/0, PANTONE: 214 C */
    --ti-scarlet: #FF0035;             /* Scarlet - CMYK: 0/100/79/0, PANTONE: 192 C */

    /* Greys */
    --ti-grey-dark: #262626;
    --ti-grey: #4F4F4F;
    --ti-grey-border: #707070;
    --ti-grey-bg: #E5E5E5;
    --ti-beige-bg: #FDF4EA;

    /* Mapped to existing variable names for compatibility */
    --color__alpha: #3695d8;           /* Primary Action & Brand Colour */
    --color__defaultText: #000000;     /* Default Text */
    --pageBackground: #e0e2e6;         /* Main Background - updated */

    --bg-primary: #FFFFFF;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #FDF4EA;
    --text-primary: #000000;
    --text-secondary: #4F4F4F;
    --text-tertiary: #707070;
    --border-color: #E5E5E5;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    --accent-primary: #3695d8;         /* Updated to TI Blue */
    --accent-secondary: #FF0035;       /* Updated to TI Scarlet */
    --gradient-primary: linear-gradient(135deg, #3695d8 0%, #2a7ac2 100%);
    --gradient-success: linear-gradient(135deg, #A6D900 0%, #8ab800 100%);
    --gradient-danger: linear-gradient(135deg, #FF0035 0%, #cc002a 100%);
    --grid-line: #E5E5E5;
    --skeleton-base: #E5E5E5;
    --skeleton-shimmer: #f0f0f0;
}

/* Dark mode removed as per TI UK branding */

body {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    background-color: var(--pageBackground);
    color: var(--color__defaultText);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* TI Typography: Oswald for headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* TI Typography: Oswald for buttons */
button, .preset-btn, .reset-button, .toggle-button {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Medium weight for emphasis text */
strong, b, .highlight {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Left Panel: Controls */
.control-panel {
    width: 25%;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--accent-primary);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ti-logo {
    width: 80px; /* Increased from 50px */
    height: auto;
    transition: width 0.3s ease; /* Smooth transition when swapping */
}

.control-panel h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 24px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin: 0;
}

/* Dark mode toggle removed - not needed for TI UK branding */

/* Preset Scenarios */
.preset-scenarios {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
    border: 2px solid var(--border-color);
}

.preset-scenarios label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.preset-btn {
    font-family: 'Oswald', sans-serif;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--ti-blue);
    background: var(--ti-blue);
    color: white;
}

.preset-btn:active {
    transform: translateY(0);
}

.preset-btn.active {
    background: var(--ti-blue);
    color: white;
    border-color: var(--ti-blue);
}

.preset-icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
}

.control-group {
    margin-bottom: 25px;
}

.control-group label {
    display: block;
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color__alpha);
    border-radius: 6px;
    font-size: 14px;
    background-color: transparent;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.control-group select:hover {
    border-color: var(--color__alpha);
    background-color: rgba(1, 116, 196, 0.05);
}

.control-group select:focus {
    outline: none;
    border-color: var(--color__alpha);
    box-shadow: 0 0 0 3px rgba(1, 116, 196, 0.1);
}

/* Toggle Button Groups */
.toggle-btn-group {
    display: flex;
    border: 1px solid #3695d8;
    border-radius: 4px;
    position: relative;
}

.toggle-btn {
    flex: 1;
    padding: 10px 12px;
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    background: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.toggle-btn:not(:last-child) {
    border-right: 1px solid #3695d8;
}

.toggle-btn:hover {
    background: rgba(54, 149, 216, 0.1);
}

.toggle-btn.active {
    background: #3695d8;
    color: #fff;
}

/* Slider Styling */
.slider-container {
    position: relative;
    margin: 10px 0;
}

#donation-cap {
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

#donation-cap::-webkit-slider-thumb,
#year-start::-webkit-slider-thumb,
#year-end::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--color__alpha);
    border-radius: 50%;
    cursor: pointer;
}

#donation-cap::-moz-range-thumb,
#year-start::-moz-range-thumb,
#year-end::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--color__alpha);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#year-start, #year-end {
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

/* Range Slider with Two Handles */
/* Custom Range Slider */
.custom-range-slider {
    position: relative;
    height: 40px;
    margin-top: 10px;
    user-select: none;
}

.custom-slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    transform: translateY(-50%);
}

.custom-slider-range {
    position: absolute;
    top: 50%;
    height: 6px;
    background: var(--color__alpha);
    border-radius: 3px;
    transform: translateY(-50%);
    left: 0;
    right: 0;
}

.custom-slider-thumb {
    position: absolute;
    top: 50%;
    width: 20px;
    height: 20px;
    background: var(--color__alpha);
    border: 2px solid #999;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

.custom-slider-thumb:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.custom-slider-thumb:active,
.custom-slider-thumb.dragging {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.custom-slider-thumb-min {
    left: 0%;
}

.custom-slider-thumb-max {
    left: 100%;
}

.range-values {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-weight: 600;
    color: var(--color__alpha);
    font-size: 14px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 11px;
    color: #6c757d;
}

/* Corruption Risk Indicator */
.corruption-risk-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-family: 'Oswald', sans-serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.risk-arrows {
    color: #6c757d;
    font-size: 11px;
    letter-spacing: 1px;
}

.risk-end {
    color: #6c757d;
}

/* Info icon tooltips on filter buttons */
.info-icon {
    position: relative;
    font-size: 12px;
    cursor: help;
    opacity: 0.7;
    margin-left: 2px;
}

.info-icon:hover {
    opacity: 1;
}

.info-icon.active::after,
.info-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary, #fff);
    color: var(--text-primary, #000);
    border: 1px solid var(--border-color, #E5E5E5);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Open Sans', sans-serif;
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.4;
    white-space: normal;
    width: 200px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    pointer-events: none;
}

/* Right Panel: Visualizations */
.viz-panel {
    width: 75%;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Insight Cards at Top */
.insight-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    animation: slideDown 0.5s ease-out;
}

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

.insight-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.insight-card.positive::before {
    background: var(--gradient-primary);
}

.insight-card.negative::before {
    background: var(--gradient-primary);
}

.insight-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.insight-card-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.insight-card-text {
    flex: 1;
}

.insight-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.insight-card-icon svg {
    width: 24px;
    height: 24px;
}

.insight-card-label {
    font-family: 'Oswald', sans-serif;
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 8px;
}

.insight-card-value {
    font-family: 'Oswald', sans-serif;
    font-size: 28px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.insight-card-subtext {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.insight-card-sparkline {
    margin-top: 12px;
    height: 30px;
}
.ti-logo {
    width: 180px;}
/* Chart Containers */
.chart-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.main-charts {
    min-height: 400px;
}

.secondary-charts {
    min-height: 350px;
}

.chart {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    max-width: 100%;
    box-sizing: border-box;
}

.chart:hover {
    box-shadow: var(--shadow-lg);
}

.chart.hero-chart {
    flex: 1.5;
}

.chart h2 {
    font-family: 'Oswald', sans-serif;
    background: #fafafa;
    color: #020c10;
    padding: 15px 20px;
    margin: 0;
    font-size: 18px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.chart-content {
    padding: 20px;
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

.chart-content svg {
    display: block;
}

@media (max-width: 768px) {
    .chart-content {
        padding: 10px;
        overflow: visible;
        min-height: 250px;
    }

    .chart-content svg {
        max-width: 100%;
    }

    .main-charts,
    .secondary-charts {
        min-height: auto;
    }

    #time-series-chart .chart-content {
        padding-right: 15px;
    }
}

/* Loading Skeletons */
.skeleton-loader {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.skeleton-bar,
.skeleton-line,
.skeleton-card {
    background: var(--skeleton-base);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton-bar {
    height: 40px;
    width: 100%;
}

.skeleton-line {
    height: 200px;
    width: 100%;
}

.skeleton-card {
    height: 100px;
    width: 100%;
}

.skeleton-bar::after,
.skeleton-line::after,
.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--skeleton-shimmer), transparent);
    animation: shimmer 1.5s infinite;
}

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

.skeleton-loader.hidden {
    display: none;
}

/* D3 Chart Styling */
.bar {
    transition: all 0.3s ease;
}

.bar:hover {
    opacity: 0.8;
}

.bar-actual {
    fill: none;
    stroke: #999;
    stroke-width: 2;
    stroke-dasharray: 5,5;
    opacity: 0.6;
}

.line {
    fill: none;
    stroke-width: 3;
    transition: stroke-width 0.2s;
}

.line:hover {
    stroke-width: 4;
}

.legend {
    font-size: 12px;
}

.legend-item {
    cursor: pointer;
    transition: opacity 0.2s;
}

.legend-item:hover {
    opacity: 0.7;
}

.legend-item.disabled {
    opacity: 0.3;
}

.axis {
    font-size: 12px;
}

.axis-label {
    font-size: 14px;
    font-weight: 600;
}

.grid line {
    stroke: var(--grid-line);
    stroke-dasharray: 2,2;
    transition: stroke 0.3s ease;
}

.grid path {
    stroke-width: 0;
}

.axis text {
    fill: var(--text-secondary);
    transition: fill 0.3s ease;
}

.axis line,
.axis path {
    stroke: var(--border-color);
    transition: stroke 0.3s ease;
}

/* Waterfall specific styling */
.waterfall-bar-positive {
    fill: #27ae60;
}

.waterfall-bar-negative {
    fill: #e74c3c;
}

.waterfall-bar-total {
    fill: #3498db;
}

/* Heatmap specific styling */
.heatmap-cell {
    stroke: white;
    stroke-width: 2;
    transition: all 0.2s;
}

.heatmap-cell:hover {
    stroke: #333;
    stroke-width: 3;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    max-width: 250px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
}

.tooltip.visible {
    opacity: 1;
}

.tooltip strong {
    color: var(--accent-primary);
}

/* Party Colors */
.party-conservative { fill: #0087dc; }
.party-labour { fill: #e4003b; }
.party-liberal-democrat { fill: #faa61a; }
.party-snp { fill: #fff95d; }
.party-plaid-cymru { fill: #008142; }
.party-green { fill: #6ab023; }
.party-ukip { fill: #70147a; }
.party-brexit { fill: #12b6cf; }

/* Analysis Mode Styling */
#analysis-mode {
    background: #FFFFFF;
    color: #000000;
    border: 1px solid var(--ti-blue);
    font-weight: 600;
}

#analysis-mode:hover {
    border-color: var(--ti-blue);
    background-color: rgba(54, 149, 216, 0.05);
}

#analysis-mode:focus {
    outline: none;
    border-color: var(--ti-blue);
    box-shadow: 0 0 0 3px rgba(54, 149, 216, 0.1);
}

/* Reset Button Styling - Pink */
.reset-button {
    font-family: 'Oswald', sans-serif;
    width: 100%;
    padding: 14px 12px;
    background: #e25e6c;
    color: white;
    border: 2px solid #e25e6c;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reset-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: #d04a58;
    border-color: #d04a58;
}

.reset-button:active {
    transform: translateY(0);
}

.reset-icon {
    font-size: 18px;
    line-height: 1;
}

#party-selection {
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 15px;
    background: #f8f9ff;
    margin-top: 10px;
    transition: all 0.3s ease;
}

#party-selection label {
    color: #2c3e50;
    font-weight: 700;
}

#selected-party {
    border: 2px solid #3498db;
    background: white;
    font-weight: 600;
}

/* Chart Title Updates */
.chart h2 {
    transition: all 0.3s ease;
}

.chart.individual-mode h2 {
    background: #fafafa;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .control-panel {
        width: 30%;
    }

    .viz-panel {
        width: 70%;
    }

    .chart-container {
        flex-direction: column;
    }
}

/* Party Filter Checkboxes */
.party-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.party-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.party-checkbox:hover {
    background-color: var(--bg-tertiary);
}

.party-checkbox input[type="checkbox"] {
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color__defaultText);
    border: 1px solid var(--color__alpha);
}

.party-checkbox input[type="checkbox"]:checked {
    background-color: var(--color__defaultText);
}

.party-checkbox label {
    margin: 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
    color: var(--text-primary);
}

/* Chart Header and Toggle Switch */
.chart-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
}

.chart-header h2 {
    margin: 0;
    flex: 1;
    text-align: center;
}

.chart-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.toggle-button {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    background: var(--ti-black);
    border: 2px solid var(--ti-black);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-button:hover {
    background: var(--ti-blue);
    border-color: var(--ti-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.toggle-button:active {
    transform: translateY(0);
}

.toggle-button.active {
    background: var(--ti-scarlet);
    border-color: var(--ti-scarlet);
}

.toggle-button.active:hover {
    background: var(--ti-scarlet);
    border-color: var(--ti-scarlet);
    opacity: 0.9;
}

.toggle-icon {
    font-size: 16px;
    font-weight: bold;
    color: white;
    user-select: none;
    line-height: 1;
}

/* Impact Dashboard Cards */
#impact-cards-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 15px;
}

.impact-metric-card {
    background: #fafafa;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.impact-metric-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
}

.impact-metric-card.winner::before {
    background: var(--gradient-primary);
}

.impact-metric-card.loser::before {
    background: var(--gradient-primary);
}

.impact-metric-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}

.impact-metric-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin-bottom: 10px;
}

.impact-metric-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.impact-metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.impact-metric-icon {
    font-size: 36px;
    opacity: 0.3;
}

.impact-metric-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 500;
}

/* Predictions Toggle */
.predictions-toggle-group {
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-primary);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.predictions-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-btn {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider-btn:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider-btn {
    background-color: var(--accent-primary);
}

input:checked + .toggle-slider-btn:before {
    transform: translateX(26px);
}

.predictions-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.predictions-info {
    font-size: 11px;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Keyboard Shortcuts Helper */
.keyboard-shortcuts-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 11px;
    color: var(--text-tertiary);
    box-shadow: var(--shadow-md);
    opacity: 0;
    animation: fadeIn 0.5s ease-out 2s forwards;
    z-index: 999;
}

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

.keyboard-shortcuts-hint kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-weight: 600;
    color: var(--text-primary);
}

/* Enhanced Mobile Optimization */
@media (max-width: 1200px) {
    .control-panel {
        width: 30%;
    }

    .viz-panel {
        width: 70%;
    }

    .chart-container {
        flex-direction: column;
    }

    .chart.hero-chart {
        flex: 1;
    }

    .insight-cards-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
    }

    .viz-panel {
        width: 100%;
        height: auto;
        padding: 10px;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .chart-header {
        flex-direction: row;
        gap: 8px;
    }

    .preset-buttons {
        grid-template-columns: 1fr 1fr;
    }

    .preset-btn {
        font-size: 11px;
        padding: 10px 6px;
    }

    .insight-cards-container {
        grid-template-columns: 1fr;
    }

    .panel-header h1 {
        font-size: 1.2rem;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    /* Split charts stack on tablet/mobile */
    .split-charts {
        flex-direction: column;
    }

    .chart-half {
        width: 100%;
    }

    /* Hide panel header on tablet/mobile */
    .panel-header {
        display: none;
    }

    /* Banner adjustments for tablets */
    .banner-title {
        font-size: 16px;
    }

    .banner-donate-btn,
    .banner-about-link {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Mobile-specific styles */
@media (max-width: 480px) {
    /* Banner: stack vertically on mobile */
    .site-banner {
        padding: 8px 12px;
    }

    .banner-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .banner-logo {
        height: 30px;
    }

    .banner-title {
        font-size: 14px;
        flex: 0 0 100%;
        order: 2;
        text-align: center;
        margin-top: 4px;
    }

    .banner-nav {
        order: 1;
        gap: 10px;
    }

    .banner-donate-btn {
        font-size: 11px;
        padding: 5px 10px;
    }

    .banner-about-link {
        font-size: 11px;
    }

    .app-container {
        margin-top: 0;
    }

    /* Toggle buttons smaller on mobile */
    .toggle-btn {
        padding: 8px 6px;
        font-size: 11px;
    }

    /* Control group labels */
    .control-group label {
        font-size: 12px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .preset-btn,
    .toggle-button,
    .reset-button,
    .theme-toggle {
        min-height: 44px;
        min-width: 44px;
    }

    .control-group select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }

    input[type="range"] {
        height: 12px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }

    .party-checkbox {
        padding: 10px;
    }

    .insight-card {
        padding: 24px;
    }
}

/* Print Styles */
@media print {
    .control-panel {
        display: none;
    }

    .viz-panel {
        width: 100%;
    }

    .chart {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    body {
        background: white;
    }
}

/* Panel Actions Container */
.panel-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Panel Collapse Button */
.panel-collapse-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
    color: var(--text-primary);
}

.panel-collapse-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: scale(1.05);
}

/* Collapsed Panel State */
.control-panel.collapsed {
    width: 60px;
    padding: 20px 10px;
}

.control-panel.collapsed .panel-header h1,
.control-panel.collapsed .control-group,
.control-panel.collapsed .predictions-toggle-group {
    display: none !important;
}

.control-panel.collapsed .panel-header {
    flex-direction: column;
    margin-bottom: 15px;
}

.control-panel.collapsed .panel-actions {
    flex-direction: column;
}

/* Full Width Chart Container */
.full-width-chart {
    width: 100%;
    margin-bottom: 20px;
}

.full-width-chart .hero-chart {
    height: 460px;
}

/* Split Charts Container - 50/50 */
.split-charts {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.chart-half {
    flex: 1;
    min-width: 0;
}

/* Insight cards at top */
.insight-cards-container {
    margin-bottom: 20px;
}

/* Adjust viz panel width when panel collapsed */
.app-container:has(.control-panel.collapsed) .viz-panel {
    width: calc(100% - 60px);
}

/* Banner Header */
.site-banner {
    width: 100%;
    background-color: #000000;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 1000;
    box-sizing: border-box;
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.banner-logo {
    height: 40px;
    width: auto;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.banner-title {
    font-family: 'Oswald', sans-serif;
    font-size: 20px;
    font-weight: 500;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    flex: 1;
    text-align: center;
}

.banner-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.banner-donate-btn {
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #000000;
    background: #FFFFFF;
    padding: 8px 20px;
    border-radius: 4px;
    text-decoration: none;
    text-transform: uppercase;
}

.banner-donate-btn:hover {
    background: #f0f0f0;
}

.banner-about-link {
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #FFFFFF;
    text-decoration: none;
    text-transform: uppercase;
}

.banner-about-link:hover {
    text-decoration: underline;
}

/* App container sits below sticky banner */
.app-container {
    margin-top: 0;
}

/* About Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 40px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
}

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

.modal-content h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 24px;
    font-weight: 500;
    color: #020c10;
    margin-bottom: 20px;
    background: none;
    padding: 0;
    text-align: left;
}

.modal-content h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: #020c10;
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-body p {
    line-height: 1.6;
    color: #333;
}