/* 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: 800px;
    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;
}

.highlight {
    color: #2563eb;
    font-weight: 500;
}

/* Search section */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@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 select,
.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 select:focus,
.input-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

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

.search-button:disabled {
    background-color: #93c5fd;
    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: #f0f7ff;
}

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

.autocomplete-item .state-name {
    color: #666;
    font-size: 0.875rem;
}

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

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

.example-btn:hover {
    color: #1d4ed8;
}

/* Results */
.results {
    background-color: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}

.results.hidden {
    display: none;
}

.headline {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.headline .peak-year {
    color: #2563eb;
}

.headline .change-positive {
    color: #16a34a;
}

.headline .change-negative {
    color: #dc2626;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

.data-note {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    font-style: italic;
}

/* 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: #2563eb;
    text-decoration: none;
}

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

footer p {
    margin-bottom: 0.5rem;
}

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