﻿/* ====== Page background + rhythm ====== */
body, .page {
    background: #f5f7fb;
}

.page-inner {
    padding-top: .75rem;
}

/* ====== Hero / header (LIGHT like screenshot) ====== */
.mf-hero {
    position: relative;
    overflow: hidden;
    background: #ffffff !important;
    color: #111827 !important;
    border-radius: 14px;
    padding: .9rem 1rem;
    border: 1px solid #e9edf5;
    box-shadow: 0 6px 18px rgba(16,24,40,.06);
}

    .mf-hero::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg,#5aa6ff,#8b7bff);
        border-top-left-radius: 14px;
        border-top-right-radius: 14px;
        opacity: .9;
    }

.mf-navbar-caption {
    font-size: .75rem;
    opacity: 1;
    letter-spacing: .02em;
    color: #6b7280 !important;
}

.mf-navbar-main {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a !important;
}

.mf-hero-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a !important;
}

.mf-hero-text {
    font-size: .88rem;
    opacity: 1;
    max-width: 640px;
    color: #6b7280 !important;
}

.mf-hero .btn {
    border-radius: 10px !important;
    font-weight: 600;
    font-size: .8rem;
    padding: .35rem .6rem;
}

.mf-hero .btn-light {
    background: #f3f4f6 !important;
    color: #111827 !important;
    border: 1px solid #e5e7eb !important;
}

.mf-hero .btn-outline-primary {
    color: #2563eb !important;
    border: 1px solid #c7d2fe !important;
    background: #eef2ff !important;
}

    .mf-hero .btn-outline-primary:hover {
        background: #e0e7ff !important;
    }

.no-icon-hover .icon-primary,
.no-icon-hover:hover .icon-primary,
.no-icon-hover:focus .icon-primary,
.no-icon-hover:active .icon-primary {
    color: var(--bs-primary) !important;
}

/* ====== Filters bar ====== */
.mf-filters {
    background: #fff;
    border-radius: 12px;
    padding: .75rem .75rem .25rem;
    box-shadow: 0 6px 18px rgba(16,24,40,.06);
}

.mf-filter-label {
    font-size: .72rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .25rem;
}

.mf-filters .form-control {
    border-radius: 10px;
    height: 34px;
    font-size: .85rem;
}

.mf-filter-reset {
    height: 34px;
    border-radius: 10px;
    border: 0;
    background: #eef2ff;
    color: #374151;
    font-weight: 700;
    font-size: .82rem;
}

    .mf-filter-reset:hover {
        background: #e0e7ff;
    }

/* ====== Cards ====== */
.mf-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(16,24,40,.06);
    overflow: hidden;
}

.mf-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1rem;
    border-bottom: 1px solid #eef2f7;
}

.mf-card-title {
    font-weight: 700;
    font-size: .98rem;
    margin: 0;
}

.mf-card-subtitle {
    font-size: .78rem;
    color: #6b7280;
    margin-top: .1rem;
}

.mf-card-header-tools {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.mf-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4b7cf3;
    background: #eef2ff;
    font-size: .9rem;
}

.mf-card-tag {
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
}

/* ====== KPI strip ====== */
.mf-kpi {
    background: #fff;
    border-radius: 12px;
    padding: .75rem .8rem;
    box-shadow: 0 6px 18px rgba(16,24,40,.06);
}

.mf-kpi-top {
    display: flex;
    gap: .6rem;
    align-items: center;
}

.mf-kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #fff;
}

.mf-kpi-icon--blue {
    background: #4b7cf3;
}

.mf-kpi-icon--green {
    background: #10b981;
}

.mf-kpi-icon--teal {
    background: #14b8a6;
}

.mf-kpi-icon--purple {
    background: #8b5cf6;
}

.mf-kpi-icon--orange {
    background: #f59e0b;
}

.mf-kpi-icon--success {
    background: #22c55e;
}

.mf-kpi-label {
    font-size: .78rem;
    color: #6b7280;
    font-weight: 700;
}

.mf-kpi-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
}

.mf-kpi-sub {
    font-size: .72rem;
    color: #6b7280;
    margin-top: .35rem;
}

.mf-kpi-pill {
    font-size: .7rem;
    font-weight: 800;
    margin-left: .35rem;
    padding: .1rem .35rem;
    border-radius: 999px;
    background: #ecfdf5;
    color: #059669;
}

/* ====== Province table (right panel) ====== */
.mf-card--province .mf-table {
    padding: 0 1rem 0 .25rem; /* 1rem space on right */
    max-height: calc(100vh - 340px);
}

/* header row (default: province layout) */
.mf-th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    border-radius: 8px;
    margin: .1rem 0 .1rem;
    display: grid;
    grid-template-columns: minmax(110px, 220px) 70px 70px 70px; /* 4 cols */
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #6b7280;
}

    .mf-th .mf-cell {
        padding: .18rem .35rem;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

        /* keep first header slightly indented */
        .mf-th .mf-cell:first-child {
            justify-content: flex-start;
            text-align: left;
            padding-left: 1.3rem;
        }

        /* keep total header slightly pulled in from right */
        .mf-th .mf-cell:last-child {
            padding-right: .6rem;
        }

/* data rows (base for all mf-tr rows) */
.mf-tr,
#provinceTable > div:not(.mf-th) {
    display: grid;
    grid-template-columns: minmax(110px, 220px) 70px 70px 70px;
    align-items: center;
    border-radius: 4px;
    margin-bottom: .08rem;
    background: #fff;
    box-shadow: inset 0 0 0 1px #eef2f7;
    min-height: 26px;
}

    .mf-tr:hover,
    #provinceTable > div:not(.mf-th):hover {
        background: #f9fafb;
    }

    .mf-tr .mf-cell,
    #provinceTable > div:not(.mf-th) .mf-cell {
        padding: .04rem .35rem;
        font-size: .76rem;
        line-height: 1;
        display: flex;
        align-items: center;
    }

/* Province table cells */
#provinceTable .mf-cell:first-child {
    padding-left: 1.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

/* Public, Private, Total columns: center */
#provinceTable .mf-cell:nth-child(2),
#provinceTable .mf-cell:nth-child(3),
#provinceTable .mf-cell:nth-child(4) {
    justify-content: center;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: #111827;
}

/* total column a bit left */
#provinceTable .mf-cell:nth-child(4) {
    padding-right: .6rem;
}

/* double height of bar under Total */
#provinceTable .mf-cell:last-child .mf-bar,
#provinceTable .mf-cell:last-child .bar,
#provinceTable .mf-cell:last-child .mini-bar,
#provinceTable .mf-cell:last-child .progress {
    height: 6px !important;
    border-radius: 6px;
}

#provinceTable {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* ====== District card + table (mirror province, 4 cols) ====== */

/* make the district card fill available height on desktop */
.mf-card--district {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 440px); /* adjust offset if needed */
}

    .mf-card--district .mf-table {
        flex: 1 1 auto;
        padding: 0 1rem 0 .25rem;
        max-height: none;
    }

/* header grid for district: 4 cols (District | Public | Private | Total) */
#districtTable .mf-th {
    grid-template-columns: minmax(110px, 220px) /* District */
    70px /* Public */
    70px /* Private */
    70px; /* Total */
}

    /* header paddings for district */
    #districtTable .mf-th .mf-cell:first-child {
        padding-left: 1.3rem;
    }

    #districtTable .mf-th .mf-cell:last-child {
        padding-right: .6rem;
    }

/* data rows for district table: 4 cols */
#districtTable > div:not(.mf-th) {
    display: grid;
    grid-template-columns: minmax(110px, 220px) /* District */
    70px /* Public */
    70px /* Private */
    70px; /* Total */
    align-items: center;
    border-radius: 4px;
    margin-bottom: .08rem;
    background: #fff;
    box-shadow: inset 0 0 0 1px #eef2f7;
    min-height: 26px;
}

    #districtTable > div:not(.mf-th):hover {
        background: #f9fafb;
    }

/* cells */
#districtTable .mf-cell {
    padding: .04rem .35rem;
    font-size: .76rem;
    line-height: 1;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

    /* District label like province label: left-aligned */
    #districtTable .mf-cell:nth-child(1) {
        padding-left: 1.35rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 600;
        justify-content: flex-start;
        text-align: left;
    }

    /* numeric cols: Public, Private, Total -> centered */
    #districtTable .mf-cell:nth-child(2),
    #districtTable .mf-cell:nth-child(3),
    #districtTable .mf-cell:nth-child(4) {
        justify-content: center;
        text-align: center;
        font-variant-numeric: tabular-nums;
        color: #111827;
    }

    /* total padding + bar height */
    #districtTable .mf-cell:nth-child(4) {
        padding-right: .6rem;
    }

        #districtTable .mf-cell:nth-child(4) .mf-bar,
        #districtTable .mf-cell:nth-child(4) .mf-bar-bg,
        #districtTable .mf-cell:nth-child(4) .bar,
        #districtTable .mf-cell:nth-child(4) .mini-bar,
        #districtTable .mf-cell:nth-child(4) .progress {
            height: 6px !important;
            border-radius: 6px;
        }

/* align district table padding with province */
#districtTable {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* ===== Map/chart heights ===== */
#mapContainer {
    height: 360px;
}

#facilityTypeChart {
    height: 360px !important;
}

#healthWorkersChart {
    height: 360px !important;
}

/* ===== Responsive tweaks ===== */
@media (max-width: 991.98px) {
    #mapContainer {
        height: 360px;
    }

    #facilityTypeChart {
        height: 360px !important;
    }

    #healthWorkersChart {
        height: 360px !important;
    }

    .mf-card--province .mf-table {
        max-height: none;
        padding-left: 5rem !important;
    }

    .mf-th,
    .mf-tr,
    #provinceTable > div:not(.mf-th) {
        grid-template-columns: minmax(95px, 170px) 60px 60px 60px;
    }

        .mf-th .mf-cell:first-child,
        #provinceTable .mf-cell:first-child {
            padding-left: 1rem;
        }

    /* district card can shrink on small screens */
    .mf-card--district {
        min-height: auto;
    }

        .mf-card--district .mf-table {
            max-height: none;
            padding-left: 5rem !important;
        }

    /* district: 4 cols on mobile as well */
    #districtTable .mf-th,
    #districtTable > div:not(.mf-th) {
        grid-template-columns: minmax(95px, 160px) /* District */
        60px /* Public */
        60px /* Private */
        60px; /* Total */
    }

    #districtTable .mf-cell:nth-child(1) {
        padding-left: 1rem;
    }
}

/* ===== Preloader ===== */
.preloader {
    position: fixed;
    inset: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.25s ease-out, visibility 0.25s ease-out;
}

    .preloader.hidden {
        opacity: 0;
        visibility: hidden;
    }

/* Make Highcharts fill the fixed-height containers */
#healthWorkersChart {
    height: 360px !important;
    position: relative;
}

/* ====== Chart cards ====== */
.mf-card--chart {
    display: flex;
    flex-direction: column;
    height: 360px;
}

/* ====== Insights list ====== */
#insightsList {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

    #insightsList li {
        margin-bottom: 0.25rem;
    }

/*Button alignment*/
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
}
