/* JarKe — tema mengikuti RTP / POCARI (Coverage Home Labs / Sisemoet) */
:root {
  --color-primary: #111111;
  --color-primary-hover: #333333;
  --color-text-body: #374151;
  --color-text-muted: #6B7280;
  --color-bg-page: #F4F7FA;
  --color-surface-card: rgba(0,0,0,0.06);
  --color-surface-card-hover: rgba(0,0,0,0.12);
  --color-surface-white: #FFFFFF;
  --color-accent: #28a745;
  --color-danger: #d50000;
  --color-warn: #e65100;
  --color-border: rgba(0,0,0,0.12);
  --color-border-input: #d1d5db;
  --color-parent: #1A3A6B;
  --color-child: #8B1A1A;
  --font-display: "Outfit", sans-serif;
  --font-body: "DM Sans", "Segoe UI", sans-serif;
  --radius-input: 8px;
  --radius-card: 12px;
  --col-w: 300px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font-body); background: var(--color-bg-page); color: var(--color-primary);
  font-size: 14px; display: flex; flex-direction: column; min-height: 100vh; }
button { font: inherit; }

/* Header */
.rt-head { display: flex; align-items: center; justify-content: space-between; padding: .55rem 1.2rem;
  background: var(--color-surface-white); border-bottom: 1px solid var(--color-border); }
.rt-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; letter-spacing: .02em; margin: 0; line-height: 1.9rem; }
.rt-sub { font-size: .8rem; font-weight: 300; letter-spacing: .02em; margin: 0; color: var(--color-text-muted); }

.lbl { font-family: var(--font-display); font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--color-text-body); }

.inp { width: 100%; height: 34px; padding: 0 .7rem; font: inherit; font-size: .85rem; color: var(--color-primary);
  background: var(--color-surface-white); border: 1px solid var(--color-border-input);
  border-radius: var(--radius-input); transition: border-color .2s, box-shadow .2s; }
.inp:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
.inp::placeholder { color: var(--color-text-muted); }

/* Buttons */
.btn { height: 34px; padding: 0 1rem; border-radius: var(--radius-input); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: .82rem; letter-spacing: .04em;
  transition: background .2s, border-color .2s, color .2s; white-space: nowrap; }
.btn-primary { background: var(--color-primary); color: #fff; border: none; letter-spacing: .08em; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-ghost { background: var(--color-surface-white); color: var(--color-text-body); border: 1px solid var(--color-border-input); padding: 0 .7rem; }
.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-block { width: 100%; }
.btn-draw.active { background: #9333ea; border-color: #9333ea; color: #fff; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; padding: .15rem .3rem;
  color: var(--color-text-muted); border-radius: 6px; }
.icon-btn:hover { background: var(--color-surface-card); color: var(--color-primary); }

/* Layout: Child | Map | Parent */
.jk-body { flex: 1; display: grid; grid-template-columns: var(--col-w) minmax(0, 1fr) var(--col-w);
  gap: .9rem; padding: .9rem 1.2rem; min-height: 0; }
.jk-col { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.jk-center { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }

.card, .site-card { background: var(--color-surface-white); border: 1px solid var(--color-border);
  border-radius: var(--radius-card); padding: .8rem 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.card-title { font-family: var(--font-display); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }

/* Site cards */
.site-card { display: flex; flex-direction: column; gap: .55rem; transition: opacity .2s, transform .2s; }
.site-card .card-head { margin-bottom: 0; }
.site-card.swapping { opacity: .4; transform: scale(.97); }
.child-card { border-left: 4px solid var(--color-child); }
.parent-card { border-left: 4px solid var(--color-parent); }
.form-group { display: flex; flex-direction: column; gap: .25rem; }
.card-badge { display: inline-block; padding: .22rem .65rem; border-radius: 999px; font-family: var(--font-display);
  font-size: .7rem; font-weight: 600; letter-spacing: .12em; color: #fff; border: 0; }
.child-badge { background: var(--color-child); }
.parent-badge { background: var(--color-parent); cursor: pointer; transition: box-shadow .2s; }
.parent-badge:hover { box-shadow: 0 0 0 3px rgba(26,58,107,.2); }
.card-dot { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: .75rem; }

.controls-section { display: flex; flex-direction: column; gap: .5rem; }
.button-group { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }

.drawing-status { padding: .5rem .7rem; border-radius: var(--radius-input); background: rgba(147,51,234,.08);
  border: 1px solid rgba(147,51,234,.35); color: #6b21a8; font-size: .8rem; font-weight: 500; animation: pulse 2s infinite; }
.drawing-status small { color: var(--color-text-muted); font-weight: 400; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .65; } }

/* Legend rel */
.rail-legend ul { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem;
  font-size: .78rem; color: var(--color-text-body); }
.rail-legend li { display: flex; align-items: center; gap: .5rem; }
.lg-rail { width: 28px; height: 6px; border-radius: 3px; background: repeating-linear-gradient(90deg, #fff 0 5px, #555 5px 10px);
  border: 2px solid #555; }
.lg-near { width: 28px; border-top: 2px dashed var(--color-warn); }

/* Map */
.map-container { position: relative; flex: 1; min-height: 480px; background: var(--color-surface-white);
  border: 1px solid var(--color-border); border-radius: var(--radius-card); overflow: hidden; }
#map { position: absolute; inset: 0; }
.map-controls { position: absolute; top: 10px; right: 10px; z-index: 500; display: inline-flex;
  border: 1px solid var(--color-border-input); border-radius: var(--radius-input); overflow: hidden;
  background: var(--color-surface-white); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.map-control-btn { height: 30px; padding: 0 .85rem; border: 0; cursor: pointer; font-family: var(--font-display);
  font-weight: 600; font-size: .78rem; color: var(--color-text-muted); background: var(--color-surface-white);
  transition: background .2s, color .2s; }
.map-control-btn + .map-control-btn { border-left: 1px solid var(--color-border-input); }
.map-control-btn:hover { color: var(--color-primary); }
.map-control-btn.active { background: var(--color-primary); color: #fff; }

/* Path results */
.path-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.path-card-wrap { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.path-box { display: flex; flex-direction: column; gap: .2rem; padding: .65rem .8rem; cursor: pointer;
  background: var(--color-surface-white); border: 1px solid var(--color-border); border-radius: var(--radius-card);
  transition: border-color .2s, box-shadow .2s, transform .2s; }
.path-box:hover { border-color: var(--color-primary); }
.path-box.active { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary); }
.path-box.inactive { opacity: .45; cursor: not-allowed; }
.path-box.inactive:hover { border-color: var(--color-border); }
.path-title { font-family: var(--font-display); font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--color-text-body); display: flex; align-items: center; gap: .4rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.path-dist { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.rail-badge { align-self: flex-start; font-size: .72rem; font-weight: 500; padding: .12rem .5rem; border-radius: 999px; }
.rail-badge:empty { display: none; }
.rail-badge.loading { background: var(--color-surface-card); color: var(--color-text-muted); }
.rail-badge.ok { background: rgba(40,167,69,.12); color: #1e7e34; }
.rail-badge.near { background: rgba(230,81,0,.12); color: var(--color-warn); }
.rail-badge.cross { background: rgba(213,0,0,.1); color: var(--color-danger); font-weight: 700; }
.rail-badge.err { background: var(--color-surface-card); color: var(--color-text-muted); cursor: help; }

.btn-kml { height: 28px; border-radius: var(--radius-input); cursor: pointer; font-family: var(--font-display);
  font-weight: 600; font-size: .74rem; letter-spacing: .06em; background: var(--color-surface-white);
  color: var(--color-primary); border: 1px solid var(--color-border-input); transition: background .2s, color .2s; }
.btn-kml:not(:disabled):hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-kml:disabled { opacity: .4; cursor: not-allowed; }

/* Kandidat terdekat */
.near-panel { display: flex; flex-direction: column; gap: .45rem; min-height: 0; }
.near-panel[hidden] { display: none; }
.near-panel .card-head { margin-bottom: .1rem; }
.near-ctrl { display: grid; grid-template-columns: 1fr auto; gap: .4rem; }
.near-presets { display: flex; flex-wrap: wrap; gap: .3rem; }
.near-presets button { padding: .22rem .6rem; border-radius: 999px; cursor: pointer; font-size: .76rem; border: 0;
  background: var(--color-surface-card); color: var(--color-text-body); transition: background .2s, color .2s; }
.near-presets button:hover { background: var(--color-primary); color: #fff; }
.near-info { font-size: .78rem; color: var(--color-text-muted); }
.near-info b { color: var(--color-primary); font-family: var(--font-display); }
.near-info.error { color: var(--color-danger); }
.near-list { display: flex; flex-direction: column; overflow-y: auto; max-height: 52vh;
  border-top: 1px solid var(--color-border); margin: 0 -1rem -.8rem; }
.near-row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: .5rem; text-align: left;
  padding: .45rem 1rem; border: 0; border-bottom: 1px solid var(--color-border); background: none; cursor: pointer; }
.near-row:hover { background: rgba(0,0,0,.03); }
.near-row.sel { background: rgba(26,58,107,.08); box-shadow: inset 3px 0 0 var(--color-parent); }
.near-no { font-family: var(--font-display); font-size: .72rem; color: var(--color-text-muted); text-align: center; }
.near-name { display: flex; flex-direction: column; min-width: 0; }
.near-name b { font-family: var(--font-display); font-weight: 600; font-size: .85rem; letter-spacing: .03em; }
.near-name small, .near-dist small { font-size: .7rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.near-dist { display: flex; flex-direction: column; align-items: flex-end; font-size: .74rem; color: var(--color-text-muted);
  font-variant-numeric: tabular-nums; }
.near-dist b { font-family: var(--font-display); font-size: .88rem; color: var(--color-primary); }
.near-empty { padding: 1.2rem 1rem; text-align: center; color: var(--color-text-muted); font-size: .8rem; }

/* Dialog PIN (sama dengan RTP) */
.dlg-wrap { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.45); display: flex;
  align-items: center; justify-content: center; padding: 16px; }
.dlg-wrap[hidden] { display: none; }
.dlg { background: #fff; border-radius: 12px; padding: 1.2rem; width: 280px; max-width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.dlg-head b { font-family: var(--font-display); font-size: 1.1rem; }
.dlg-x { border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: var(--color-text-muted); line-height: 1; }
.dlg-sub { margin: 0 0 .8rem; font-size: .8rem; color: var(--color-text-muted); }
.dlg input { width: 100%; height: 38px; padding: 0 .7rem; font-size: 1rem; letter-spacing: .2em;
  border: 1px solid var(--color-border-input); border-radius: 8px; outline: none; }
.dlg input:focus { border-color: #111; box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
.dlg button[type=submit] { width: 100%; height: 38px; margin-top: .6rem; border: 0; border-radius: 8px; cursor: pointer;
  background: #111; color: #fff; font-family: var(--font-display); font-weight: 600; letter-spacing: .08em; }
.dlg button[type=submit]:hover { background: #333; }
.dlg button[type=submit]:disabled { opacity: .6; cursor: wait; }
.dlg-err { margin-top: .6rem; padding: .45rem .6rem; border-radius: 8px; background: #fdecea; color: #b71c1c; font-size: .85rem; }
.dlg-err[hidden] { display: none; }

/* Loading overlay */
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none;
  justify-content: center; align-items: center; z-index: 9999; }
.loading-overlay.show { display: flex; }
.loading-spinner { background: #fff; padding: 1.6rem 2rem; border-radius: var(--radius-card); text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.spinner { border: 3px solid var(--color-surface-card); border-top-color: var(--color-primary); border-radius: 50%;
  width: 34px; height: 34px; animation: spin .8s linear infinite; margin: 0 auto .8rem; }
.loading-spinner p { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: .85rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Leaflet tooltips / markers */
.marker-label { background: rgba(17,17,17,.88); border: none; border-radius: 6px; color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: 12px; padding: 3px 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); letter-spacing: .04em; }
.marker-label::before { border-top-color: rgba(17,17,17,.88); }
.waypoint-tooltip { background: rgba(147,51,234,.95); border: none; border-radius: 6px; color: #fff;
  font-weight: 700; font-size: 11px; padding: 2px 7px; }
.waypoint-tooltip::before { border-top-color: rgba(147,51,234,.95); }
.rail-x { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 3px solid var(--color-danger);
  display: flex; align-items: center; justify-content: center; font-size: 14px; position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.rail-x b { position: absolute; top: -7px; right: -7px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 3px;
  background: #111; color: #fff; font: 600 10px/16px var(--font-display); text-align: center; }
.rail-x.mini { width: 22px; height: 22px; border-width: 2px; font-size: 11px; box-shadow: none; }
.rail-x-icon { background: none; border: 0; }
.rail-tip, .rail-dist-tip { font-family: var(--font-body); font-size: 12px; }
.rail-dist-tip { background: var(--color-warn); color: #fff; border: 0; font-weight: 700; padding: 2px 7px; }
.rail-dist-tip::before { border-right-color: var(--color-warn); }
.rail-pop { font-family: var(--font-body); font-size: 12px; line-height: 1.55; }
.rail-pop code { font-size: 11px; }

/* Responsive */
@media (max-width: 1280px) {
  :root { --col-w: 260px; }
  .path-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .jk-body { grid-template-columns: 1fr; padding: .7rem 16px; }
  .jk-left { order: 1; }
  .jk-right { order: 2; }
  .jk-center { order: 3; }
  .map-container { min-height: 420px; }
  .near-list { max-height: 45vh; }
}
@media (max-width: 480px) {
  .path-results { grid-template-columns: 1fr; }
}

/* ===== Alat peta ala POCARI (map-tools.js) ===== */
.leaflet-container { font-family: var(--font-body, 'DM Sans', sans-serif); }
.leaflet-top.leaflet-right .leaflet-control { clear: both; }
.pc-base { display: inline-flex; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.pc-base-btn { height: 30px; padding: 0 .85rem; border: 0; cursor: pointer; font: 600 .78rem 'Outfit', sans-serif;
  color: #6B7280; background: #fff; }
.pc-base-btn + .pc-base-btn { border-left: 1px solid #d1d5db; }
.pc-base-btn:hover { color: #111; }
.pc-base-btn.active { background: #111; color: #fff; }
.pc-llpop .leaflet-popup-content-wrapper { border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.pc-llpop .leaflet-popup-content { margin: 8px 12px; }
.pc-llbox { cursor: pointer; white-space: nowrap; font: 500 14px 'DM Sans', 'Segoe UI', sans-serif; color: #111; }
.pc-ll { font-weight: 600; letter-spacing: .01em; }
.pc-cp { margin-left: 10px; color: #28a745; font-weight: 600; font-size: 12px; }
.leaflet-container a.pc-ruler-btn { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  background: #fff; color: #111; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,.35); cursor: pointer; }
.leaflet-container a.pc-ruler-btn:hover { background: #f4f7fa; }
.leaflet-container a.pc-ruler-btn.pc-ruler-on { background: #111; color: #fff; }
.pc-measuring, .pc-measuring .leaflet-interactive { cursor: crosshair !important; }
.pc-measuring .leaflet-interactive { pointer-events: none !important; }
.pc-measuring .leaflet-pcRuler-pane .leaflet-interactive { pointer-events: auto !important; }
.pc-measuring .leaflet-tooltip-pane { display: none; }
.pc-ruler-wrap { overflow: visible; }
.pc-ruler-label { position: absolute; transform: translate(-50%, -140%); white-space: nowrap; background: #fff;
  color: #111; font: 600 13px 'DM Sans', 'Segoe UI', sans-serif; padding: 4px 9px; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.pc-ruler-final, .pc-measuring .pc-ruler-final { cursor: pointer !important; }
.pc-ruler-cp { margin-left: 8px; color: #28a745; font-size: 11px; }
.pc-pin-ctl { position: relative; }
.pc-pin-wrap { overflow: visible; }
.pc-pin { position: absolute; left: -13px; top: -33px; pointer-events: auto; cursor: pointer; }
.pc-pin span { position: absolute; left: 25px; top: 2px; font: 800 12px Arial, sans-serif; color: #111; white-space: nowrap;
  text-shadow: -1.5px -1.5px 0 #fff, 1.5px -1.5px 0 #fff, -1.5px 1.5px 0 #fff, 1.5px 1.5px 0 #fff; }
.pc-pin-panel { display: none; position: absolute; right: 42px; top: 0; width: 230px; background: #fff; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.3); padding: 10px 12px; font: 500 12px 'DM Sans', 'Segoe UI', sans-serif; color: #111; }
.pc-pin-panel.pc-open { display: block; }
.pc-pin-title { font-weight: 700; margin-bottom: 6px; }
.pc-pin-in { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid #bbb; border-radius: 6px; font: inherit; }
.pc-pin-nm { margin-bottom: 6px; }
.pc-pin-msg { color: #666; font-size: 11px; margin: 4px 0 8px; }
.pc-pin-msg.pc-err { color: #d50000; }
.pc-pin-name { width: 170px; box-sizing: border-box; padding: 3px 6px; border: 1px solid #ccc; border-radius: 5px;
  font: 700 13px Arial, sans-serif; margin-bottom: 4px; }
.pc-pin-chk { display: flex; gap: 6px; align-items: center; cursor: pointer; margin-bottom: 8px; }
.leaflet-container .pc-pin-clr { color: #d50000; font-size: 11px; text-decoration: none; }
.pc-pin-act { margin-top: 6px; display: flex; gap: 14px; }
.leaflet-container .pc-pin-act a { color: #28a745; font-weight: 600; text-decoration: none; }
.leaflet-container .pc-pin-act a[data-a=del] { color: #d50000; }
.pc-pinning, .pc-pinning .leaflet-interactive { cursor: crosshair !important; }
.pc-cmp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; white-space: nowrap; }
.pc-cmp-row .pc-pin-in { width: 100px; }
.pc-cmp-wrap { overflow: visible; }
.pc-cmp-lbl { color: #ffff00; font: bold 10px sans-serif; text-shadow: 0 0 2px #000, 0 0 2px #000; white-space: nowrap; width: max-content; }
.pc-cmp-big { font-size: 13px; }
.pc-cmp-cross { transform: translate(-50%, -50%); color: #ffff00; font: bold 26px sans-serif; text-shadow: 0 0 2px #000; }
.pc-compassing { cursor: crosshair !important; }
