/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.25rem;
    color: #666;
}

/* Search section */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 600px) {
    .search-section {
        flex-direction: row;
        align-items: flex-end;
    }
}

.input-group {
    flex: 1;
    position: relative;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 0.25rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.search-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background-color: #dc2626;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.search-button:hover {
    background-color: #b91c1c;
}

.search-button:disabled {
    background-color: #fca5a5;
    cursor: not-allowed;
}

/* Autocomplete */
.autocomplete-items {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: white;
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.autocomplete-items.active {
    display: block;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #fef2f2;
}

.autocomplete-item .county-name {
    font-weight: 500;
}

/* Examples */
.examples {
    text-align: center;
    margin-bottom: 2rem;
    color: #666;
    font-size: 0.9rem;
}

.example-btn {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
    padding: 0.25rem;
    margin: 0 0.25rem;
}

.example-btn:hover {
    color: #b91c1c;
}

/* Results */
.results {
    margin-top: 2rem;
}

.results.hidden {
    display: none;
}

/* Two-panel layout */
.panels {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .panels {
        grid-template-columns: 1fr 1.5fr;
    }
}

.panel {
    background-color: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.panel h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-subtitle {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
}

/* Risk Panel */
.eal-display {
    text-align: center;
    margin-bottom: 1.5rem;
}

.eal-label {
    display: block;
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.eal-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
}

.eal-subtext {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.25rem;
}

.percentile-display {
    margin-bottom: 1.5rem;
}

.percentile-bar {
    display: block;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.percentile-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.percentile-text {
    display: block;
    font-size: 0.9rem;
    color: #555;
    text-align: center;
}

/* Percentile colors */
.percentile-low { background-color: #22c55e; }
.percentile-below-avg { background-color: #84cc16; }
.percentile-above-avg { background-color: #f97316; }
.percentile-high { background-color: #ef4444; }
.percentile-very-high { background-color: #dc2626; }

/* Hazards */
.hazards-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.75rem;
}

.hazards-list {
    list-style: none;
}

.hazards-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.hazards-list li:last-child {
    border-bottom: none;
}

.hazard-name {
    font-weight: 500;
}

.hazard-eal {
    color: #666;
    font-size: 0.9rem;
}

/* Insurance Panel */
.chart-container {
    position: relative;
    height: 250px;
    margin-bottom: 0.5rem;
}

.chart-note {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.national {
    background-color: #9ca3af;
}

.legend-dot.county {
    background-color: #dc2626;
}

.legend-explanation {
    font-size: 0.75rem;
    color: #999;
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Insight Callout */
.insight-callout {
    background-color: white;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #dc2626;
}

.insight-callout.insight-good {
    border-left-color: #22c55e;
}

.insight-callout.insight-warning {
    border-left-color: #f97316;
}

.insight-callout .insight-icon {
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

.insight-callout .insight-text {
    font-size: 1rem;
    color: #333;
}

/* Error */
.error {
    background-color: #fef2f2;
    color: #dc2626;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
}

.error.hidden {
    display: none;
}

/* Footer */
footer {
    margin-top: 4rem;
    text-align: center;
    color: #888;
    font-size: 0.875rem;
}

footer a {
    color: #dc2626;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer p {
    margin-bottom: 0.5rem;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}
