* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f8fa;
    color: #183042;
}

/* HEADER */

.header {
    background: white;
    padding: 18px 7%;
    border-bottom: 1px solid #e5e5e5;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.logo-placeholder {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: #147cc1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.brand h1 {
    margin: 0;
    font-size: 25px;
}

.brand p {
    margin: 5px 0 0;
    color: #657986;
}

/* NAVIGATION */

.navbar {
    background: #08689c;
    padding: 0 7%;
    display: flex;
}

.navbar a {
    color: white;
    text-decoration: none;
    padding: 17px 20px;
}

.navbar a:hover {
    background: rgba(255,255,255,.15);
}

/* HERO */

.hero {
    min-height: 430px;
    display: flex;
    align-items: center;
    padding: 60px 8%;
    background:
        linear-gradient(
            90deg,
            rgba(4,73,112,.94),
            rgba(5,116,153,.78)
        );
    color: white;
}

.hero-content {
    max-width: 700px;
}

.label {
    font-size: 13px;
    letter-spacing: 2px;
    font-weight: bold;
}

.hero h2 {
    font-size: 52px;
    line-height: 1.05;
    margin: 18px 0;
}

.hero p {
    font-size: 19px;
    line-height: 1.7;
    max-width: 600px;
}

.hero button {
    margin-top: 15px;
    border: none;
    padding: 15px 27px;
    border-radius: 7px;
    background: white;
    color: #076a9c;
    font-weight: bold;
    cursor: pointer;
}

/* GENERAL */

.section {
    padding: 65px 7%;
}

.section-title {
    margin-bottom: 30px;
}

.section-title > p {
    color: #1683ba;
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 12px;
}

.section-title h2 {
    font-size: 32px;
    margin: 7px 0;
}

/* CARDS */

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,.07);
}

.card .icon {
    font-size: 30px;
}

.card p {
    color: #667b87;
}

.card h3 {
    font-size: 27px;
    margin: 10px 0;
}

.card span {
    font-size: 12px;
    color: #85949c;
}

/* WEBGIS */

.webgis-section {
    background: white;
}

.webgis-container {
    min-height: 550px;
    display: grid;
    grid-template-columns: 280px 1fr;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0,0,0,.12);
}

.sidebar {
    background: #f8fafb;
    padding: 25px;
}

.sidebar h3 {
    margin-top: 0;
}

.sidebar label {
    display: block;
    margin: 18px 0 7px;
    font-size: 13px;
    font-weight: bold;
}

.sidebar select {
    width: 100%;
    padding: 11px;
    border: 1px solid #ccd7dd;
    border-radius: 5px;
    background: white;
}

.btn-primary {
    width: 100%;
    margin-top: 25px;
    padding: 13px;
    border: 0;
    border-radius: 6px;
    background: #0875aa;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.legend {
    margin-top: 30px;
    border-top: 1px solid #ddd;
    padding-top: 15px;
}

.legend p {
    font-size: 13px;
}

.map-placeholder {
    min-height: 550px;
    background:
        linear-gradient(
            135deg,
            #dbe9ed,
            #edf5f5
        );
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.map-placeholder h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

.map-placeholder p {
    color: #61757f;
}

.map-placeholder span {
    color: #1581b5;
    font-size: 13px;
}

.map-icon {
    font-size: 65px;
}

/* CHART */

.chart-placeholder {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,.07);
}

.fake-chart {
    height: 230px;
    margin-top: 30px;
    display: flex;
    align-items: flex-end;
    gap: 15px;
    border-bottom: 2px solid #ccd5da;
}

.fake-chart div {
    flex: 1;
    background: #1683ba;
    border-radius: 5px 5px 0 0;
}

.months {
    display: grid;
    grid-template-columns: repeat(12,1fr);
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    color: #687b84;
}

/* FOOTER */

footer {
    background: #073b55;
    color: white;
    padding: 45px 7%;
}

footer p {
    color: #c4d7df;
}

footer small {
    display: block;
    margin-top: 25px;
    color: #91aeb9;
}

/* MOBILE */

@media(max-width:900px) {

    .cards {
        grid-template-columns: repeat(2,1fr);
    }

    .webgis-container {
        grid-template-columns: 1fr;
    }

    .navbar {
        overflow-x: auto;
    }

    .hero h2 {
        font-size: 39px;
    }
}

@media(max-width:550px) {

    .cards {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 50px 6%;
    }

    .hero h2 {
        font-size: 34px;
    }

    .section {
        padding: 45px 5%;
    }
}
/* MAPLIBRE MAP */

#map {
    width: 100%;
    min-height: 550px;
}

/* =========================================================
   ANALISIS GRAFIK CHIRPS
========================================================= */

#analisis {
    width: 100%;
}


/* Pesan sebelum grafik ditampilkan */

.analysis-message {
    width: 100%;
    box-sizing: border-box;

    background: #ffffff;

    padding: 25px;

    margin-top: 20px;

    border-radius: 12px;

    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.08);
}


.analysis-message p {
    margin: 0;

    color: #657986;

    font-size: 14px;
}


/* Panel grafik */

.analysis-chart {
    width: 100%;

    box-sizing: border-box;

    background: #ffffff;

    padding: 25px;

    margin-top: 20px;

    border-radius: 12px;

    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.08);
}


/* Toolbar bagian atas grafik */

.chart-toolbar {
    width: 100%;

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 20px;

    margin-bottom: 20px;
}


#info-grafik {
    font-size: 13px;

    color: #657986;
}


/* Tombol tutup */

.chart-close {
    border: none;

    background: #eeeeee;

    padding: 8px 14px;

    border-radius: 6px;

    cursor: pointer;
}


.chart-close:hover {
    background: #dddddd;
}


/* Wadah canvas */

.chart-canvas-container {
    position: relative;

    width: 100%;

    height: 420px;

    min-width: 0;
}


#grafik-chirps {
    width: 100% !important;

    height: 100% !important;

    display: block;
}


/* Tampilan layar kecil */

@media (max-width: 768px) {

    .chart-canvas-container {
        height: 320px;
    }

    .analysis-chart {
        padding: 15px;
    }

    .chart-toolbar {
        align-items: flex-start;
    }

}

/* ===== WEBGIS: PANEL ACH + ASH DALAM SIDEBAR ===== */
.webgis-container {
    height: min(780px, 85vh);
    min-height: 560px;
    grid-template-columns: minmax(255px, 280px) minmax(0, 1fr);
}
.webgis-container > .sidebar {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 20px 16px;
}
.webgis-container > #map {
    min-width: 0;
    min-height: 0;
    height: 100%;
}
#idw-panel, #ash-panel {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
}
#ash-panel-slot { width: 100%; min-width: 0; }
#ash-panel-slot:empty { display: none; }
#idw-panel label:has(input[type="checkbox"]),
#ash-panel label:has(input[type="checkbox"]) {
    display: flex !important;
    align-items: center !important;
    gap: 7px;
    margin: 10px 0 !important;
    font-size: 12px;
}
#idw-panel input[type="checkbox"], #ash-panel input[type="checkbox"] {
    width: auto !important;
    flex: 0 0 auto;
    margin: 0;
}
#idw-panel input[type="range"], #ash-panel input[type="range"] { width: 100%; }
#idw-panel select, #ash-panel select { max-width: 100%; }
#idw-panel details, #ash-panel details { margin-top: 9px; }
#idw-panel summary, #ash-panel summary { line-height: 1.35; }
@media (max-width: 900px) {
    .webgis-container {
        height: auto;
        min-height: 0;
        grid-template-columns: minmax(0, 1fr);
    }
    .webgis-container > .sidebar {
        max-height: 460px;
        overflow-y: auto;
    }
    .webgis-container > #map { height: 540px; min-height: 540px; }
}
@media (max-width: 550px) {
    .webgis-container > #map { height: 440px; min-height: 440px; }
}

/* Menu produk bertingkat dan kondisi awal bersih */
.ui-hidden-by-menu { display: none !important; }
body.ui-no-selection #idw-panel,
body.ui-no-selection #ash-panel,
body.ui-no-selection #ash-panel-slot,
body.ui-no-selection #produk-legend,
body.ui-no-selection #analisis,
body.ui-no-selection .product-dependent-control { display:none !important; }
.product-tree-heading { font-weight:800; color:#164963; font-size:13px; margin:12px 0 9px; }
#product-tree { margin-bottom:12px; font-size:12px; }
#product-tree details { margin:3px 0; }
#product-tree summary { cursor:pointer; padding:9px 8px; font-weight:700; border-radius:6px; color:#21485b; list-style-position:inside; }
#product-tree .tree-root { border:1px solid #d4e3ea; border-radius:9px; background:#fff; margin:7px 0; }
#product-tree .tree-root > summary { background:#eef6fa; color:#155573; font-size:13px; }
#product-tree summary:hover, #product-tree button:hover { background:#e9f3f9; }
#product-tree .tree-children { padding:3px 4px 7px 11px; border-left:1px solid #e1eaf0; margin-left:9px; }
#product-tree button { display:block; width:100%; text-align:left; border:0; border-radius:5px; padding:8px 9px; margin:2px 0; background:transparent; color:#204b61; font:inherit; cursor:pointer; }
#product-tree button.tree-active { background:#0c77a9; color:#fff; font-weight:700; }
#product-tree .tree-unavailable { display:block; padding:7px 9px; color:#8295a1; }
#product-tree .tree-unavailable small { display:block; font-size:10px; }
#product-tree .tree-selection-label { padding:9px 3px; color:#647f8d; font-size:11px; }

/* Sembunyikan pemilihan produk lama */
.sidebar > h3:first-of-type,
.sidebar > #produk,
.sidebar > label[for="produk"] {
    display: none !important;
}
/* Grafik HTH dinamis */
.hth-chart-section{margin-top:24px;border-top:1px solid #e1e8ec;padding-top:18px}
.hth-chart-section h3{margin:0 0 6px;color:#174a65}
.hth-chart-note{font-size:12px;color:#617784;line-height:1.5;margin:0 0 14px}
.hth-chart-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:14px}
.hth-chart-card{min-width:0;background:#fff;border:1px solid #dce7ec;border-radius:10px;padding:15px}
.hth-chart-card h4{margin:0 0 14px;color:#174a65;font-size:14px}
.hth-donut-wrap{height:360px;position:relative}
.hth-kab-wrap{height:400px;position:relative}
@media(max-width:850px){.hth-chart-grid{grid-template-columns:minmax(0,1fr)}.hth-donut-wrap{height:340px}}

/* Sembunyikan header, navigasi, dan banner utama */
.header,
.navbar,
.hero {
    display: none !important;
}

/* Rapikan jarak WebGIS dari bagian atas */
.webgis-section {
    padding-top: 20px !important;
}