* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}

/* ===== FLOATING PILL SEARCH ===== */
.pill-collapsed {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 999px;
    padding: 8px 14px 8px 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.14);
    cursor: pointer;
    transition: box-shadow 0.2s, background 0.2s;
    user-select: none;
    min-width: 220px;
    max-width: 340px;
}

.pill-collapsed:hover {
    box-shadow: 0 6px 28px rgba(0,0,0,0.2);
    background: rgba(255,255,255,0.98);
}

.pill-icon {
    width: 15px;
    height: 15px;
    color: #888;
    flex-shrink: 0;
}

.pill-label {
    font-size: 13px;
    color: #aaa;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pill-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.pill-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    color: white;
    line-height: 1.4;
}

.badge-online  { background: #28a745; }
.badge-offline { background: #fd7e14; }
.badge-nonaktif { background: #dc3545; }

/* ===== SEARCH PANEL (expanded) ===== */
.search-panel {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 11;
    width: 360px;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: 1px solid rgba(0,0,0,0.07);
    overflow: hidden;
    display: none;
    flex-direction: column;
    animation: panelSlideIn 0.18s ease;
}

.search-panel.open {
    display: flex;
}

@keyframes panelSlideIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.sp-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
}

.sp-search-icon {
    width: 16px;
    height: 16px;
    color: #999;
    flex-shrink: 0;
}

.sp-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: #222;
    outline: none;
    min-width: 0;
}

.sp-input::placeholder { color: #bbb; }

.sp-clear {
    background: none;
    border: none;
    font-size: 18px;
    color: #bbb;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}

.sp-clear:hover { color: #dc3545; }

.sp-filters {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    border-bottom: 1px solid #f0f0f0;
}

.sp-filter {
    flex: 1;
    padding: 5px 4px;
    font-size: 11px;
    font-weight: 600;
    border: 1.5px solid #e8e8e8;
    border-radius: 999px;
    background: white;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    color: #666;
    white-space: nowrap;
}

.sp-filter:hover { border-color: #bbb; color: #333; }

.sp-filter.active-all     { background: #0077ff; color: white; border-color: #0077ff; }
.sp-filter.active-online  { background: #28a745; color: white; border-color: #28a745; }
.sp-filter.active-offline { background: #fd7e14; color: white; border-color: #fd7e14; }
.sp-filter.active-nonaktif{ background: #dc3545; color: white; border-color: #dc3545; }

.sp-results {
    max-height: 240px;
    overflow-y: auto;
    display: none;
}

.sp-results.show { display: block; }

/* ===== SEARCH RESULTS ITEMS ===== */
.search-results,
.search-item {
    /* dipakai juga di Swal ODP search, jangan dihapus */
}

.search-item {
    padding: 9px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    color: #333;
    transition: background 0.12s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f0f7ff; }

.search-item strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #111;
}

.search-item span {
    font-size: 11px;
    color: #999;
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 520px) {
    .pill-collapsed,
    .search-panel {
        left: 16px;
        right: 16px;
        transform: none;
        width: auto;
        max-width: none;
    }

    @keyframes panelSlideIn {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* ===== BADGE ===== */
.badge {
    padding: 2px 8px;
    border-radius: 20px;
    color: white;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.bg-green {
    background-color: #28a745;
}

.bg-red {
    background-color: #dc3545;
}

.bg-orange {
    background-color: #fd7e14;
}

/* ===== POPUP ===== */
.maplibregl-popup-content {
    padding: 0;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 1px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    min-width: 240px;
    max-width: 280px;
    font-family: 'Segoe UI', sans-serif;
}

.maplibregl-popup-tip { display: none; }

.maplibregl-popup-close-button {
    font-size: 16px;
    color: rgba(255,255,255,0.7);
    right: 8px;
    top: 6px;
    background: none;
    line-height: 1;
}

.maplibregl-popup-close-button:hover {
    color: white;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.pu-header {
    padding: 14px 16px 12px;
    color: white;
    position: relative;
}

.pu-header.online  { background: linear-gradient(135deg, #1a7f37 0%, #2da44e 100%); }
.pu-header.offline { background: linear-gradient(135deg, #444 0%, #666 100%); }

.pu-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.pu-name {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.pu-status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.4px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 1px;
}

.pu-status-badge.online   { background: rgba(255,255,255,0.25); color: #fff; }
.pu-status-badge.offline  { background: rgba(255,255,255,0.18); color: #fff; }
.pu-status-badge.nonaktif { background: rgba(220,53,69,0.8);    color: #fff; }

.pu-uptime {
    font-size: 11px;
    opacity: 0.75;
    margin-top: 4px;
}

.pu-body {
    padding: 10px 14px 8px;
    background: #fff;
}

.pu-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pu-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #f3f3f3;
    font-size: 12.5px;
}

.pu-row:last-child { border-bottom: none; }

.pu-row-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #aaa;
}

.pu-row-label {
    color: #aaa;
    font-size: 11px;
    min-width: 42px;
    flex-shrink: 0;
}

.pu-row-value {
    color: #222;
    font-weight: 500;
    font-size: 12.5px;
    word-break: break-all;
}

.pu-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.pu-btn {
    flex: 1;
    padding: 7px 4px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: opacity 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.pu-btn:hover  { opacity: 0.88; }
.pu-btn:active { transform: scale(0.97); }

.pu-btn-edit   { background: #f0fdf4; color: #1a7f37; border: 1.5px solid #bbf7d0; }
.pu-btn-remote { background: #eff6ff; color: #1d4ed8; border: 1.5px solid #bfdbfe; }

.pu-address {
    font-size: 11px;
    color: #bbb;
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px dashed #eee;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

/* popup topologi */
.pu-topo-header {
    padding: 12px 14px;
    background: linear-gradient(135deg, #334155, #475569);
    color: white;
}

.pu-topo-name {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.pu-topo-sub {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 3px;
}

/* ===== CONTEXT MENU ===== */
.context-menu {
    position: absolute;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 5px 0;
    min-width: 150px;
    display: none;
    border: 1px solid rgba(0,0,0,0.1);
}

.context-menu-item {
    padding: 10px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
    font-weight: 500;
}

.context-menu-item:hover {
    background: #0077ff;
    color: white;
}

/* ===== BUTTONS (dipakai di popup) ===== */
.btn-primary {
    background: #0077ff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #0062d1;
}

.btn-secondary {
    background: #e9ecef;
    color: #495057;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #dee2e6;
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 520px) {
    .search-container {
        width: calc(100% - 32px);
        top: 12px;
        left: 16px;
    }
}
