@font-face {
    font-family: 'Grot 10';
    font-weight: normal;
    src: url('https://media.inquirer.com/fonts/Grot10-RegularWEB.woff2') format('woff2'),
         url('https://media.inquirer.com/fonts/Grot10-RegularWEB.woff') format('woff');
}

@font-face {
    font-family: 'Grot 10';
    font-weight: 500;
    src: url('https://media.inquirer.com/fonts/Grot10-MediumWEB.woff2') format('woff2'),
         url('https://media.inquirer.com/fonts/Grot10-MediumWEB.woff') format('woff');
}

@font-face {
    font-family: 'Grot 10';
    font-weight: bold;
    src: url('https://media.inquirer.com/fonts/Grot10-ExtraboldWEB.woff2') format('woff2'),
         url('https://media.inquirer.com/fonts/Grot10-ExtraboldWEB.woff') format('woff');
}

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

body {
    font-family: 'Grot 10', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f4f8;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    padding: 20px 20px 15px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.header h1 {
    font-size: 24px;
    font-weight: bold;
    color: #1a202c;
    margin-bottom: 10px;
    line-height: 1.2;
}

.header .description {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.5;
    max-width: 800px;
    margin-bottom: 15px;
}

.legend-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.legend-label {
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
}

.legend-scale {
    display: flex;
    align-items: center;
    gap: 2px;
}

.legend-color {
    width: 28px;
    height: 14px;
    border-radius: 2px;
}

.legend-values {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: #64748b;
}

.legend-values span {
    width: 28px;
    text-align: center;
}

.map-container {
    position: relative;
    height: 55vh;
    min-height: 350px;
    flex-shrink: 0;
}

#map {
    width: 100%;
    height: 100%;
}

.custom-tooltip {
    background: rgba(255, 255, 255, 0.98);
    border: none;
    border-radius: 8px;
    padding: 12px 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-family: 'Grot 10', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-width: 200px;
}

.custom-tooltip .location {
    font-weight: bold;
    font-size: 14px;
    color: #1a365d;
    margin-bottom: 4px;
}

.custom-tooltip .county-state {
    font-size: 12px;
    color: #718096;
    margin-bottom: 8px;
}

.custom-tooltip .amount {
    font-size: 24px;
    font-weight: bold;
    color: #7c3aed;
    margin-bottom: 4px;
}

.custom-tooltip .rank-info {
    font-size: 12px;
    color: #4a5568;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    margin-top: 8px;
}

.custom-tooltip .percentile {
    display: inline-block;
    background: #f3e8ff;
    color: #7c3aed;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 11px;
    margin-top: 4px;
}

.custom-tooltip .report-type {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 6px;
}

.leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 0;
}

.stats-bar {
    position: absolute;
    top: 10px;
    left: 60px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-size: 12px;
}

.stats-bar span {
    margin-right: 15px;
    color: #4a5568;
}

.quick-zoom-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: #7c3aed;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-family: 'Grot 10', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: background 0.2s;
}

.quick-zoom-btn:hover {
    background: #6d28d9;
}

.stats-bar strong {
    color: #7c3aed;
    font-weight: bold;
}

/* Table section */
.table-section {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-top: 3px solid #e2e8f0;
    height: 400px;
}

.table-header {
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.table-header h3 {
    font-size: 14px;
    font-weight: bold;
    color: #1a365d;
    margin: 0;
}

.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Grot 10', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #7c3aed;
}

.search-box::before {
    content: "\1F50D";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
}

.result-count {
    font-size: 12px;
    color: #718096;
}

.table-container {
    flex: 1;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 10;
}

th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 500;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

th:hover {
    background: #f1f5f9;
}

th.sorted-asc::after {
    content: " ▲";
    font-size: 10px;
}

th.sorted-desc::after {
    content: " ▼";
    font-size: 10px;
}

td {
    padding: 10px 15px;
    border-bottom: 1px solid #f1f5f9;
    color: #2d3748;
}

tr {
    cursor: pointer;
    transition: background 0.15s;
}

tr:hover {
    background: #f8fafc;
}

tr.highlighted {
    background: #faf5ff !important;
    outline: 2px solid #7c3aed;
    outline-offset: -2px;
}

.amount-cell {
    font-weight: bold;
}

.rank-cell {
    color: #718096;
}

.percentile-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.1);
}

.footer {
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #64748b;
    flex-shrink: 0;
}

.footer-source {
    display: flex;
    gap: 20px;
}

.footer-credit {
    font-style: normal;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 20px;
    }

    .header .description {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .legend-bar {
        gap: 8px;
    }

    .legend-label {
        width: 100%;
        margin-bottom: -4px;
    }

    .legend-color {
        width: 22px;
        height: 12px;
    }

    .legend-values span {
        width: 22px;
        font-size: 9px;
    }

    .map-container {
        height: 400px;
        min-height: auto;
    }

    .stats-bar {
        left: 10px;
        right: auto;
        display: flex;
        gap: 10px;
        font-size: 11px;
    }

    .stats-bar span {
        margin-right: 0;
    }

    .quick-zoom-btn {
        top: 10px;
        right: 10px;
    }

    .table-header {
        padding: 10px 15px;
    }

    .search-box {
        min-width: 100%;
    }

    th, td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .table-section {
        height: 350px;
    }

    .hide-mobile {
        display: none;
    }

    .footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
    }
}
