/* ===================================
   Variables & Reset
   =================================== */
:root {
    --primary-color: #002B7F;
    --secondary-color: #FCD116;
    --accent-color: #CE1126;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --border-color: #e1e8ed;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
    --radius: 8px;
    --radius-lg: 12px;
}

[data-theme="dark"] {
    --primary-color: #4a90e2;
    --secondary-color: #f4d03f;
    --accent-color: #e74c3c;
    --text-color: #e0e0e0;
    --text-light: #a0a0a0;
    --bg-color: #1a1a2e;
    --card-bg: #252538;
    --border-color: #3a3a4f;
    --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);
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Header
   =================================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #003ba0 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flag {
    font-size: 2rem;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.btn-icon {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

    transform: translateY(-2px);
}

/* ===================================
   Intro Section (SEO Content)
   =================================== */
.intro-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.5s ease;
}

.intro-text h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.intro-text p {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: var(--text-color);
}

.intro-list {
    margin: 1.5rem 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.intro-list li {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.intro-list li:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ===================================
   Region Selector
   =================================== */
.region-selector {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.selector-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 300px;
}

.selector-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.region-dropdown {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    max-width: 400px;
}

.region-dropdown:hover {
    border-color: var(--primary-color);
}

.region-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,43,127,0.1);
}

.data-info {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.info-label {
    font-weight: 600;
}

.info-value {
    color: var(--primary-color);
    font-weight: 700;
}

/* ===================================
   Loading & Error States
   =================================== */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    margin: 2rem 0;
}

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

.error-state h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.error-state code {
    background: var(--bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

/* ===================================
   Filters
   =================================== */
.filters {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-color);
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-separator {
    color: var(--text-light);
}

/* ===================================
   Sections
   =================================== */
.sections-container {
    display: grid;
    gap: 2rem;
}

.section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
}

.section:hover {
    box-shadow: var(--shadow-lg);
}

.section-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #003ba0 100%);
    color: white;
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.section-header:hover {
    background: linear-gradient(135deg, #003ba0 0%, var(--primary-color) 100%);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-toggle {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.section-toggle.expanded {
    transform: rotate(180deg);
}

.section-content {
    padding: 2rem;
    display: none;
}

.section-content.expanded {
    display: block;
}

/* ===================================
   Indicators
   =================================== */
.indicator {
    margin-bottom: 3rem;
}

.indicator:last-child {
    margin-bottom: 0;
}

.indicator-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.indicator-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.indicator-unit {
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
}

.chart-container {
    width: 100%;
    max-width: 1200px;
    height: 600px;
    margin: 0 auto 1.5rem auto;
}

/* ===================================
   Tables
   =================================== */
.data-table-wrapper {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: var(--bg-color);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--bg-color);
}

.data-table .category-name {
    font-weight: 500;
    color: var(--text-color);
}

.data-table .data-value {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.data-table .data-value.positive {
    color: #27ae60;
}

.data-table .data-value.negative {
    color: #e74c3c;
}

/* ===================================
   Footer
   =================================== */
/* ===================================
   Footer
   =================================== */
.footer {
    background: var(--card-bg);
    border-top: 2px solid var(--border-color);
    margin-top: 4rem;
    padding: 3rem 0 1.5rem;
    color: var(--text-light);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section h4 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

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

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

.footer-section a {
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}


/* ===================================
   Utilities
   =================================== */
.icon {
    display: inline-block;
}

.text-muted {
    color: var(--text-light);
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .logo {
        font-size: 1.4rem;
    }

    .region-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .selector-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .region-dropdown {
        max-width: 100%;
    }

    .data-info {
        justify-content: center;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .chart-container {
        height: 400px;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .header {
        padding: 1rem 0;
    }

    .section-content {
        padding: 1rem;
    }

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

/* ===================================
   Animations
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section {
    animation: fadeIn 0.5s ease;
}

.indicator {
    animation: fadeIn 0.5s ease;
}

/* Map Page Styles */
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--bg-secondary);
}

.nav-link.active {
    color: var(--primary-color);
    background-color: var(--bg-secondary);
    font-weight: 600;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    margin-left: 2rem;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.map-container-wrapper {
    height: 600px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--card-bg);
    border-radius: var(--border-radius); /* Assuming variable exists or default */
    box-shadow: var(--shadow);
    overflow: hidden;
}

.map-info-box {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 10;
    min-width: 200px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(5px);
}

.dark-mode .map-info-box {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.info-box-title {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.dark-mode .info-box-title {
    color: #f8fafc;
    border-color: #475569;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    font-weight: 500;
}

.info-value {
    font-weight: 700;
    color: #3b82f6;
}

.salary-map {
    width: 100%;
    height: 100%;
}

.map-legend-info {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.top-counties-section {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.text-success { color: #10b981; }
.text-danger { color: #ef4444; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }

@media (max-width: 768px) {
    .header-nav {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
    }
    
    .map-container-wrapper {
        height: auto;
        min-height: 500px;
        display: flex;
        flex-direction: column;
    }

    .salary-map {
        height: 400px; /* Fixed height for map on mobile */
        flex-shrink: 0;
    }

    .map-info-box {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        min-width: auto;
        margin-top: 1rem;
        background: rgba(255, 255, 255, 0.5); /* Somewhat transparent */
        box-shadow: none;
        border: 1px solid rgba(0,0,0,0.05);
    }
}
