/* --- HERO OVERRIDE --- */
.hero-small {
    /* Matches index.html gradient logic */
    background: linear-gradient(to bottom, #ffffff 0%, var(--brand-blue) 100%);
    padding: 80px 0 100px 0; /* Extra bottom padding for the overlap effect */
    color: var(--brand-white);
}

.hero-small h1 {
    color: var(--brand-blue); /* Dark text at top where gradient is white */
    font-size: 2.5rem;
    text-transform: uppercase;
}

.hero-small .subtitle {
    color: var(--text-dark);
    font-weight: 600;
}

/* --- STATS GRID --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    margin-top: -50px; /* Pull up into hero slightly */
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
    border-top: 4px solid var(--texas-red);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--brand-blue);
    font-family: 'Montserrat', sans-serif;
}

.stat-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 1px;
    font-weight: 700;
}

/* --- VISUALIZATION GRID --- */
.viz-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Map is wider than Chart */
    gap: 30px;
    margin-bottom: 60px;
}

.viz-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.viz-card h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Map Specifics */
#districtMap {
    height: 400px;
    width: 100%;
    border-radius: 4px;
    background-color: #f4f6f9;
}

.map-legend {
    margin-top: 10px;
    font-size: 0.85rem;
    text-align: center;
}
.dot-local { display: inline-block; width: 10px; height: 10px; background: var(--brand-blue); border-radius: 50%; margin-right: 5px; }
.dot-out { display: inline-block; width: 10px; height: 10px; background: var(--texas-red); border-radius: 50%; margin-left: 15px; margin-right: 5px; }

/* Chart Specifics */
.chart-container {
    position: relative;
    height: 300px;
}

/* --- PAC TERMINAL (Tech Vibe) --- */
.pac-section {
    max-width: 900px;
    /* 0 top, auto left/right, 80px bottom */
    margin: 0 auto 80px; 
}

.pac-header { margin-bottom: 20px; }

.pac-terminal {
    background: #1e1e1e; /* Dark terminal background */
    border-radius: 6px;
    overflow: hidden;
    color: #00ff41; /* Classic Matrix Green for text */
    font-family: 'Courier New', monospace;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.terminal-header {
    background: #333;
    padding: 8px 15px;
    color: #ccc;
    font-size: 0.8rem;
    border-bottom: 1px solid #444;
}

.pac-scroll-area {
    max-height: 300px;
    overflow-y: auto;
    padding: 20px;
}

/* Individual Log Entry */
.log-entry {
    margin-bottom: 20px;
    border-left: 2px solid #555;
    padding-left: 15px;
    transition: all 0.2s;
}

.log-entry:hover { border-left-color: var(--texas-red); background: rgba(255,255,255,0.05); }

.log-meta { display: block; font-size: 0.8rem; opacity: 0.7; margin-bottom: 4px; }
.log-entity { font-weight: bold; color: white; font-size: 1.1rem; }
.log-justification { display: block; margin-top: 5px; color: #ccc; font-size: 0.9rem; }

/* --- RESPONSIVENESS --- */
@media (max-width: 900px) {
    .viz-grid { grid-template-columns: 1fr; }
    #districtMap { height: 300px; }
    .stats-grid { margin-top: 20px; }
}
/* --- FIX MOBILE OVERFLOW --- */
@media (max-width: 600px) {
    /* 1. Force the search bar controls to stack */
    .terminal-controls {
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* 2. Make the button full width for easier tapping */
    .terminal-controls button {
        width: 100%;
    }

    /* 3. Ensure the map doesn't force width */
    #districtMap {
        max-width: 100%;
    }
}
/* --- REFINED STATS GRID --- */
.stats-grid-refined {
    display: grid;
    /* NEW: 5 Columns (Blurb is 2 parts, then 4 cards = 1 part each) */
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
    margin-top: -50px;
    align-items: stretch;
}

.stat-blurb {
    background: var(--brand-blue);
    color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-blurb h3 { color: white; margin-bottom: 10px; font-size: 1.1rem; }
.stat-blurb p { font-size: 0.9rem; opacity: 0.9; line-height: 1.5; }

.stat-card-mini {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 4px solid var(--texas-red);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-blue);
    font-family: 'Montserrat', sans-serif;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
    font-weight: 700;
    margin-top: 5px;
}

/* --- MAP CLUSTER BUBBLES --- */
/* These style the "aggregated" pins on the map */

/* Default Cluster (Base) */
.marker-cluster-small, 
.marker-cluster-medium, 
.marker-cluster-large {
    background-color: rgba(255, 255, 255, 0.6); /* Outer transparent ring */
    border-radius: 50%;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Small Donations (< $1k) - Blue */
.marker-cluster-small div {
    background-color: var(--brand-blue); 
}

/* Medium Donations ($1k - $5k) - Texas Red */
.marker-cluster-medium div {
    background-color: var(--texas-red);
}

/* Large Donations (>$5k) - Green (Money) */
.marker-cluster-large div {
    background-color: #28a745;
}

/* --- RESPONSIVE BREAKPOINTS (Tablets & Phones) --- */

/* 1. TABLET VIEW (Under 1100px) */
/* Instead of 5 columns, we go to 2 columns */
@media (max-width: 1100px) {
    .stats-grid-refined {
        grid-template-columns: 1fr 1fr; 
    }
    
    /* Make the text blurb stretch across both columns so it looks balanced */
    .stat-blurb {
        grid-column: span 2; 
    }
}

/* 2. PHONE VIEW (Under 600px) */
/* Now we stack everything in a single column */
@media (max-width: 600px) {
    .stats-grid-refined {
        grid-template-columns: 1fr; 
    }
    
    /* Reset blurb to standard width */
    .stat-blurb {
        grid-column: span 1;
    }
}
/* --- MOBILE RESIZING FIXES --- */

/* 1. Prevent Grid Blowout */
/* This tells the grid items they are allowed to shrink smaller than their content */
.viz-card {
    min-width: 0; 
}

/* 2. Force Charts to Respect Width */
canvas {
    max-width: 100% !important;
}

/* 3. Mobile Layout Adjustments (Phones < 600px) */
@media (max-width: 600px) {
    
    /* Force simple stacking */
    .viz-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* Shrink the Map height so it doesn't dominate the phone screen */
    #districtMap {
        height: 300px !important; 
    }

    /* Adjust Chart Containers for phone screens */
    .chart-container {
        height: 250px !important; /* Good height for pie/bar charts on phone */
        width: 100%;
    }
}