/* Modern CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2d3748;
    --accent-color: #4a5568;
    --text-color: #1a202c;
    --text-light: #718096;
    --bg-color: #ffffff;
    --bg-secondary: #f7fafc;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-secondary);
}

/* Focus States for Accessibility */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Header Styles */
header {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--accent-color);
}

/* Dropdown Styles */
nav li {
    position: relative;
}

.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    padding: 0.5rem 0;
    z-index: 1000;
}

.dropdown a {
    padding: 0.75rem 1.5rem;
    display: block;
}

nav li:hover .dropdown {
    display: block;
}

/* Breadcrumb */
.breadcrumb-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

.breadcrumb {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.breadcrumb li:not(:last-child)::after {
    content: '›';
    margin-left: 0.5rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    color: var(--accent-color);
}

/* Page Header */
.page-header {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.page-header p {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* Content Sections */
.content-section {
    background-color: var(--bg-color);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2.5rem;
}

.content-section h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-color);
    letter-spacing: -0.025em;
}

.content-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.content-section p {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-light);
    margin-bottom: 1.25rem;
}

.content-section ul {
    margin-bottom: 1.25rem;
    margin-left: 2rem;
    padding-left: 0;
    line-height: 1.75;
    list-style: disc;
}

.content-section li {
    margin-bottom: 0.5rem;
    margin-left: 0;
    padding-left: 0.5rem;
    color: var(--text-light);
}

/* Stats Grid (for city pages) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* States Grid (for country listing pages) */
.states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}

.state-tile {
    background-color: var(--bg-secondary);
    padding: 2rem 1.5rem;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.state-tile:hover,
.state-tile:focus {
    background-color: var(--bg-color);
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

.state-tile:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.state-tile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.state-tile-count {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Cities Grid (for state listing pages) */
.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.city-tile {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.city-tile:hover,
.city-tile:focus {
    background-color: var(--bg-color);
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

.city-tile:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.city-tile-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Chart Container */
.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin: 2rem 0;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: 8px;
}

.chart-container canvas {
    max-width: 100%;
    height: 100% !important;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin: 2rem 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    box-shadow: var(--shadow);
}

/* Scroll indicator shadow */
.table-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    background: linear-gradient(to left, rgba(0,0,0,0.05), transparent);
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-color);
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

/* Sticky header */
th {
    font-weight: 600;
    color: var(--text-color);
    background-color: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--border-color);
}

/* Striped rows */
tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

tbody tr:hover {
    background-color: #edf2f7;
}

/* Right-align numeric columns */
td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

th:not(:first-child) {
    text-align: right;
}

caption {
    padding: 1rem;
    font-weight: 600;
    text-align: left;
    font-size: 1.125rem;
    color: var(--text-color);
    background-color: var(--bg-secondary);
}

/* Mission/Special Sections */
.mission {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem;
    border-radius: 8px;
    margin: 3rem 0;
    text-align: center;
}

.mission h2, .mission h3 {
    color: white;
    margin-bottom: 1rem;
}

.mission p {
    font-size: 1.25rem;
    line-height: 1.8;
    opacity: 0.9;
    color: white;
}

/* Values Grid */
.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.value-card {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.value-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.value-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.value-card p {
    color: var(--text-light);
    font-size: 1rem;
}

/* Timeline */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.timeline-year {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: right;
}

.timeline-content {
    padding-left: 2rem;
    border-left: 3px solid var(--border-color);
}

.timeline-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Button */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn:hover {
    background-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
}

/* Footer */
footer {
    background-color: var(--text-color);
    color: white;
    margin-top: 4rem;
    padding: 3rem 2rem 1.5rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .content-section h2 {
        font-size: 1.5rem;
    }

    .timeline-item {
        grid-template-columns: 1fr;
    }

    .timeline-year {
        text-align: left;
    }

    .chart-container {
        height: 300px;
    }
}
