body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.leaflet-control-zoom {
    position: absolute !important;
    bottom: 20px !important;
    left: 20px !important;
    z-index: 1000 !important;
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

.leaflet-control-zoom a {
    background: white !important;
    color: #007bff !important;
    border: 1px solid #e0e0e0 !important;
    transition: background 0.3s ease, color 0.3s ease;
}

.leaflet-control-zoom a:hover {
    background: #007bff !important;
    color: white !important;
}

.leaflet-control-zoom:not(.leaflet-control-zoom-bottom-left),
.leaflet-control-zoom.leaflet-control-zoom-top-right,
.leaflet-control-zoom.leaflet-control-zoom-top-left,
.leaflet-control-zoom.leaflet-control-zoom-bottom-right {
    display: none !important;
}

.leaflet-control-scale {
    position: absolute !important;
    bottom: 20px !important;
    left: 80px !important;
    background: rgba(255,255,255,0.8) !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    padding: 2px 4px !important;
}

.leaflet-control-attribution {
    display: none !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 10px 36px 10px 14px;
    padding: 0;
    min-width: 120px;
    max-width: 280px;
    line-height: 1.4;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: #1f2937;
}

.leaflet-popup-content h4 {
    margin: 0 0 8px 0;
    color: #1d4ed8;
    font-weight: 600;
    font-size: 15px;
}

.leaflet-popup-content div {
    margin: 6px 0;
    font-size: 13px;
    color: #374151;
}

.leaflet-popup-content strong {
    color: #374151;
    font-weight: 600;
}

.leaflet-popup-close-button {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    top: 6px !important;
    right: 6px !important;
    font-size: 20px !important;
    line-height: 28px !important;
    color: #6b7280 !important;
    text-decoration: none !important;
    text-align: center;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    transition: background 0.2s, color 0.2s;
}

.leaflet-popup-close-button:hover {
    color: #1f2937 !important;
    background: rgba(0, 0, 0, 0.1);
}

.loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    text-align: center;
}

.loading-pulse {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #007bff;
    animation: pulse 1.4s ease-in-out infinite both;
}

.pulse-dot:nth-child(1) { animation-delay: -0.32s; }
.pulse-dot:nth-child(2) { animation-delay: -0.16s; }
.pulse-dot:nth-child(3) { animation-delay: 0s; }

@keyframes pulse {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
    .leaflet-control-zoom, .leaflet-control-scale { bottom: 15px !important; }
    .leaflet-control-zoom { left: 15px !important; }
    .leaflet-control-scale { left: 70px !important; }
    .map-controls { top: 20px; left: 80px; }
    .user-info { top: 20px; left: 204px; }
    .search-box { width: 344px; }
}

@media (max-width: 480px) {
    .leaflet-control-zoom, .leaflet-control-scale { bottom: 10px !important; }
    .leaflet-control-zoom { left: 10px !important; }
    .leaflet-control-scale { left: 60px !important; }
    .map-controls { top: 18px; left: 74px; }
    .user-info { top: 18px; left: 198px; }
    .search-box {
        width: calc(100% - 20px);
        right: 10px;
    }
    .search-toolbar {
        gap: 6px;
    }
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 20px;
    left: 84px;
    z-index: 1000;
}

.map-controls .btn-group-horizontal {
    display: flex;
    gap: 12px;
}

.map-controls .btn {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: linear-gradient(165deg, rgba(255,255,255,0.96), rgba(248,250,252,0.94));
    color: #334155;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.08);
    transition: all 0.24s ease;
}

.map-controls .btn i {
    font-size: 20px;
    line-height: 1;
    width: 1em;
    text-align: center;
}

.map-controls .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18), 0 6px 14px rgba(15, 23, 42, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
    background: #fff;
}

.map-controls .btn.active {
    transform: none;
    border-color: #2563eb;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.42), 0 6px 14px rgba(37, 99, 235, 0.26);
}

.map-controls .btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5), 0 6px 16px rgba(59, 130, 246, 0.3);
}

.map-controls .btn:not(.active) {
    opacity: 0.9;
}

.map-controls .btn:not(.active):hover {
    opacity: 1;
}

.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    color: #111827;
    min-width: 160px;
}

.map-legend .legend-title {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 13px;
}

.map-legend .legend-section {
    margin-bottom: 8px;
}

.map-legend .legend-section:last-child {
    margin-bottom: 0;
}

.legend-batas {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.layer-toggle-item {
    display: flex;
    align-items: center;
}

.layer-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.layer-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #2563eb;
}

.layer-label {
    color: #334155;
}

.loading-pulse {
    justify-content: center;
}

.loading-pulse .pulse-dot {
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

@keyframes pulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Home Button */
.home-button {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 52px;
    height: 52px;
    background: linear-gradient(165deg, rgba(255,255,255,0.96), rgba(248,250,252,0.94));
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 15px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #334155;
    transition: all 0.24s ease;
    cursor: pointer;
}

.home-button:hover {
    background: #fff;
    transform: translateY(-2px);
    color: #2563eb;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18), 0 6px 14px rgba(15, 23, 42, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
}

.home-button i {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.home-button:hover i {
    transform: scale(1.1);
}

/* Search Box */
.search-box {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 372px;
}

.search-container {
    position: relative;
}

.search-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    background: linear-gradient(165deg, rgba(255,255,255,0.96), rgba(248,250,252,0.94));
    border-radius: 28px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.search-input-wrapper:focus-within {
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.18), 0 6px 14px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.search-icon {
    position: absolute;
    left: 18px;
    color: #6b7280;
    font-size: 15px;
    z-index: 2;
    transition: color 0.3s ease;
}

.search-input-wrapper:focus-within .search-icon {
    color: #3b82f6;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 16px 50px 16px 48px;
    font-size: 15px;
    color: #1f2937;
    outline: none;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    letter-spacing: 0.025em;
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(156, 163, 175, 0.1);
    border: none;
    color: #6b7280;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.clear-search-btn:hover {
    background: rgba(156, 163, 175, 0.2);
    color: #374151;
    transform: scale(1.1);
}

.search-input:not(:placeholder-shown) + .clear-search-btn {
    opacity: 1;
    visibility: visible;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(165deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
    border-radius: 20px;
    box-shadow: 0 22px 52px rgba(15, 23, 42, 0.16), 0 10px 24px rgba(15, 23, 42, 0.1);
    margin-top: 12px;
    max-height: 320px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s ease;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.search-results.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-result-item {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.search-result-item:hover {
    background: rgba(59, 130, 246, 0.04);
    transform: translateX(4px);
}

.search-result-item .result-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.search-result-item .result-icon.result-icon-muted {
    background: #6c757d !important;
}

.search-result-item:hover .result-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.search-result-item .result-content {
    flex: 1;
}

.search-result-item .result-nop {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
    margin-bottom: 4px;
    letter-spacing: 0.025em;
}

.search-result-item .result-nama {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 3px;
}

.search-result-item .result-coords {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 3px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.search-result-item .result-coords.result-coords-error {
    color: #dc3545 !important;
}

.search-result-item .result-luas {
    font-size: 12px;
    color: #059669;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.search-result-item.no-coordinates {
    opacity: 0.8;
    cursor: not-allowed;
}

.search-result-item.no-coordinates:hover {
    background: rgba(239, 68, 68, 0.04);
    transform: translateX(2px);
}

.search-result-item.no-coordinates .result-icon {
    background: linear-gradient(135deg, #6b7280, #4b5563) !important;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.search-result-item.no-coordinates .result-coords {
    color: #dc2626 !important;
    font-weight: 500;
}

.search-result-item.no-coordinates:hover .result-icon {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(107, 114, 128, 0.4);
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.search-loading {
    padding: 20px;
    text-align: center;
    color: #007bff;
}

.search-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Login Modal */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.22), rgba(3, 7, 18, 0.72));
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-modal.show {
    display: flex;
}

.login-modal-content {
    position: relative;
    background: linear-gradient(160deg, rgba(255,255,255,0.97), rgba(248,250,252,0.93));
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.55);
    padding: 28px 26px;
    width: 90%;
    max-width: 430px;
    box-shadow: 0 28px 72px rgba(15, 23, 42, 0.3), 0 10px 24px rgba(15, 23, 42, 0.14);
    animation: slideDown 0.26s ease-out;
}

.login-modal-content::before {
    content: '';
    position: absolute;
    top: -90px;
    right: -90px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0));
    pointer-events: none;
}

.login-modal-content::after {
    content: '';
    position: absolute;
    left: -70px;
    bottom: -70px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0));
    pointer-events: none;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-modal-header {
    margin-bottom: 18px;
    text-align: center;
}

.login-brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 10px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.32);
}

.login-modal-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 29px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.login-form-group {
    margin-bottom: 20px;
}

.login-form-group label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-weight: 600;
    font-size: 13px;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap i {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 14px;
    transition: color 0.2s ease;
}

.login-form-group input {
    width: 100%;
    padding: 13px 14px 13px 40px;
    border: 1px solid #cbd5e1;
    background: rgba(255,255,255,0.92);
    border-radius: 12px;
    font-size: 15px;
    color: #0f172a;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.login-form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
    background: #fff;
}

.login-input-wrap:focus-within i {
    color: #2563eb;
}

.login-btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.login-btn {
    flex: 1;
    min-height: 44px;
    padding: 10px 16px;
    border: none;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.34);
}

.login-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.4);
}

.login-btn-secondary {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #334155;
    border: 1px solid #dbe3ee;
}

.login-btn-secondary:hover {
    background: #e2e8f0;
}

.login-error {
    color: #b91c1c;
    font-size: 13px;
    font-weight: 500;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 9px;
    background: rgba(254, 226, 226, 0.85);
    display: none;
}

.login-error.show {
    display: block;
}

@media (max-width: 480px) {
    .login-modal-content {
        padding: 24px 18px;
        border-radius: 20px;
    }

    .login-brand-icon {
        width: 56px;
        height: 56px;
        font-size: 22px;
        border-radius: 16px;
    }

    .login-modal-header h3 {
        font-size: 24px;
    }
}

/* Edit Panel */
.edit-panel {
    position: absolute;
    bottom: 100px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 24px;
    width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: none;
}

.edit-panel.show {
    display: block;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.edit-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.edit-panel-header h4 {
    margin: 0;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

.edit-panel-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.edit-panel-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.edit-form-group {
    margin-bottom: 16px;
}

.edit-form-group label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-weight: 500;
    font-size: 13px;
}

.edit-form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.edit-form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.edit-form-group input:disabled {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

.edit-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    margin-top: 8px;
}

.edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.edit-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

/* User Info - di sebelah kanan tombol mode peta (jalan + satelit), satu baris */
.user-info {
    position: absolute;
    top: 20px;
    left: 212px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 12px 20px;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-info.show {
    display: flex;
}

.user-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.user-logout-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-logout-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
    border-left: 4px solid #3b82f6;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

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

.toast-notification.success {
    border-left-color: #10b981;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-notification.success .toast-icon {
    color: #10b981;
}

.toast-notification.error .toast-icon {
    color: #ef4444;
}

.toast-message {
    flex: 1;
    color: #1f2937;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.leaflet-marker-icon.marker-active {
    filter: hue-rotate(-170deg) saturate(1.15) brightness(1.05);
}
