/* ============================================
   GLOBAL RESET & VARIABLES
   ============================================ */
:root {
    --primary:   #2563EB;
    --success:   #16A34A;
    --danger:    #DC2626;
    --warning:   #D97706;
    --bg:        #F8FAFC;
    --card-bg:   #FFFFFF;
    --text:      #1E293B;
    --muted:     #64748B;
    --border:    #E2E8F0;
    --radius:    10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }

/* ---- NAVBAR ---- */
.navbar {
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1.5rem; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-brand { font-size: 1.1rem; font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a { color: white; text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { text-decoration: underline; }
.btn-logout { background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 6px; }

/* ---- CONTAINER ---- */
.container { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem; }
.page-title { font-size: 1.4rem; margin-bottom: 1rem; color: var(--text); }

/* ---- CARD ---- */
.card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.card-active { border-left: 4px solid var(--success); }

/* ---- FORM ---- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9rem; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 0.6rem 0.75rem;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.95rem; transition: border 0.2s;
}
.form-group input:focus, .form-group textarea:focus {
    border-color: var(--primary); outline: none;
}
.form-group small { color: var(--muted); font-size: 0.8rem; }

/* ---- BUTTONS ---- */
.btn {
    padding: 0.6rem 1.2rem; border: none; border-radius: 6px;
    font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: white; }
.btn-success  { background: var(--success); color: white; }
.btn-danger   { background: var(--danger);  color: white; }
.btn-block    { width: 100%; margin-top: 0.75rem; padding: 0.85rem; font-size: 1rem; }

/* ---- ALERTS ---- */
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-info    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.alert-success { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.alert-danger  { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }

/* ---- INFO BOX ---- */
.info-box { background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
            padding: 0.75rem 1rem; margin: 0.75rem 0; }
.info-box p { font-size: 0.9rem; margin-bottom: 4px; }

/* ---- TABLE ---- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { background: var(--primary); color: white; padding: 0.6rem 0.75rem; text-align: left; }
.table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: #F1F5F9; }
.row-anomali td { background: #FEF2F2 !important; }

/* ---- BADGE ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.badge-success { background: #DCFCE7; color: #15803D; }
.badge-danger  { background: #FEE2E2; color: #B91C1C; }
.badge-warning { background: #FEF3C7; color: #92400E; }

/* ---- LOGIN PAGE ---- */
.login-wrapper { min-height: 85vh; display: flex; align-items: center; justify-content: center; }
.login-card {
    background: white; padding: 2rem; border-radius: var(--radius);
    width: 100%; max-width: 400px; box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.login-card h2 { margin-bottom: 0.25rem; }
.login-card .subtitle { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ---- UTILS ---- */
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filter-form  { display: flex; gap: 0.5rem; align-items: center; }
.text-center  { text-align: center; color: var(--muted); padding: 1.5rem 0; }

footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: 0.85rem; }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
    .navbar { flex-direction: column; gap: 0.5rem; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .table { font-size: 0.8rem; }
}

/* ---- LEAFLET OVERRIDE ---- */
.leaflet-container { font-family: 'Segoe UI', sans-serif; border-radius: var(--radius); }
.leaflet-popup-content { font-size: 0.88rem; line-height: 1.5; }

/* ---- SEARCH ALAMAT (pengganti Google Autocomplete) ---- */
.search-wrapper { position: relative; }
.search-hasil {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 9999;
    background: white; border: 1px solid var(--border);
    border-radius: 0 0 8px 8px; max-height: 220px;
    overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,.12);
    display: none;
}
.search-item {
    padding: .6rem .85rem; font-size: .88rem; cursor: pointer;
    border-bottom: 1px solid var(--border); line-height: 1.4;
}
.search-item:hover { background: #f1f5f9; }
.search-item:last-child { border-bottom: none; }
.search-item-loading { padding: .6rem .85rem; font-size: .88rem; color: var(--muted); }