* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 12px;
}

.header {
    background: linear-gradient(135deg, #1a472a, #2d6a4f);
    color: white;
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    flex-shrink: 0;
}

.header h1 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.header h1 i {
    font-size: 18px;
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.btn-primary {
    background: #ffd700;
    color: #1a472a;
}

.btn-primary:hover {
    background: #ffed4a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.btn-success {
    background: #52b788;
    color: white;
}

.btn-success:hover {
    background: #409f6f;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e63946;
    color: white;
}

.btn-danger:hover {
    background: #c62828;
    transform: translateY(-2px);
}

.btn-info {
    background: #4a9eff;
    color: white;
}

.btn-info:hover {
    background: #3182e0;
    transform: translateY(-2px);
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #d68910;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.drop-zone {
    border: 2px dashed #52b788;
    border-radius: 8px;
    padding: 12px 20px;
    text-align: center;
    background: rgba(82, 183, 136, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    margin: 6px 14px;
    flex-shrink: 0;
}

.drop-zone.dragover {
    background: rgba(82, 183, 136, 0.15);
    border-color: #ffd700;
    transform: scale(1.01);
}

.drop-zone.hidden {
    display: none;
}

.drop-zone i {
    font-size: 24px;
    color: #52b788;
    margin-bottom: 4px;
}

.drop-zone h3 {
    color: #1a472a;
    font-size: 13px;
    margin-bottom: 2px;
    margin: 0;
}

.drop-zone p {
    color: #666;
    font-size: 11px;
    margin: 0;
}

.search-container {
    padding: 6px 14px;
    background: white;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.search-container input {
    flex: 1;
    min-width: 150px;
    padding: 5px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 11px;
    transition: all 0.3s ease;
}

.search-container input:focus {
    border-color: #52b788;
    outline: none;
    box-shadow: 0 0 0 2px rgba(82, 183, 136, 0.1);
}

.search-container .search-filters {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.search-container select {
    padding: 5px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 11px;
    background: white;
    cursor: pointer;
}

.search-container select:focus {
    border-color: #52b788;
    outline: none;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.map-container {
    flex: 1;
    position: relative;
    background: #e8edf3;
}

#map {
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 40%;
    min-width: 320px;
    max-width: 70%;
    background: white;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease, max-width 0.3s ease;
}

.sidebar.hidden {
    width: 0;
    min-width: 0;
    max-width: 0;
    border-left: none;
}

.sidebar.maximized {
    width: 70% !important;
    max-width: 90% !important;
}

.sidebar-header {
    padding: 6px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 12px;
    color: #1a472a;
    margin: 0;
}

.sidebar-header .badge {
    background: #52b788;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
}

.sidebar-content {
    flex: 1;
    overflow: hidden;
    padding: 2px 4px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sidebar-content .dataTables_wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    width: 100%;
}

.sidebar-content .dataTables_scroll {
    flex: 1;
}

.sidebar-content table {
    font-size: 10px;
    width: 100% !important;
    table-layout: fixed;
}

.sidebar-content::-webkit-scrollbar,
.dataTables_scrollBody::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.sidebar-content::-webkit-scrollbar-track,
.dataTables_scrollBody::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 5px;
}

.sidebar-content::-webkit-scrollbar-thumb,
.dataTables_scrollBody::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1a472a, #2d6a4f);
    border-radius: 5px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover,
.dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2d6a4f, #1a472a);
}

.sidebar-content .dataTables_wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
}

.sidebar-content .dataTables_scroll {
    flex: 1;
}

.sidebar-content .dataTables_scrollHead {
    background: white;
}

.sidebar-content .dataTables_wrapper .dataTables_filter {
    display: none;
}

.sidebar-content .dataTables_wrapper .dataTables_length {
    display: none;
}

.sidebar-content table {
    font-size: 10px;
    width: 100% !important;
}

.sidebar-content table thead th {
    background: #f8f9fa;
    color: #1a472a;
    font-weight: 600;
    padding: 4px 6px;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-content table tbody td {
    padding: 3px 6px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.sidebar-content table tbody tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

.sidebar-content table tbody tr:hover {
    background: #f0f7f3;
}

.sidebar-content table tbody tr.active-row {
    background: #fffef5;
    border-left: 2px solid #ffd700;
}

.sidebar-content .dataTables_info {
    font-size: 10px;
    color: #666;
    padding-top: 6px;
}

.sidebar-content .dataTables_paginate {
    padding-top: 6px;
}

.sidebar-content .dataTables_paginate .paginate_button {
    padding: 2px 6px;
    margin: 0 1px;
    border-radius: 3px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 10px;
}

.sidebar-content .dataTables_paginate .paginate_button.current {
    background: #52b788;
    color: white;
    border-color: #52b788;
}

.sidebar-content .dataTables_paginate .paginate_button:hover {
    background: #e8f5e9;
}

.status-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
}

.status-selesai {
    background: #d4edda;
    color: #155724;
}

.status-belum {
    background: #f8d7da;
    color: #721c24;
}

.map-legend {
    position: absolute;
    bottom: 20px;
    left: 8px;
    background: rgba(255,255,255,0.95);
    padding: 6px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    font-size: 10px;
    z-index: 1000;
    min-width: 100px;
}

.map-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0;
}

.map-legend .color-box {
    width: 16px;
    height: 3px;
    border-radius: 1px;
}

.polygon-label {
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    text-shadow: 
        -1px -1px 0 #000,  
         1px -1px 0 #000,
        -1px 1px 0 #000,
         1px 1px 0 #000,
        -2px -2px 0 #000,
         2px -2px 0 #000,
        -2px 2px 0 #000,
         2px 2px 0 #000;
    -webkit-text-stroke: 0.5px #000000;
    white-space: nowrap;
    text-align: center;
    line-height: 1.2;
}

.info-popup {
    padding: 5px;
    max-width: 300px;
}

.info-popup strong {
    color: #1a472a;
}

.info-popup .popup-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 12px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    flex-direction: column;
    gap: 15px;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #52b788;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1a472a;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s ease;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 45%;
        min-width: 320px;
        max-width: 55%;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        max-height: 45vh;
        border-left: none;
        border-top: 1px solid #ddd;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    .drop-zone {
        padding: 15px;
        margin: 5px 10px;
    }
    
    .search-container {
        padding: 5px 10px;
    }
    
    .search-container input {
        min-width: 120px;
        font-size: 12px;
    }
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.dataTables_wrapper .dataTables_scroll {
    clear: both;
}

.dataTables_wrapper .dataTables_scrollBody {
    max-height: calc(100vh - 200px) !important;
    height: calc(100vh - 200px) !important;
}

.export-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
    z-index: 9998;
    text-align: center;
    display: none;
}

.export-progress.show {
    display: block;
}

.export-progress .progress-bar {
    width: 300px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin: 15px auto;
    overflow: hidden;
}

.export-progress .progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #52b788, #2d6a4f);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
}

.floating-db-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #1a472a, #2d6a4f);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9997;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.floating-db-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0,0,0,0.4);
}

.floating-db-btn.show {
    display: flex;
}

.sidebar-content table {
    font-size: 13px;
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

.sidebar-content table thead th {
    background: linear-gradient(135deg, #1a472a, #2d6a4f);
    color: white;
    font-weight: 600;
    padding: 8px 8px;
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 10;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.3px;
}

.sidebar-content table thead th:first-child {
    border-top-left-radius: 8px;
}

.sidebar-content table thead th:last-child {
    border-top-right-radius: 8px;
}

.sidebar-content table tbody td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0f0f0;
    background: white;
    transition: background 0.2s ease;
}

.sidebar-content table tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-content table tbody tr:hover td {
    background: #f0f7f3;
}

.sidebar-content table tbody tr.active-row td {
    background: #fffde7;
    border-left: 3px solid #ffd700;
}

@media (max-width: 768px) {
    .header {
        padding: 10px;
        flex-direction: column;
        gap: 10px;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        z-index: 999;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show-mobile {
        transform: translateX(0);
    }
    
    .sidebar.hidden {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        transform: translateX(100%);
    }
    
    .floating-db-btn {
        display: flex;
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}
