.dashboard-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 25px 0;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.filter-group {
    display: flex;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: flex-start;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 5px;
    /* Space for scrollbar */
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.filter-group::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.filter-btn {
    white-space: nowrap;
    /* Prevent text wrapping */
    flex-shrink: 0;
    /* Prevent button shrinking */
    padding: 10px 22px;
    border: 2px solid #e2e8f0;
    background: transparent;
    border-radius: 30px;
    /* More rounded */
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.filter-btn:hover {
    background: #f1f5f9;
}

.filter-btn.active {
    background: #0f172a;
    color: white;
    border-color: #0f172a;
}

.pyramid-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.pyramid-container h2 {
    text-align: center;
    color: #0f172a;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.pyramid-chart {
    height: 400px;
    position: relative;
}

.secondary-charts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    margin-top: 40px;
}

.secondary-charts-grid .pyramid-container {
    flex: 1 1 250px;
    max-width: 250px;
    margin: 0;
    padding: 20px;
}

.secondary-charts-grid .pyramid-chart {
    height: 250px;
}

.secondary-charts-grid h2 {
    font-size: 1.1rem;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-count {
    text-align: center;
    font-weight: 800;
    color: #475569;
    margin-top: 15px;
    font-size: 1rem;
}

.dashboard-section {
    margin-top: 60px;
    border-top: 2px solid #e2e8f0;
    padding-top: 40px;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-banner {
    background: linear-gradient(135deg, #0f172a, #475569);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin: 20px 0;
}

.summary-banner h3 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 800;
}

.summary-banner p {
    margin: 5px 0 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .pyramid-container {
        padding: 20px 15px;
    }

    .pyramid-container h2 {
        font-size: 1.25rem;
    }

    .summary-banner {
        padding: 20px;
    }

    .summary-banner h3 {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .filter-group {
        flex-wrap: wrap !important;
        justify-content: center !important;
        overflow-x: visible !important;
        gap: 8px;
    }

    .filter-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .pyramid-chart {
        height: 400px;
    }

    /* Doughnut charts can be a bit shorter on mobile */
    #birthplaceChart,
    #indigenousChart {
        height: 300px !important;
    }

    .summary-banner h3 {
        font-size: 1.8rem;
    }

    h1 {
        font-size: 1.5rem !important;
    }

    .dashboard-controls {
        padding: 15px;
    }

    .secondary-charts-grid .pyramid-container {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .secondary-charts-grid .pyramid-chart {
        height: 300px;
    }
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #1e293b;
    transform: translateY(-5px);
}

.back-to-top .arrow {
    font-size: 24px;
    font-weight: bold;
}