/* --- RESET & GLOBAL STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

/* --- HEADER SECTION --- */
.header {
    background: #1a365d;
    color: white;
    padding: 25px 40px;
    border-bottom: 4px solid #2d6a4f;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 2.5rem;
    color: #ffffff;
}

.header-text h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 600;
    color: white;
}

.header-text p {
    font-size: 1rem;
    opacity: 0.9;
    color: #e2e8f0;
}

.institution-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* --- NAVIGATION MENU (FIXED RATA KIRI) --- */
.main-nav {
    background-color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    border-bottom: 3px solid #2E8B57;

    /* HAPUS padding dari wrapper luar agar tidak dobel hitungan */
    padding: 0;
}

.nav-container {
    width: 100%;
    /* Pastikan memenuhi lebar container induk */
    display: flex;
    justify-content: flex-start;
    /* Pastikan item mulai dari kiri */
    align-items: center;
    gap: 10px;

    /* PENYESUAIAN KUNCI AGAR LURUS HEADER: */
    /* Header padding 40px. Tombol padding 20px. */
    /* Maka Container ini cukup 20px saja (40-20=20) agar TEKS sejajar */
    padding-left: 20px;

    /* Padding kanan tetap disamakan atau secukupnya */
    padding-right: 40px;
}

.nav-item {
    text-decoration: none;
    color: #4a5568;

    /* Padding tombol tetap */
    padding: 15px 20px;

    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-item:hover,
.nav-item.active {
    color: #2E8B57;
    border-bottom-color: #2E8B57;
    background-color: #f0fdf4;
}

/* --- CONTROL PANEL --- */
.control-panel {
    background: #f8fafc;
    padding: 22px 40px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.panel-title {
    font-weight: 600;
    color: #1a365d;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    /* Dorong elemen lain ke kanan jika ada ruang */
}

.date-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-input label {
    font-weight: 500;
    color: #4a5568;
}

.date-input input {
    padding: 10px 15px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.95rem;
    width: 200px;
    transition: border-color 0.3s;
}

.date-input input:focus {
    outline: none;
    border-color: #2d6a4f;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

/* Buttons */
.btn {
    padding: 10px 22px;
    background: #2d6a4f;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: #1e4c3a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #4a5568;
}

.btn-secondary:hover {
    background: #2d3748;
}

/* Search Box */
.location-search {
    display: flex;
    gap: 10px;
    align-items: center;
}

.location-search input {
    padding: 9px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 140px;
}

.location-search input:focus {
    outline: none;
    border-color: #2d6a4f;
}

/* Loading Spinner */
.loading {
    display: none;
    padding: 10px 20px;
    background: #718096;
    color: white;
    border-radius: 6px;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- MAIN CONTENT & LAYOUT --- */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px 40px;
}

.content-section {
    margin-bottom: 25px;
}

.section-title {
    color: #1a365d;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

/* Maps & Charts */
.map-container,
.chart-container {
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.chart-container {
    padding: 20px;
    text-align: center;
}

.chart-container img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.stat-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.stat-card h3 {
    color: #2d6a4f;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f8fafc;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #4a5568;
}

.stat-value {
    font-weight: 600;
    color: #1a365d;
}

/* Legend */
.color-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-box {
    width: 20px;
    height: 20px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Badge Zone (Merged) */
.badge-zone {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9em;
    color: #fff;
    display: inline-block;
    margin-top: 5px;
}

/* --- INFO & MESSAGES --- */
.error {
    background: #fed7d7;
    color: #9b2c2c;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 40px 0 40px;
    border: 1px solid #fc8181;
    display: none;
}

.location-result {
    background: #edf2f7;
    border-radius: 6px;
    padding: 18px;
    margin: 20px 40px 0 40px;
    border: 1px solid #cbd5e0;
    display: none;
}

.info-section {
    background: #f0fff4;
    border-radius: 8px;
    padding: 25px;
    margin-top: 20px;
    border: 1px solid #c6f6d5;
}

.info-section h2 {
    color: #2d6a4f;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.note-box {
    margin-top: 30px;
    padding: 20px;
    background: #E8F5E9;
    border-radius: 8px;
    border-left: 5px solid #2E7D32;
}

.note-box strong {
    color: #1B5E20;
}

.note-box ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.note-box li {
    margin-bottom: 8px;
    color: #333;
}

/* Criteria Cards */
.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.criteria-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.03);
}

.criteria-card h4 {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1a365d;
}

.criteria-card p {
    margin-bottom: 8px;
    color: #4a5568;
}

.criteria-1 {
    border-left: 4px solid #008000;
}

/* Hijau Tua */
.criteria-2 {
    border-left: 4px solid #90EE90;
}

/* Hijau Muda */
.criteria-3 {
    border-left: 4px solid #FFFF00;
}

/* Kuning */
.criteria-4 {
    border-left: 4px solid #FFA500;
}

/* Jingga */

/* --- FOOTER (VERSI RATA TENGAH) --- */
.footer {
    background: #1a365d;
    color: #cbd5e0;
    padding: 30px 20px; /* Padding atas-bawah diperbesar sedikit agar lega */
    font-size: 0.9rem;
    border-top: 1px solid #2d3748;
}

.footer-content {
    /* Gunakan Flexbox Kolom untuk menumpuk ke bawah */
    display: flex;
    flex-direction: column; 
    
    /* KUNCI RATA TENGAH: */
    align-items: center;      /* Pusatkan item secara horizontal */
    justify-content: center;  /* Pusatkan item secara vertikal (jika ada tinggi fix) */
    text-align: center;       /* Pastikan teks di dalam paragraf juga rata tengah */
    
    width: 100%;              /* Paksa lebar penuh */
    gap: 8px;                 /* Jarak antar baris */
}

/* Style untuk Link di dalam Footer */
.footer a {
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

/* Reset margin paragraf agar rapi */
.footer p {
    margin: 0;
    line-height: 1.6;
    max-width: 800px; /* Opsional: Agar teks tidak terlalu melebar di layar besar */
}

/* Menargetkan semua paragraf di dalam footer-content */
.footer-content p {
    margin-top: 0;      /* Hapus jarak atas */
    margin-bottom: 4px; /* Beri jarak bawah sedikit saja supaya tidak nempel banget */
    line-height: 0.5;   /* Rapatkan jarak antar baris jika teksnya panjang */
}


/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .institution-badge {
        align-self: flex-start;
    }
}

@media (max-width: 768px) {

    /* Responsive Menu - Scrollable Horizontal */
    .nav-container {
        padding: 0 20px;
        overflow-x: auto;
        /* Scroll jika layar sempit */
        -webkit-overflow-scrolling: touch;
    }

    .control-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
    }

    .date-input,
    .location-search {
        width: 100%;
    }

    .date-input input,
    .location-search input {
        width: 100%;
    }

    .header-text h1 {
        font-size: 1.5rem;
    }

    .main-content {
        padding: 20px;
    }



    .error,
    .location-result {
        margin: 20px 20px 0 20px;
    }
}