/* MindmapKu — gaya. Tanpa CDN, font sistem saja. */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 14px;
}
#app { display: flex; height: 100vh; overflow: hidden; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit;
  color: #e2e8f0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #2563eb; border-color: #2563eb; }
.muted { color: #94a3b8; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* ---- Tombol ---- */
.btn {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 7px 12px;
}
.btn:hover { border-color: #64748b; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
.btn.ghost { background: transparent; }
.btn.block { display: block; width: 100%; margin-top: 8px; }
.btn.icon { padding: 7px 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Sidebar ---- */
#sidebar {
  width: 280px; flex: none;
  background: #111c33;
  border-right: 1px solid #1e293b;
  display: flex; flex-direction: column;
  padding: 14px;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.brand-mark { font-size: 22px; }
.side-section { margin-bottom: 12px; }
.side-section.grow { flex: 1; overflow-y: auto; min-height: 0; }
.side-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; margin: 6px 0; }
#search { width: 100%; }
.map-list { list-style: none; margin: 0; padding: 0; }
.map-item {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.map-item:hover { background: #1e293b; }
.map-item.active { background: #1e3a5f; }
.map-item .map-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-item .map-date { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.map-item .mini-btn {
  background: none; border: none; color: #94a3b8; padding: 2px 4px; font-size: 13px;
}
.map-item .mini-btn:hover { color: #fff; }
.seed-row { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

/* ---- Area utama ---- */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; background: #111c33; border-bottom: 1px solid #1e293b;
}
#map-title { flex: 1; min-width: 180px; font-weight: 600; }
.slug-label { display: flex; align-items: center; gap: 2px; color: #94a3b8; font-size: 13px; }
.slug-label input { width: 130px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.variant-label { display: flex; align-items: center; gap: 6px; color: #94a3b8; font-size: 13px; }
.toolbar-actions, .zoom-actions { display: flex; gap: 6px; align-items: center; }
.save-status { font-size: 12px; color: #94a3b8; min-width: 110px; }
.save-status.saving { color: #fbbf24; }
.save-status.saved { color: #4ade80; }
.save-status.error { color: #f87171; }

#canvas-wrap { flex: 1; position: relative; overflow: hidden; background: #0b1220; }
#canvas { width: 100%; height: 100%; display: block; touch-action: none; }
#canvas .node { cursor: pointer; }
#canvas .node rect { stroke-width: 2; }
#canvas .node.selected rect { stroke: #fbbf24; stroke-width: 3; }
#canvas .node text { fill: #fff; font-size: 13px; font-weight: 600; pointer-events: none; }
#canvas .edge { stroke: #475569; stroke-width: 2; fill: none; }
#canvas .badge { cursor: pointer; }
#canvas .badge circle { fill: #1e293b; stroke: #94a3b8; }
#canvas .badge text { fill: #e2e8f0; font-size: 12px; }
#canvas .note-dot { fill: #fbbf24; }
.hint {
  position: absolute; left: 12px; bottom: 10px;
  background: rgba(17, 28, 51, .9); border: 1px solid #1e293b; border-radius: 8px;
  padding: 6px 10px; font-size: 12px; color: #94a3b8;
}
.empty-state {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; color: #94a3b8;
}
.node-editor {
  position: absolute; z-index: 5; padding: 6px 8px; font-size: 13px; font-weight: 600;
  border: 2px solid #fbbf24; border-radius: 8px; background: #1e293b; color: #fff;
}

/* ---- Panel detail ---- */
#detail {
  width: 300px; flex: none; background: #111c33; border-left: 1px solid #1e293b;
  padding: 14px; overflow-y: auto;
}
.detail-head { display: flex; justify-content: space-between; align-items: center; }
.detail-head h2 { font-size: 15px; margin: 0; }
.breadcrumb { font-size: 12px; color: #94a3b8; word-break: break-word; }
.field { display: block; margin: 12px 0; font-size: 13px; color: #cbd5e1; }
.field input, .field textarea { width: 100%; margin-top: 4px; }
.field textarea { resize: vertical; }
.palette { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; padding: 0;
}
.swatch.active { border-color: #fff; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ---- Modal ---- */
.modal {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .7);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
/* BUGFIX 2026-12-06: `display:flex` di atas mengalahkan atribut `hidden`
   (aturan UA `[hidden]{display:none}` kalah spesifik), sehingga
   `modal.hidden = true` TIDAK menyembunyikan popup sama sekali.
   Aturan ini wajib ada supaya Tutup / Simpan benar-benar menutup modal. */
.modal[hidden] { display: none; }
.modal-card {
  background: #111c33; border: 1px solid #334155; border-radius: 14px;
  padding: 20px; width: min(560px, 92vw); max-height: 88vh; overflow-y: auto;
}
.modal-card h2 { margin: 0 0 12px; font-size: 17px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-card textarea { width: 100%; }

@media (max-width: 900px) {
  #sidebar { width: 220px; }
  #detail { position: fixed; right: 0; top: 0; bottom: 0; z-index: 10; box-shadow: -4px 0 16px rgba(0,0,0,.4); }
}
