@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    color: #333;
}

html {scroll-behavior: smooth;}
.main-page {display: flex;}

.main-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    position: relative;
    padding-top: 75px;
    transition: margin-left 0.3s, width 0.3s;
}
.main-content.full-width {
    margin-left: 80px;
    width: calc(100% - 80px);
}

/* Sidebar */
.sidebar {
    position: fixed;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    justify-content: flex-start;
    padding-top: 70px;
    margin-right: 25px;
    width: 175px;
    height: 100vh;
    top: 0;
    left: 0;
    transform: translateX(-100%);
}
.sidebar.active {transform: translateX(0);}
.sidebar ul {
    list-style: none;
    flex-grow: 1;
    padding: 0;
    margin: 0;
}
.sidebar ul li a {
    display: flex;
    color: #333;
    font-weight: 200;
    text-decoration: none;
    padding: 10px 15px;
    align-items: center;
    white-space: nowrap;
    border-radius: 0 20px 20px 0;
}
.sidebar ul li a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}
.sidebar a:hover {background-color: #ddd;}
.sidebar li a.active {background-color: #bfc8de;}
.sidebar.active ~ .main-content {
  margin-left: 200px;
  width: calc(100%);
}
header {
    position: fixed;
    display: flex;
    flex-wrap: wrap;
    z-index: 1002;
    background: #f0f2f5;
    color: #1e3c72;
    padding: 10px 30px;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    left: 0;
    top: 0;
    right: 0;
}
.header-left {
    display: flex;
    gap: 10px;
}
.header-title {
    cursor: pointer;
}
header h1 {
    flex-shrink: 0;
    font-size: 2em;
    margin: 0;
    align-items: center;
}
header h5 {
    margin: 0;
}
.header-btn {
    display: flex;
    flex-shrink: 0;
    align-items: center;
}
/* Header button */
.hamburger-btn {
    font-size: 1.25em;
    top: 18px;
    left: 10px;
    background: none;
    border: none;
    color: #333;
    padding: 0;
    margin: 0;
    display: block;
    cursor: pointer;
}
.info-btn {
    color:#1e3c72;
    border-radius: 50px;
    border-color:#1e3c72;
    width: 25px;
    height: 25px;
    cursor: pointer;
}
#guest-btn { margin-left: 50px; }
#barangay-btn, #year-btn, #forecast-btn {
    align-self: flex-end;
    margin-top: 5px;
}
#hospital-btn {
    align-self: flex-end;
    margin-bottom: 5px;
}

#charts, #forecast, #barangay, #prevention, #year, #contact {
    background: #f9f9f9;
    border-radius: 20px;
    box-shadow: 0 0 3px rgba(0,0,0,0.1);
    padding: 20px;
    margin: 20px 10px 20px 10px;
    justify-content: center;
}
#forecast, #prevention, #barangay, #year, #contact {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
#dashboard, #charts, #barangay {
    display: flex;
    flex-wrap: wrap;
    border-radius: 20px;
    justify-content: space-around;
    box-sizing: border-box;
}
#dashboard, #charts, #barangay { padding: 20px; }
.dashboard-card, .chart-card, .barangay-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    margin: 5px;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-sizing: border-box;
}
.dashboard-card, .chart-card, .barangay-card { background-color: rgba(0, 0, 0, 0.2); }
.dashboard-card, .chart-card {
    max-width: 500px;
    min-width: 250px;
}
#dashboard {background: #1e3c72; color: white; margin: 0 10px;}
.dashboard-card {
    justify-content: flex-end;
}
.dashboard-card h1 {
    margin: 0;
    font-size: 7.5em;
    color: #4BC0C0;
}
.dashboard-card p {
    margin: 5px 0 0;
    font-size: 1.1em;
}
#barangay-map1 {
    height: 300px;
}
.legend {
    background: rgba(255, 255, 255, 0.5);
    padding: 5px;
    line-height: 1.5em;
    color: #333;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    font-size: 10px;
}
.chart-card {
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    justify-content: center;
}
.chart-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
}
.chart-card a {
    font-size: smaller;
}
.barangay-wrapper, .barangay-forecast {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
}
.barangay-map-container, .forecast-map-container, .citywide-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-around;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}
.barangay-map-container, .forecast-map-container {
    flex: 1 1 500px;
}
.barangay-map-container, .forecast-wrapper, .citywide-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.barangay-map-container, .forecast-wrapper {
    margin: 0;
    padding: 5px;
}
.citywide-container {
    margin: 10px 0 10px 0;
    padding: 5px 5px 10px 5px;
}
#citywide-table {
    flex: 1 1 0;
    min-width: 300px;
    max-width: 450px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px;
    font-size: small;
}
.citywide-card {
    min-height: 250px;
    max-height: 400px;
    min-width: 300px;
    max-width: 550px;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    margin: 20px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.barangay-list, .forecast-list {
    flex: 1 1 0;
    min-width: 300px;
    max-width: 550px;
    height: 600px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px;
    font-size: small;
}
thead th {
    position: sticky;
    top: 0;
    background-color: #ffffff;
    color: #1e3c72;
    z-index: 1;
}
#barangay-map2, #forecast-map {
    flex: 1 1 0;
    min-width: 400px;
    max-width: 550px;
    min-height: 600px;
    border-radius: 10px;
    border: 2px solid #ccc;
    margin: 10px;
    box-sizing: border-box;
}
.barangay-card {
    max-width: 500px;
    min-width: 300px;
    max-height: 650px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    align-items: center;
    box-sizing: border-box;
}
.search-container, .control-container { 
    position: relative;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin: 5px;
    gap: 5px;
}
.search-container { width: 100%; }
.control-container { width: 300px; }
.search-input, #forecast-week-select, #year-select,
#barangay-year-select, #barangay-week-select {
    width: 100%;
    padding: 12px 80px 12px 12px;
    font-size: small;
    box-sizing: border-box;
    border: none;
    border-radius: 8px;
}
.search-button {
    color: #1e3c72;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
}
#generate-forecast { 
    padding: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease-in;
    background-color: #e0e7f2;
}
#generate-forecast:hover { background-color: #d3dce8; }
#barangay-details {
    margin-top: 20px;
    border-radius: 10px;
}
.barangay-text { color: #888888; }
.barangay-citywide-wrapper {
    display: none;
    flex-direction: column;
}

#year-control, #barangay-control {
    justify-content: flex-end;
}
.year-header {
    display: flex;
    flex-direction: column;
}
.year-header-cases {
    display: flex;
    align-items: center;
    gap: 10px;
}
.yearly {
    display: flex;
    flex-wrap: wrap;
    background-color: #ffffff;
    border-radius: 10px;
    justify-content: space-around;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    gap: 10px;
    padding: 10px;
}
.yearly-chart-panel  { 
    flex: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 500px;
    justify-content: center;
}
#sort-options label {
    font-size: small;
    margin: 0 10px 0 10px;
}
.yearly-chart-panel canvas {
    display: flex;
}
.yearly-card-container {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: center;
    justify-content: center;
}
.yearly-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    padding: 5px;
    border-radius: 10px;
    text-align: center;
    box-sizing: border-box;
    justify-content: flex-end;
    min-width: 350px;
    max-width: 500px;
    max-height: 200px;
    min-height: 100px;
}
.yearly-card canvas {
    box-sizing: border-box;
    margin: 0;
}

#forecast-description {
    display: flex;
    max-width: 500px;
    min-width: 200px;
    text-align: justify;
    align-self: center;
    justify-self: center;
    padding: 12px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
#forecast-description h3 { font-weight: 100; font-size: small; }
.forecast-card {
    min-height: 250px;
    max-height: 400px;
    min-width: 400px;
    max-width: 550px;
    display: flex;
    flex-direction: column;
    margin: 20px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.control {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    justify-content: center;
}
#forecast-week-select {
    font-family: 'Poppins', sans-serif;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* Prevention */
.message {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(90deg, #1e3c72, #577cbd);
    color:white;
    padding: 18px 20px;
    border-radius: 10px;
    margin-bottom: 22px;
    font-weight: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    white-space: pre-line;
}
.prevention-content-title { margin-bottom:10px; color:#27ae60; white-space: pre-line; }
.prevention-content-text { margin-bottom:20px; white-space: pre-line; }
.prevention-content {
    background-color: #ffffff;
    color:#222;
    padding: 18px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    text-align: center;
}
#prevention_content_container {
    display: inline-block;
    text-align: left;
    margin: 0 auto;
}
.prevention-content h3 { margin-bottom:10px; color:#27ae60; }

/* Contact */
#contact {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    margin-bottom: 100px;
}
.contact-wrapper {
    background:linear-gradient(90deg, #1e3c72, #577cbd);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(241, 196, 15, 0.08);
    color: #ffffff;
    padding: 10px 24px 0 24px;
}
.contact-details, #video-wrapper {
    padding-bottom: 10px;    
    overflow-x: auto;
    white-space: nowrap;
}
.contact-details-row, #video-slides-row {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: max-content;
    font-size: small;
    padding: 5px 0 5px 0;
    box-sizing: border-box;
}
.contact-block, .video-container {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.07);
    box-sizing: border-box;
}
.video-container {
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: start;
    overflow: hidden;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
}
iframe { 
    height: 250px;
}
.contact-block {
    height: 200px;
    width: 300px;
    margin: 5px auto 18px auto;
    padding: 20px;
    color: #222222;
    word-wrap: break-word;
    white-space: normal;
    flex: 0 0 auto;
}
#contact h3 { margin-top: 30px;color: #27ae60; }
.contact-block a { color: #2980b9; text-decoration: underline; }
.hospitals {
    width: 100%;
    overflow-x: auto;
    margin: 0 auto 18px auto;}
.hospital-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border-radius: 10px;
    font-size: small;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    overflow: hidden;
}
.hospital-table th, .hospital-table td {
    padding: 12px 10px;
    border: 1px solid #e0e0e0;
    text-align: left;
}
.hospital-table th {
    background: #577cbd;
    color: white;
    font-weight: 700;
}
.hospital-table tr:nth-child(even) {
    background: #f9f9f9;
}
#hospital_map {
    height: 400px;
    width: 100%;
    margin-bottom: 20px;
    border-radius: 10px;
}

/* Responsiveness */
@media (max-width: 768px) {
    .hospital-table th, .hospital-table td {
        padding: 8px 4px;
    }
    .modal-content {
        padding: 18px 8px 16px 8px;
        max-width: 95vw;
    }
}
@media (max-width: 650px) {
    #forecast, #barangay, #contact, #prevention, #year {
        padding: 20px 10px;
        text-align: center;
    }
    #forecast-description h3 { font-size: small; }
    .forecast-controls {
        flex-direction: column;
    }
    #barangay-map2, #forecast-map {
        min-width: 200px;
        min-height: 200px;
    }
    .forecast-card, .barangay-card, .citywide-card {
        min-width: 150px;
        max-width: 400px;
    }
    .forecast-card {
        margin: 0;
    }
    .barangay-list, .forecast-list {
        min-width: 150px;
        height: 200px;
    }
    #sort-options label {
        font-size: x-small;
        margin: 0 5px 0 5px;
    }
    .section-title, #forecast-barangay, #barangay-search,
    #barangay-details h3, #barangay-details th, #barangay-details td, .message h1  {
        font-size: large;
    }
    .message p, .prevention-content-title, .prevention-content-text {
        font-size: small;
    }
    .sources-section h4, #reference-list li { font-size: smaller; }
    .dashboard-card {
        padding: 10px;
    }
    .contact-wrapper { margin: 5px; text-align: left;}
    .hospitals {
        overflow: auto;
        margin-bottom: 10px;
    }
    #barangay-control {
        justify-content: space-between;
        margin: 0px;
    }
    #barangay-control-container {
        width: 100%;
    }
    .search-container, #forecast-week-select, #barangay-control-container select, #year-control-container select {
        font-size: x-small;
    }
    .prevention-content {
        height: 500px;
        overflow: auto;
    }
    .sources-section {
        height: 200px;
        overflow: auto;
    }
    .sidebar {
        z-index: 1006;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar.active ~ .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .sidebar.active ~ .overlay {
        display: block;
    }
    header {
        z-index: 1007;
    }
    .overlay {
        z-index: 1004;
    }
    .modal {
        z-index: 1005;
    }
    
    #total-cases-value {
        font-size: medium;
    }
    .yearly {
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .year-header {
        justify-content: center;
        align-items: center;
        text-align: center;
    }
    .yearly-chart-panel { 
        min-width: 100px;
        max-width: 260px;
    }
    .yearly-card-container {
        flex-direction: column;
        align-items: center;
    }
    .yearly-card {
        min-height: 200px;
        min-width: 150px;
    }
}

 /* Modal */
.modal {
    position: fixed;
    display: none;
    z-index: 1004;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}
.modal-wrapper {
    background-color: #ffffff;
    margin: 15% auto;
    padding: 5px 5px 10px 5px;
    border: 1px solid #888;
    border-radius: 10px;
    position: relative;
}
.modal-content {
    padding: 5px;
    width: 400px;
    max-height: 400px;
    overflow: auto;
}
#info-title {
    margin-top: 0;
    text-align: center;
    color: #2c3e50;
}
#info-text {
    text-align: justify;
    margin: 0;
    font-size: small;
}

#loading {
    position: fixed;
    flex-direction: column;
    font-size: x-large;
    color: #1e3c72;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1008;
}
.spinner {
    border: 4px solid #1e3c72;
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}
#load {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1105;
}
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 10px;
    position: relative;
}
#load h2 {color: #1e3c72;}
#load p {color: #2c3e50;}
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.0);
    z-index: 1003;
}

/* Scrollbar */
::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-track { background: #e6ebf7; border-radius: 10px; }
::-webkit-scrollbar-thumb {
    background: #1e3c72; 
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background: #577cbd;
    border: 2px solid transparent;
    background-clip: content-box;
}
