/* ============================================
   DESIGN SYSTEM - Equity Advance Data
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(20, 20, 30, 0.8);

    --text-primary: #ffffff;
    --text-secondary: #888899;
    --text-muted: #555566;

    --accent-primary: #00ff88;
    --accent-secondary: #00cc6a;
    --accent-tertiary: #00994d;

    --map-base: #1a2a4a;
    --map-low: #1e3a5f;
    --map-medium: #2563eb;
    --map-high: #3b82f6;
    --map-highest: #60a5fa;
    --map-hover: #00ff88;

    --denial-credit: #ff6b6b;
    --denial-ltv: #4ecdc4;
    --denial-dti: #ffe66d;
    --denial-employment: #a29bfe;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;
    --font-size-4xl: 3.5rem;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Effects */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
}

.logo-text {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.logo-accent {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--accent-primary);
}

.logo-subtitle {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-left: var(--space-sm);
}

.nav {
    display: flex;
    gap: var(--space-xl);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
}

/* ============================================
   HERO SECTION
   ============================================ */

/* ============================================
   TOP CONTROLS
   ============================================ */

.top-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
    padding: calc(60px + var(--space-xl)) var(--space-xl) 0;
    gap: var(--space-xl);
}

.filters-wrapper {
    flex-shrink: 0;
}

.legend-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.legend-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

.denial-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.reason-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.reason-color {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.reason-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.reason-value {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-left: var(--space-xs);
}


/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    padding: var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    display: flex;
    justify-content: center;
    gap: var(--space-3xl);
    align-items: start;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2xl);
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-card .stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 300;
    color: var(--text-primary);
    letter-spacing: -1px;
    line-height: 1;
}

.stat-card.primary .stat-value {
    font-size: var(--font-size-4xl);
    color: var(--accent-primary);
    font-weight: 400;
}

.stat-card .stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-transform: capitalize;
}

.updates-section {
    max-width: 300px;
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
}

.updates-header {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.updates-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.updates-cta {
    font-size: var(--font-size-sm);
    color: var(--accent-primary);
    font-weight: 500;
}

/* Filters are now inside top-controls, but we keep basic button styles */
.filter-tabs {
    display: flex;
    gap: var(--space-lg);
}

.filter-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    padding: var(--space-sm) 0;
    position: relative;
    transition: color var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-tab:hover {
    color: var(--text-primary);
}

.filter-tab.active {
    color: var(--accent-primary);
}

.filter-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
}

/* ============================================
   MAP SECTION
   ============================================ */

.map-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-xl);
    padding: 0;
    width: 100%;
    margin: 0;
}

.map-container {
    position: relative;
    min-height: 80vh;
    width: 100%;
    /* Significantly increased map size */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-md);
    /* Add slight padding so it doesn't touch the very edges */
}

.map-container svg {
    width: 100%;
    height: auto;
    max-height: 85vh;
    /* Prevent it from being taller than the viewport */
}

.map-container svg path {
    fill: var(--map-base);
    stroke: var(--bg-primary);
    stroke-width: 1;
    cursor: pointer;
    transition: fill var(--transition-base), transform var(--transition-fast);
}

.map-container svg path:hover {
    fill: var(--map-hover);
    transform: scale(1.02);
    transform-origin: center;
}

.map-container svg path.selected {
    fill: var(--accent-primary);
    stroke: var(--accent-secondary);
    stroke-width: 2;
}

/* Map Tooltip */
.map-tooltip {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 200;
    box-shadow: var(--shadow-lg);
}

.map-tooltip.visible {
    opacity: 1;
}

.map-tooltip .tooltip-state {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.map-tooltip .tooltip-stats {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.map-tooltip .tooltip-stats>div {
    margin-top: var(--space-xs);
}

.map-tooltip .tooltip-value {
    color: var(--accent-primary);
    font-weight: 500;
}

.map-tooltip .tooltip-hei {
    color: #60a5fa;
    /* Light blue for HEI qualified */
}

/* HEI Provider Section in Tooltip */
.tooltip-providers {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-providers-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.tooltip-providers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}

.tooltip-provider {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.tooltip-provider .provider-icon {
    font-weight: 700;
    font-size: 10px;
    width: 14px;
    text-align: center;
}

.tooltip-provider.available .provider-icon {
    color: var(--accent-primary);
}

.tooltip-provider.unavailable .provider-icon {
    color: var(--denial-credit);
}

.tooltip-provider .provider-name {
    color: var(--text-secondary);
}

.tooltip-provider.available .provider-name {
    color: var(--text-primary);
}

/* ============================================
   STATE PANEL
   ============================================ */

.state-panel {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    height: fit-content;
    position: sticky;
    top: 20px;
    box-shadow: var(--shadow-lg);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-xl);
    cursor: pointer;
    padding: var(--space-xs);
    line-height: 1;
    transition: color var(--transition-fast);
}

.panel-close:hover {
    color: var(--text-primary);
}

.panel-hint {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-style: italic;
}

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

.panel-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.panel-stat:last-child {
    border-bottom: none;
}

.panel-stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.panel-stat-value {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-primary);
}

.panel-stat-value.highlight {
    color: var(--accent-primary);
    font-size: var(--font-size-lg);
}

.panel-stat-value.negative {
    color: var(--denial-credit);
}

.panel-stat-value.hei-qualified {
    color: #60a5fa;
    font-size: var(--font-size-lg);
}

/* Denial Breakdown in Panel */
.panel-denial-breakdown {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-denial-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    letter-spacing: 1px;
}

.denial-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.denial-bar-segment {
    transition: width var(--transition-base);
}

.denial-bar-segment.credit {
    background: var(--denial-credit);
}

.denial-bar-segment.ltv {
    background: var(--denial-ltv);
}

.denial-bar-segment.dti {
    background: var(--denial-dti);
}

.denial-bar-segment.employment {
    background: var(--denial-employment);
}

.denial-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.denial-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.denial-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* N/A Message for missing denial reason data */
.denial-na-message {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-style: italic;
    padding: var(--space-md) 0;
    text-align: center;
}

/* ============================================
   LEGEND SECTION (GLOBAL)
   ============================================ */

/* ============================================
   LEGEND SECTION (GLOBAL) - Removed, now in top-controls
   ============================================ */
/* Kept strictly for any specific overrides if needed, but mostly moved up */

/* ============================================
   MAP FOOTER STAT
   ============================================ */

.map-footer-stat {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: var(--space-2xl);
    padding: 0 var(--space-lg);
    margin-top: 0;
    margin-bottom: var(--space-xl);
    background: transparent;
    border: none;
    border-radius: 0;
}

.footer-stat-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 350px;
}

.footer-stat-highlight {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    /* White for the first number */
    line-height: 1.2;
    margin-bottom: var(--space-sm);
}

.footer-stat-highlight.green {
    color: #00ff00;
    /* Bright green for the second number */
}

/* Specific adjustment for hero placement */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: var(--space-lg);
    padding-bottom: 0;
    min-height: auto;
    /* Allow content to dictate height */
}

.hero .map-footer-stat {
    margin-bottom: 0;
}

.footer-stat-text {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.5;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    padding: var(--space-2xl) var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: var(--space-3xl);
}

.disclaimer {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 800px;
}

.copyright {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-md);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .updates-section {
        max-width: 100%;
    }

    .map-section {
        grid-template-columns: 1fr;
    }

    .state-panel {
        position: static;
        order: -1;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: var(--space-md);
    }

    .hero {
        padding: calc(70px + var(--space-xl)) var(--space-md) var(--space-lg);
        gap: var(--space-xl);
    }

    .hero-stats {
        gap: var(--space-md);
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .stat-card .stat-value {
        font-size: var(--font-size-xl);
    }

    .stat-card.primary .stat-value {
        font-size: var(--font-size-2xl);
    }

    .filters,
    .map-section,
    .legend-section,
    .footer {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }

    /* Compact Denial Reasons for Mobile */
    .denial-reasons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-md);
        background: var(--bg-card);
        padding: var(--space-md);
        border-radius: var(--radius-md);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .reason-item {
        font-size: var(--font-size-xs);
    }

    /* Detail View Mobile Optimizations */
    .detail-view-section {
        padding: 0 var(--space-md) var(--space-xl);
    }

    .institution-list-header {
        gap: var(--space-sm);
    }

    .institution-filters {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }

    .expandable-search {
        width: 100%;
    }

    .expandable-search .search-input {
        width: 100%;
        opacity: 1;
        padding: 0 8px 0 8px;
    }

    /* Mobile Footer Stats */
    .map-footer-stat {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-md) var(--space-md) 0;
        margin-bottom: 0;
    }

    /* Reduce hero padding on mobile to close gap */
    .hero {
        padding: var(--space-lg) var(--space-md) 0;
        min-height: auto;
    }

    /* Remove excessive min-height on map container for mobile */
    .map-container {
        min-height: auto;
        padding: 0 var(--space-sm);
    }

    .map-section {
        gap: 0;
        padding-top: 0;
    }

    .footer-stat-item {
        width: 100%;
        max-width: 100%;
        font-size: var(--font-size-base);
    }

    /* Compact Institution Rows */
    .inst-row {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
        padding: var(--space-sm);
        position: relative;
    }

    /* Make stats 2x2 grid inside the row for compactness */
    .inst-row>*:not(.inst-name):not(.inst-expand-icon) {
        /* This targets the stat divs */
        /* We can't easily target them without a wrapper unless we change HTML, 
           but they are direct children 2,3,4. 
           Let's use a cleaner approach: grid-template-areas if possible, or just auto-flow */
        display: none;
        /* Hide default stat stacking, re-display below */
    }

    /* Actually, let's just re-grid the whole row */
    .inst-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "name name"
            "stat1 stat2"
            "stat3 icon";
        /* Icon at bottom right */
        gap: var(--space-sm) var(--space-md);
    }

    .inst-name {
        grid-area: name;
        margin-bottom: var(--space-xs);
    }

    .inst-expand-icon {
        grid-area: icon;
        justify-self: end;
        align-self: end;
    }

    /* Re-target the stats based on nth-child or class if available */
    /* Based on HTML structure in previous view_file (assumed):
       1. .inst-name
       2. .inst-stat (Applications)
       3. .inst-stat (Denied Value)
       4. .inst-stat (Denial Rate)
       5. .inst-expand-icon
    */
    .inst-row> :nth-child(2) {
        grid-area: stat1;
    }

    .inst-row> :nth-child(3) {
        grid-area: stat2;
    }

    .inst-row> :nth-child(4) {
        grid-area: stat3;
    }

    .inst-stat-label {
        font-size: 10px;
        /* Smaller label */
        color: var(--text-muted);
    }

    .inst-stat-value {
        font-size: var(--font-size-sm);
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.stat-card {
    animation: fadeIn 0.6s ease forwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

.stat-card.primary .stat-value {
    animation: pulse 3s ease-in-out infinite;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

/* ============================================
   NAVIGATION HEADER (DETAIL VIEW)
   ============================================ */

.detail-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding-top: 25px;
}

.nav-back-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.nav-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast), transform var(--transition-fast);
    padding: var(--space-xs);
    display: flex;
}

.nav-close-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

/* ============================================
   DETAIL VIEW SECTION
   ============================================ */

.detail-view-section {
    padding: 0 var(--space-xl) var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease;
}

.detail-view-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: var(--space-2xl);
    align-items: start;
}

/* Left Column */
.detail-left-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.back-to-map-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition-fast);
    padding: 0;
}

.back-to-map-btn:hover {
    color: var(--accent-primary);
}

.detail-stats-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Scrollbar styles for detail-stats-card */
.detail-stats-card::-webkit-scrollbar {
    width: 6px;
}

.detail-stats-card::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.detail-stats-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.detail-stats-card::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* HEI Providers Section */
.panel-hei-providers {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-hei-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    letter-spacing: 1px;
}

.hei-providers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.hei-provider-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.hei-provider-icon {
    font-weight: 700;
    font-size: var(--font-size-sm);
    width: 16px;
    text-align: center;
}

.hei-provider-item.available .hei-provider-icon {
    color: var(--accent-primary);
}

.hei-provider-item.unavailable .hei-provider-icon {
    color: var(--denial-credit);
}

.hei-provider-item.available .hei-provider-name {
    color: var(--text-primary);
}

.hei-provider-item.unavailable .hei-provider-name {
    color: var(--text-muted);
}

/* Right Column */
.detail-right-col {
    background: var(--bg-card);
    /* Should this be transparent or card? Screenshot 3 shows light blue rectangle, implying container or visualization. User request says "break that down by each individual financial institution's specific numbers" in that area. */
    /* Screenshot 3 shows a big blue area, likely placeholder for the institution list/chart. I will style it as a card for now. */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    min-height: 600px;
    /* Ensure it takes up space */
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

/* Right Column Header */
.institution-list-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.institution-list-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.institution-filters {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    flex-wrap: wrap;
}

/* Embedded Filters */
.filter-tabs.embedded {
    display: flex;
    gap: var(--space-md);
}

.filter-tabs.embedded .filter-tab {
    font-size: var(--font-size-xs);
    padding: var(--space-xs) 0;
}

/* Vertical Divider */
.divider-vertical {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 var(--space-xs);
}

/* Institution Type Select */
.institution-type-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.institution-type-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Search Toggle Button (magnifying glass) */
.search-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.search-toggle-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
}

.search-toggle-btn.active {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Expandable Search Bar (below filters) */
.expandable-search-bar {
    display: none;
    width: 100%;
    margin-top: var(--space-sm);
}

.expandable-search-bar.active {
    display: block;
}

.search-input-expanded {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    transition: border-color var(--transition-fast);
}

.search-input-expanded:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-input-expanded::placeholder {
    color: var(--text-muted);
}

.institution-list-container {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 600px;
    padding-right: var(--space-sm);
}

/* Scrollbar styles */
.institution-list-container::-webkit-scrollbar {
    width: 6px;
}

.institution-list-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.institution-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.institution-list-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Institution Items */


.inst-name {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    align-items: flex-start;
    text-align: left;
}

.inst-type-badge {
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    width: fit-content;
}

.inst-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.inst-stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.inst-stat-value {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.inst-stat-value.denied {
    color: var(--denial-credit);
}

/* Empty State */
.institution-empty {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    font-style: italic;
}

/* Expandable Institution Row */
.institution-item {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background var(--transition-fast);
}

.institution-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

.institution-item.expanded {
    background: rgba(255, 255, 255, 0.03);
}

.inst-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: var(--space-md);
    padding: var(--space-md);
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.inst-expand-icon {
    color: var(--text-muted);
    transition: transform var(--transition-fast);
    display: flex;
    align-items: center;
}

.institution-item.expanded .inst-expand-icon {
    transform: rotate(180deg);
}

/* Institution Details Dropdown */
.inst-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

.inst-details.expanded {
    max-height: 300px;
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.inst-denial-breakdown {
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
}

.inst-denial-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inst-denial-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.inst-denial-stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.inst-denial-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    flex-grow: 1;
}

.inst-denial-value {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

@media (max-width: 1024px) {
    .detail-view-container {
        grid-template-columns: 1fr;
    }

    .detail-right-col {
        min-height: auto;
    }

    .inst-row {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .inst-denial-stats {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   FULL SCREEN MODE
   ============================================ */

body.full-screen-mode {
    overflow: hidden;
    /* Prevent scrolling */
    background: var(--bg-primary);
}

body.full-screen-mode .header,
body.full-screen-mode .top-controls,
body.full-screen-mode .hero,
body.full-screen-mode .footer {
    display: none !important;
}

body.full-screen-mode .map-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding: var(--space-xl);
    margin: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-lg);
}

body.full-screen-mode .map-container {
    width: 100%;
    height: auto;
    flex: 1;
    min-height: 0;
    max-height: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.full-screen-mode .map-container svg {
    max-height: 55vh;
    /* Condensed map */
    max-width: 90vw;
    width: auto;
    height: auto;
}

/* Ensure panel floats on top if activated */
body.full-screen-mode .state-panel {
    position: absolute;
    right: 20px;
    top: 20px;
    z-index: 100;
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(10px);
}

body.full-screen-mode .detail-view-section {
    z-index: 200;
    /* Ensure detail view remains on top */
}

/* ============================================
   MAP LEGEND (HEI Provider Coverage)
   ============================================ */

.map-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2xl);
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-xl);
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.map-legend-color {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.map-legend-color.green {
    background: linear-gradient(135deg, #1a4a2e, #4ade80);
}

.map-legend-color.blue {
    background: linear-gradient(135deg, #1a2a4a, #60a5fa);
}

.map-legend-color.red {
    background: linear-gradient(135deg, #4a1a1a, #ff6b6b);
}

.map-legend-item span {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .map-legend {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
        padding: var(--space-md);
    }
}