/* Reset dan Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow: hidden;
}

/* App Container */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
    color: #667eea;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
    /* Tombol dipindahkan ke sidebar */
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar h3 i {
    color: #667eea;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-btn {
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-btn:hover {
    background: #5a67d8;
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
    border-radius: 8px;
}

.search-result-item {
    padding: 0.75rem;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateX(4px);
}

.search-result-item:last-child {
    margin-bottom: 0;
}

/* Banner Section */
.banner-section {
    margin-bottom: 1.5rem;
    text-align: center;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.banner-image {
    max-width: 280px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: block;
    margin: 0 auto;
}

.banner-image:hover {
    transform: scale(1.02);
}

/* Help Section */
.help-section {
    margin-top: 1rem;
}

.help-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.help-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    text-decoration: none;
    color: white;
}

.help-btn i {
    font-size: 1.1rem;
}

/* Copyright Section */
.copyright-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.copyright-text {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.9);
    text-align: center;
    font-weight: 400;
}

/* Tools Section */
.tools-section {
    margin-bottom: 2rem;
}

.tool-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tool-btn {
    padding: 1rem;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
}

.tool-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateX(4px);
}

.tool-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Styling khusus untuk tombol hapus semua */
.tool-btn:nth-child(2) {
    background: #fed7d7;
    border-color: #fc8181;
    color: #c53030;
}

.tool-btn:nth-child(2):hover {
    background: #feb2b2;
    border-color: #f56565;
    color: #9b2c2c;
}

/* Styling khusus untuk tombol import */
.tool-btn:nth-child(3) {
    background: #bee3f8;
    border-color: #63b3ed;
    color: #2b6cb0;
}

.tool-btn:nth-child(3):hover {
    background: #90cdf4;
    border-color: #4299e1;
    color: #2c5282;
}

/* Styling khusus untuk tombol download */
.tool-btn:nth-child(4) {
    background: #c6f6d5;
    border-color: #68d391;
    color: #2f855a;
}

.tool-btn:nth-child(4):hover {
    background: #9ae6b4;
    border-color: #48bb78;
    color: #276749;
}

.tool-btn i {
    font-size: 1.1rem;
}

/* Info Section */
.info-section {
    margin-bottom: 2rem;
}

.info-content {
    background: #f7fafc;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

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

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

.info-value {
    font-weight: 600;
    color: #2d3748;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

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

.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #4a5568;
}

.map-control-btn:hover {
    background: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #667eea;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: #48bb78;
}

.toast.error {
    border-left-color: #f56565;
}

.toast.warning {
    border-left-color: #ed8936;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Leaflet Customizations */
.leaflet-control-container .leaflet-top.leaflet-left {
    top: 1rem;
    left: 1rem;
}

/* Atur tata letak kontrol di kiri atas secara vertikal dan berurutan */
.leaflet-control-container .leaflet-top.leaflet-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    top: 1rem;
    left: 1rem;
}

/* Urutan kontrol: 1. Zoom Control */
.leaflet-control-zoom {
    order: 1;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Tambahkan label teks untuk zoom control */
.leaflet-control-zoom::before {
    content: "Zoom Peta";
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #667eea;
    background: rgba(102, 126, 234, 0.2);
    padding: 0.25rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    margin-bottom: 0;
}

.leaflet-control-zoom a {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #4a5568;
    font-weight: 600;
    transition: all 0.3s ease;
    border-top: none;
}

.leaflet-control-zoom a:hover {
    background: white;
    color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.leaflet-control-zoom a:first-of-type {
    border-top: 1px solid rgba(0, 0, 0, 0.15);
}

/* Urutan kontrol: 2. Layer Control (Pemilih Peta) */
.leaflet-control-layers {
    order: 2;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 0;
    transition: all 0.3s ease;
}

.leaflet-control-layers-toggle {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: #4a5568;
    font-weight: 600;
    transition: all 0.3s ease;
}

.leaflet-control-layers-toggle:hover {
    background: white;
    color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

.leaflet-control-layers-expanded {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
}

.leaflet-control-layers-base label {
    color: #4a5568;
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 0.85rem;
}

.leaflet-control-layers-base label:hover {
    color: #667eea;
}

/* Tambahkan label teks untuk kontrol layer */
.leaflet-control-layers::before {
    content: "Pilih Peta:";
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 4px;
    text-align: center;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
}

.leaflet-control-layers-expanded::before {
    content: "Pilih Jenis Peta:";
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 6px;
    text-align: center;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

/* Urutan kontrol: 3. Draw Control (Tools Polygon) */
.leaflet-draw-toolbar {
    order: 3;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Tambahkan label teks untuk draw control */
.leaflet-draw-toolbar::before {
    content: "Kontrol Polygon";
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #667eea;
    background: rgba(102, 126, 234, 0.2);
    padding: 0.25rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    margin-bottom: 0;
}

.leaflet-draw-toolbar a {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #4a5568;
    font-weight: 600;
    transition: all 0.3s ease;
    border-top: none;
    position: relative;
}

.leaflet-draw-toolbar a:hover {
    background: white;
    color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.leaflet-draw-toolbar a:first-of-type {
    border-top: 1px solid rgba(0, 0, 0, 0.15);
}

/* Tooltip untuk setiap tombol draw */
.leaflet-draw-draw-polygon::after {
    content: "Gambar";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(74, 85, 104, 0.95);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    margin-left: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.leaflet-draw-draw-polygon:hover::after {
    opacity: 1;
}

.leaflet-draw-edit-edit::after {
    content: "Edit";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(74, 85, 104, 0.95);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    margin-left: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.leaflet-draw-edit-edit:hover::after {
    opacity: 1;
}

.leaflet-draw-edit-remove::after {
    content: "Hapus";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(74, 85, 104, 0.95);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    margin-left: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.leaflet-draw-edit-remove:hover::after {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .sidebar {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .map-container {
        height: 60vh;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 1rem;
    }
    
    .tool-buttons {
        gap: 0.5rem;
    }
    
    .tool-btn {
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    
    .toast {
        min-width: 250px;
        padding: 0.75rem 1rem;
    }
}