:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --background: #f8fafc;
    --sidebar-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.stats-panel {
    margin-bottom: 32px;
}

.stat-card {
    background: #f1f5f9;
    padding: 16px;
    border-radius: var(--radius);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.progress-bar-container {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin: 12px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.5s ease;
}

.filter-section {
    margin-bottom: 32px;
}

.filter-section h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.marker-list-section {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 24px;
}

.area-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.area-section h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

#area-progress-list {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 8px;
}

#area-progress-list::-webkit-scrollbar {
    width: 4px;
}

#area-progress-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}

.area-stat-card {
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    background: white;
    padding-bottom: 8px;
}

.count-badge {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.marker-item {
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.marker-item:hover {
    background: #f8fafc;
}

.marker-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-pending { background: var(--danger); }
.status-progress { background: var(--warning); }
.status-done { background: var(--success); }

/* Main Content Area */
.main-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.top-nav {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 60px;
    z-index: 999;
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box {
    flex: 1;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    padding: 0 16px;
    max-width: 500px;
}

.search-box input {
    border: none;
    padding: 12px;
    width: 100%;
    outline: none;
    font-family: inherit;
}

#map {
    flex: 1;
    background: #e5e7eb;
}

/* UI Elements */
.icon-btn, .menu-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: white;
    border: none;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}

.fab-group {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
    align-items: flex-end;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.fab-add {
    background: var(--primary);
    color: white;
}

.fab-route {
    background: #f59e0b;
    color: white;
}

.fab-route.active {
    background: #ef4444;
}

/* Tooltip label di samping FAB */
.fab::before {
    content: attr(title);
    position: absolute;
    right: 68px;
    background: rgba(15,23,42,0.85);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.fab:hover::before {
    opacity: 1;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group select, .form-group input, .form-group textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: inherit;
}

.form-group textarea {
    height: 100px;
    resize: none;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.primary-btn {
    flex: 1;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.danger-btn {
    background: #fee2e2;
    color: var(--danger);
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn, .outline-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
}

.secondary-btn { background: var(--primary); color: white; border: none; }
.outline-btn { background: transparent; border: 1px solid var(--border); color: var(--text-main); }

/* Mobile Only Sidebar */
.mobile-only { display: none; }

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .mobile-only { display: block; }
}

/* Custom Marker Styling for Leaflet */
.custom-div-icon {
    background: none;
    border: none;
}

.marker-pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -7px 0 0 -7px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Route drawing polyline dashed animation while in drawing mode */
.leaflet-interactive[stroke-dasharray] {
    animation: dash-move 1s linear infinite;
}

@keyframes dash-move {
    from {
        stroke-dashoffset: 20;
    }
    to {
        stroke-dashoffset: 0;
    }
}
