/*
© Pacifique Bisimwa Mugisho
pacifiquemugisho@gmail.com
R2208D14995778
UNICAF University 
Project Module (UU-MWD-780-ZM-72176) 
==================================== 
Stylesheet for the dashboard.
-----------------------------------------------------------------------------------------------------------*/
/* General styles for the body and layout */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f4f9;
}

header {
    background: #007BFF;
    color: white;
    padding: 20px;
    text-align: center;
}

main {
    padding: 20px;
}

.overview {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    margin-bottom: 20px;
}

.metric {
    background: white;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    flex: 1 1 calc(33.333% - 20px); /* Responsive layout for 3 metrics */
    margin: 10px;
    min-width: 200px; /* Ensure it doesn't shrink too small */
}

/* Responsive map section */
#map-container {
    margin: 20px 0;
}

#map {
    height: 400px;
    border-radius: 5px;
    width: 100%; /* Ensure the map adjusts to the screen size */
}

/* Responsive charts section */
#charts {
    margin: 20px 0;
}

canvas {
    margin: 20px auto;
    width: 100%;
    max-width: 600px; /* Limit the size of charts on larger screens */
}

/* Responsive table */
#data-table {
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

table th, table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 14px; /* Adjust font size for better readability on small screens */
}

#filter {
    margin-bottom: 10px;
    padding: 10px;
    width: 100%;
    max-width: 300px;
}

/* Download button styling */
.btn-download {
    display: inline-block;
    padding: 10px 20px;
    color: white;
    background-color: #28a745;
    text-decoration: none;
    border-radius: 5px;
    font-size: 16px;
}

.btn-download:hover {
    background-color: #218838;
}

/* Media Queries for Responsiveness */

/* For screens smaller than 768px (tablets and phones) */
@media screen and (max-width: 768px) {
    .overview {
        flex-direction: column; /* Stack metrics vertically */
        align-items: stretch;
    }

    .metric {
        flex: 1 1 100%; /* Each metric takes full width */
        margin: 10px 0;
    }

    #charts canvas {
        max-width: 100%; /* Allow charts to use full width */
    }

    table th, table td {
        font-size: 12px; /* Smaller font for table on small screens */
    }

    #map {
        height: 300px; /* Adjust map height for smaller screens */
    }
}

/* For screens smaller than 480px (small phones) */
@media screen and (max-width: 480px) {
    header {
        font-size: 20px; /* Smaller header font for mobile */
    }

    .metric h2 {
        font-size: 18px; /* Smaller font size for metrics */
    }

    .metric p {
        font-size: 16px;
    }

    #filter {
        width: 100%; /* Full width for the filter input */
    }

    .btn-download {
        font-size: 14px; /* Smaller font for download button */
        padding: 8px 15px;
    }
}
/* Ensure the table is scrollable on small screens */
#data-table {
    overflow-x: auto; /* Enable horizontal scrolling */
}

table {
    width: 100%; /* Full width */
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

table th, table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 14px;
}

@media screen and (max-width: 768px) {
    table th, table td {
        font-size: 12px; /* Smaller font for better readability */
    }
}

header h1 {
    font-size: 2.5rem; /* Default size for large screens */
    text-align: center;
    margin: 0;
    padding: 10px;
    color: white;
    word-wrap: break-word; /* Ensure the title wraps if it’s long */
}

/* Reduce font size for smaller screens */
@media screen and (max-width: 768px) {
    header h1 {
        font-size: 2rem; /* Slightly smaller font for tablets */
    }
}

@media screen and (max-width: 480px) {
    header h1 {
        font-size: 1.5rem; /* Even smaller font for mobile phones */
    }
}

header {
    background: #007BFF;
    color: white;
    padding: 20px; /* Default padding */
    text-align: center;
}

@media screen and (max-width: 768px) {
    header {
        padding: 15px; /* Reduce padding for tablets */
    }
}

@media screen and (max-width: 480px) {
    header {
        padding: 10px; /* Minimal padding for mobile */
    }
}