/* RESET & FONT */
html, body {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', Arial, sans-serif;
}

/* ================= HEADER ================= */
header {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: #38482f;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ================= NAVBAR ================= */
nav {
    padding: 22px 26px;
    text-align: right;
    font-size: 14px;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

nav ul li {
    display: inline-block;
    margin-left: 20px;
}

nav ul li a {
    text-decoration: none;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
}

nav ul li a.active,
nav ul li a:hover {
    color: #b0c7b6;
}

/* ================= USER INFO ================= */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    margin-left: 10px;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ffffff;
}

.user-details span:first-child {
    font-size: 13px;
    font-weight: bold;
}

.user-details span:last-child {
    font-size: 11px;
    opacity: 0.85;
}

/* ================= MAIN CONTENT ================= */
.main-content {
    width: 100%;
    min-height: calc(100vh - 60px);
    background: url('../images/dashboard.jpg') center center / cover no-repeat;
    padding: 40px 20px;
    box-sizing: border-box;
}

/* ================= WRAPPER ================= */
.clustering-wrapper {
    max-width: 1200px;
    margin: auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);

    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ================= DBI ================= */
.dbi-box {
    background: #f4f7f4;
    border-left: 6px solid #38482f;
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 8px;
}

/* ================= TABLE ================= */
.hitung-clustering {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 900px; /* penting utk multi-tahun */
}

thead {
    background: #38482f;
    color: #ffffff;
}

thead th {
    padding: 12px 10px;
    text-align: center;
    font-weight: bold;
    white-space: nowrap;
}

tbody td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

tbody tr:hover {
    background: #f4f7f4;
}

/* ================= CLUSTER SUMMARY ================= */
.cluster-summary {
    width: 100%;
    background: #f9faf9;
    border-radius: 10px;
    padding: 16px;
}

.cluster-summary h4 {
    margin: 0 0 10px 0;
    color: #38482f;
}

.cluster-summary ul {
    margin: 0;
    padding-left: 18px;
}

.cluster-summary li {
    font-size: 14px;
    margin-bottom: 6px;
}

/* ================= PAGINATION ================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    border: 1px solid #38482f;
    color: #38482f;
    background: #ffffff;
}

.pagination a:hover {
    background: #38482f;
    color: #ffffff;
}

.pagination span.active {
    background: #38482f;
    color: #ffffff;
    font-weight: bold;
    cursor: default;
}

.btn-peta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    margin-top: 15px;
    padding: 10px 16px;

    background-color: #2d6cdf;
    color: #fff;
    text-decoration: none;

    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;

    transition: background 0.2s ease, transform 0.2s ease;
}

.btn-peta i {
    font-size: 16px;
}

.btn-peta:hover {
    background-color: #1f55b5;
    transform: translateY(-2px);
}

.map-action {
    margin-top: 20px;
    text-align: center;
}

.btn-map {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #38482f;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: 0.3s;
}

.btn-map:hover {
    background: #2c3925;
}

#map {
    height: 523px;
    width: 100%;
}

#legend {
    position: absolute;
    bottom: 10px;   /* bawah kiri */
    left: 10px;
    z-index: 1000;  /* pastikan di atas layer kontrol lain tapi tetap peta terlihat */
    background: rgba(255,255,255,0.9);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    max-height: 200px;  /* batasi tinggi legend */
    overflow-y: auto;   /* scroll kalau terlalu banyak */
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    vertical-align: middle;
}

#legend-list {
    list-style: none; /* hilangkan bullet */
    padding: 0;
    margin: 0;
}
#legend-list li {
    margin-bottom: 5px;
}

#legend-container {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    max-width: 250px;
}

#legend-container h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
}



/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    header {
        padding: 14px 16px;
    }

    .user-details {
        display: none;
    }

    nav {
        padding: 0;
        text-align: center;
        font-size: 12px;
    }

    nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    nav ul li {
        margin-left: 0;
    }

    nav ul li a {
        padding: 6px;
        font-size: 12px;
    }

    table {
        font-size: 12px;
        min-width: unset;
    }

    thead th,
    tbody td {
        padding: 6px 4px;
    }
}
