@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Roboto:wght@400;500&display=swap');

/* =========================================
   LAYOUT UTAMA (3 PANEL)
========================================= */
#mapSection {
    display: none; 
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100vh;
    z-index: 100;
    background: #f4f4f2;
    font-family: 'Segoe UI', Roboto, sans-serif;
    display: flex; 
    flex-direction: row;
}

/* =========================================
   PANEL KIRI (NAVIGASI & DIGITASI)
========================================= */

.panel-left {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #ddd;
    box-shadow: 2px 0 10px rgba(0,0,0,0.04);
    padding: 22px 18px;
    overflow-y: auto;
    display: flex; 
    flex-direction: column;
    flex-shrink: 0;
    box-sizing: border-box;
}

.panel-header {
    display: flex;
    flex-direction: column; /* Mengatur elemen ke bawah */
    align-items: center;    /* Menengahkan secara horizontal */
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.panel-header img {
    width: 65px; /* Ukuran logo Luwu Timur */
    height: auto;
    margin-bottom: 10px;
}

.panel-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #2f3e2d;
    margin: 0;
}

/* Header & Card */
/* Container Kartu Zona */
.zone-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border-left: 6px solid #4a6741; /* Hijau Khas Mangkutana */
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 15px;
}

.zone-card h3 {
    margin: 10px 0;
    color: #333;
    font-size: 1.2em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Gaya untuk teks komoditas */
.zone-card p {
    margin: 8px 0;
    font-size: 14px;
    color: #555;
    display: flex;
    align-items: center;
    font-weight: 500;
}

/* Bullet point khusus Padi Sawah  */
.zone-card p:nth-of-type(1)::before {
    content: "";
    width: 10px;
    height: 10px;
    background-color: #2ecc71; 
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
}

/* Bullet point khusus Kelapa Sawit */
.zone-card p:nth-of-type(2)::before {
    content: "";
    width: 10px;
    height: 10px;
    background-color: #f1c40f; 
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
}

/* Badge Zona 1 */
.badge {
    background: #4a6741;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

/* Container Pencarian Koordinat */
.coord-search {
    background: #fdfdfd;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #2e7d32; /* Hijau Hutan */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.coord-search p.section-title {
    font-weight: 800; /* Bold */
    color: #2e7d32;
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

/* Input Field */
.coord-search input {
    width: 70%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
    font-size: 12px;
    outline: none;
    transition: 0.3s;
}

.coord-search input:focus {
    border-color: #2e7d32;
}

/* Tombol Lacak */
.coord-search .btn-small {
    width: 25%;
    padding: 8px 0;
    background: #4a6741;
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: 0.2s;
}

/* --- LAYER PETA / LEGENDA --- */
/* Section Titles */
.section-title, .digitasi-title {
    font-size: 11px;
    font-weight: 800;
    color: #777;
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.legend-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: bold;
    color: #020202;
    width: 100%; 
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}

/* Penamaan class warna di CSS */
.padi { background-color: #4CAF50; }
.sawit { background-color: #FFD54F; }
.sungai { background-color: #2196F3; }
.batas { background-color: #000000; }

.legend-label {
    font-weight: 500;
    flex-grow: 1; 
    text-align: left; 
}

.legend-item input[type="checkbox"] {
    margin-left: auto; 
    cursor: pointer;
}

/* Perkakas Digitasi Container */
.digitasi-container {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px dashed #ddd;
}

/* Tombol Utama (Gambar Poligon Lahan) */
.btn-main-draw {
    width: 100%;
    background: #4a6741; 
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(74,103,65,0.15);
    /* Menghilangkan icon: Kita pastikan centering teks saja */
    display: block; 
    text-align: center;
}

.btn-main-draw:hover { 
    background: #384e32; 
    transform: translateY(-1px);
}

.btn-main-draw .text-group {
    display: flex;
    flex-direction: column;
    align-items: center; /* Teks jadi rata tengah */
}

.btn-main-draw strong { 
    font-size: 13px; 
    display: block;
    line-height: 1.2;
}

.btn-main-draw span { 
    font-size: 9px; 
    opacity: 0.8; 
    text-transform: uppercase;
}

/* Grid Tools Bawah */
.digitasi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.grid-item {
    border-radius: 8px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all 0.25s ease;
    cursor: pointer;
}

.grid-item:hover {
    background: #e8f5e9;
    border-color: #4a6741;
    transform: translateY(-2px);
}

.grid-item.active {
    background: #4a6741;
    color: white;
    border-color: #4a6741;
    box-shadow: 0 4px 10px rgba(74,103,65,0.25);
}

/* Tombol Kembali */
.back-link {
    display: block;          
    margin-top: 12px;        
    text-decoration: none;
    background: #4a6741;
    color: #eee;
    padding: 12px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    text-align: center;     
    transition: 0.2s;
    border: 1px solid #ddd; 
}

.back-link:hover {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #2e7d32;
}
/* --- PANEL TENGAH: PETA --- */
.panel-center {
    flex: 1;
    position: relative;
    border-right: 1px solid #ddd;
    background: #e5e5e5;
}

#map { height: 100%; width: 100%; }

/* --- PANEL KANAN: FORM & HASIL --- */
.panel-right {
    width: 320px;
    background: white;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    flex-shrink: 0;

    height: 100vh; 
    max-height: 100vh;
    overflow: hidden !important;
}

.form-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.form-header p {
    font-size: 12px;
    color: #888;
    margin-bottom: 20px;
}

.section-subtitle {
    font-size: 14px;
    font-weight: 800;
    color: #4a6741;
    margin: 20px 0 10px 0;
    border-bottom: 2px solid #e8f5e9;
    padding-bottom: 5px;
}

/* Container utama untuk membungkus item navigasi */
.tab-header-container {
    border-bottom: 2px solid #4a6741; /* Garis bawah panjang untuk header */
    margin-bottom: 20px;
    display: flex;
    gap: 10px; /* Jarak antar teks */
    padding-bottom: 5px;
}

/* Mengubah tampilan item agar tidak seperti button lagi */
.tab-item {
    background: none !important;
    border: none !important;
    font-weight: bold;
    color: #4a6741; /* Hijau hutan */
    cursor: pointer;
    padding: 5px 10px;
    font-size: 14px;
    text-transform: uppercase;
    transition: 0.3s;
    position: relative;
}

.tab-item.active {
    color: #2e4d25; 
}

.tab-item.active::after {
    content: "";
    position: absolute;
    bottom: -7px; 
    left: 0;
    width: 100%;
    height: 4px;
    background: #4a6741;
}

.navigation .tab-item-popup {
    width: auto; 
    padding: 8px 15px;
    background: transparent;
    border: 1px solid #4a6741;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #4a6741;
    font-weight: 500;
    transition: .3s ease-in-out;
}

.navigation .tab-item-popup:hover {
    background: #4a6741;
    color: white;
}

/* Pastikan tab yang tidak aktif tersembunyi */
.tab-pane {
    display: none;
}

/* Tampilkan hanya tab yang memiliki class active */
.tab-pane.active {
    display: block;
}

/* Tambahan visual untuk tombol yang aktif */
.tab-item.active {
    border-bottom: 2px solid #4a6741;
    color: #4a6741;
    font-weight: bold;
}

.identitas-lahan-container {
    display: flex;
    flex-direction: column;
    gap: 5px; 
}

.identitas-lahan-container label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
}

.identitas-lahan-container input, 
.identitas-lahan-container select {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    background-color: #ffffff;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.identitas-lahan-container input:focus {
    border-color: #4a6741;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.1);
}

#nomor-lahan, #input-luas {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    border: 1.5px dashed #ccc;
    cursor: not-allowed;
}

.btn-hitung {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background-color: #4a6741;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

/* Hasil Perhitungan */
#hasil-container {
    margin-top: 25px;
    animation: fadeIn 0.4s ease-out;
}

.result-box {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    text-align: center;
}

.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.btn-action {
    flex: 1;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-save { background-color: #4a6741; color: white; }
.btn-save:hover {
    background-color: #384e32;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn-delete {
    background-color: #ffffff;
    color: #c62828;
    border: 1px solid #c62828;
}
.btn-delete:hover {
    background-color: #feebee;
    border-color: #c62828;
    transform: translateY(-2px);
}

/* =========================
   DATA TERSIMPAN
========================= */

/* Container Utama */
#data-list {
    width: 100%;
    margin-top: 10px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden; /* Agar border-radius tabel tidak terpotong */
}

/* Scroll Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Scroll halus di mobile */
}

/* Styling Tabel */
.table-custom {
    width: 100%;
    min-width: 700px; /* Ditambah sedikit agar kolom koordinat tidak sesak */
    border-collapse: collapse;
    font-size: 13px;
    background-color: white;
}

/* Header Tabel */
.table-custom thead {
    background: linear-gradient(135deg, #4a6741 0%, #2d3f27 100%); /* Hijau hutan gradasi */
    color: #ffd700; /* Warna emas agar lebih elegan */
}

.table-custom th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Baris Data */
.table-custom td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    color: #333;
    white-space: nowrap; /* Mencegah teks turun ke bawah */
    vertical-align: middle;
}

/* Hover Effect */
.table-custom tbody tr:hover {
    background-color: #f9fbf8;
    transition: 0.2s ease-in-out;
}

/* Baris Kosong */
.empty-data {
    text-align: center;
    color: #888;
    padding: 30px;
    font-style: italic;
}

/* Styling Tombol Hapus di dalam Tabel */
.btn-delete-data {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: 0.3s;
}

.btn-delete-data:hover {
    background: #a71d2a;
    transform: scale(1.1);
}

/* =========================
   EXPORT LAPORAN
========================= */

.export-container{
    margin-top: 15px;
}

.btn-export-pdf,
.btn-export-excel{
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: 0.2s;
}

.btn-export-pdf{
    background: #c0392b;
    color: white;
}

.btn-export-excel{
    background: #2e7d32;
    color: white;
}

.btn-export-pdf:hover,
.btn-export-excel:hover{
    transform: scale(1.02);
    opacity: 0.9;
}

/* =========================================
   UTILITY & ANIMATIONS
========================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* ==========================================================
   PENGAMAN GLOBAL: MENGHILANGKAN SCROLLBAR PALING UJUNG KANAN
========================================================== */
html, body {
    max-width: 100%;
}

/* Jika mapSection sedang aktif (flex), paksa scrollbar browser paling luar mati total */
body:has(#mapSection[style*="display: flex"]),
body:has(#mapSection:not([style*="display: none"])) {
    overflow: hidden !important;
}

/* Memastikan konten di dalam tab valuasi saja yang memiliki scroll tunggal */
.tabs-content {
    padding: 10px 15px;
    flex: 1;
    
    /* MEMAKSA SCROLL INTERNAL DI DALAM TAB TETAP AKTIF */
    overflow-y: auto !important; 
    max-height: calc(100vh - 120px);
}