/* Mindmap Analis Digital — tema gelap */
:root {
  --bg: #0B1220;
  --bg2: #0E1626;
  --panel: #131C2E;
  --card: #1E293B;
  --border: #24334A;
  --text: #E2E8F0;
  --muted: #94A3B8;
  --amber: #F59E0B;
  --sky: #38BDF8;
  --green: #10B981;
  --red: #EF4444;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #16233f 0%, var(--bg) 55%);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- auth (login) ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 36px 32px; box-shadow: var(--shadow);
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-logo .dot {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--amber), #f97316);
  display: grid; place-items: center; font-size: 18px;
}
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card p { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* ---------- forms ---------- */
label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text);
  font-size: 14px; outline: none;
}
input:focus, select:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(56,189,248,.15); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--amber), #f97316); color: #1a1202; border: none; }
.btn.sky { background: var(--sky); color: #06121a; border: none; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.icon { padding: 8px 10px; }

/* ---------- dashboard ---------- */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: rgba(11,18,32,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.topbar .brand .dot { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--amber), #f97316); display: grid; place-items: center; font-size: 15px; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }

.dash-main { max-width: 980px; margin: 28px auto; padding: 0 20px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dash-head h2 { font-size: 20px; }
.dash-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.map-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.map-card:hover { border-color: var(--amber); transform: translateY(-2px); box-shadow: var(--shadow); }
.map-card .title { font-weight: 700; font-size: 15px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.map-card .title .emoji { font-size: 18px; }
.map-card .meta { color: var(--muted); font-size: 12px; line-height: 1.7; }
.map-card .lock-pill {
  display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 20px;
  background: rgba(245,158,11,.12); color: var(--amber); font-size: 11px; font-weight: 600;
}
.map-card .del { position: absolute; top: 10px; right: 10px; opacity: 0; transition: opacity .15s; }
.map-card:hover .del { opacity: 1; }

/* empty state */
.empty-state { grid-column: 1 / -1; text-align: center; padding: 72px 20px; }
.empty-state .empty-emoji { font-size: 54px; line-height: 1; margin-bottom: 14px; }
.empty-state .empty-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.empty-state .empty-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

/* ---------- editor ---------- */
#app { height: 100vh; display: flex; flex-direction: column; }
.ed-toolbar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; background: rgba(11,18,32,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); overflow-x: auto; white-space: nowrap;
}
.ed-toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 5px; flex: none; }
.ed-toolbar .grp {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px;
  border-radius: 9px; background: rgba(148,163,184,.07); border: 1px solid rgba(148,163,184,.09); flex: none;
}
.ed-toolbar .btn.icon { font-size: 15px; line-height: 1; padding: 6px 8px; }
.ed-toolbar select { font-size: 12px; border-radius: 8px; }
.ed-toolbar .map-title {
  background: transparent; border: 1px solid transparent; font-weight: 700; font-size: 14px;
  width: 200px; padding: 6px 10px; border-radius: 8px; color: var(--text);
}
.ed-toolbar .map-title:hover { border-color: var(--border); }
.ed-toolbar .map-title:focus { border-color: var(--sky); background: var(--bg2); }
#edWrap { flex: 1; position: relative; min-height: 0; display: flex; }
#map {
  flex: 1 1 auto; min-height: 0;
  background-image: radial-gradient(circle, rgba(148,163,184,.12) 1px, transparent 1px);
  background-size: 22px 22px;
}
#map:focus { outline: none; }

/* save status + lock banner */
#saveState { color: var(--muted); font-size: 12px; min-width: 70px; text-align: right; }
#saveState.saved { color: var(--green); }
#lockBanner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: rgba(127,29,29,.92); border: 1px solid #7f1d1d; color: #fecaca;
  padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
  display: none; align-items: center; gap: 10px; box-shadow: var(--shadow);
}

/* ---------- sidebar (style panel) ---------- */
#stylePanel {
  position: absolute; top: 12px; right: 12px; z-index: 55; width: 250px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 14px; display: none; max-height: calc(100% - 24px); overflow-y: auto;
}
#stylePanel h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 8px; }
#stylePanel h4:first-child { margin-top: 0; }
.sp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
#stylePanel h4.sp-sec { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.sp-row label { margin: 0; flex: 1; font-size: 12px; }
.swatch { width: 42px; height: 30px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; padding: 0; background: transparent; position: relative; overflow: hidden; }
.swatch input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; }
.swatch::after { content: ""; position: absolute; inset: 6px; border-radius: 5px; background: currentColor; }
input[type=range] { flex: 1; accent-color: var(--amber); }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,8,16,.66); backdrop-filter: blur(3px);
  display: none; place-items: center; z-index: 100;
}
.modal-backdrop.open { display: grid; }
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: min(80vh, 640px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 22px;
}
.modal h3 { font-size: 16px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.modal .m-sub { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.modal .m-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.present-box {
  background: var(--bg2); border: 1px dashed var(--border); border-radius: 10px;
  padding: 12px; margin-top: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px;
  word-break: break-all; line-height: 1.8;
}
.present-box .k { color: var(--muted); font-size: 11px; font-family: inherit; }

/* shortcut settings */
.sc-list { display: flex; flex-direction: column; }
.sc-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.sc-item:last-child { border-bottom: none; }
.sc-item .name { flex: 1; font-size: 13px; }
.sc-key {
  min-width: 150px; text-align: center; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg2); color: var(--sky);
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: ui-monospace, Menlo, monospace;
}
.sc-key.recording { border-color: var(--amber); color: var(--amber); animation: pulse 1s infinite; }
.sc-key.none { color: var(--muted); font-style: italic; }
@keyframes pulse { 50% { opacity: .45; } }
.sc-item .rm { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.sc-item .rm:hover { color: var(--red); }

/* find */
#findBox { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 55; display: none; }
#findBox input { width: 320px; }

/* toast */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); transition: transform .25s; z-index: 200;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- present viewer ---------- */
.pv-toolbar { height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: rgba(11,18,32,.92); border-bottom: 1px solid var(--border); }
.pv-toolbar .title { font-weight: 700; }
.pv-toolbar .live { color: var(--green); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.pv-toolbar .live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }
.pv-wrap { flex: 1; position: relative; min-height: 0; }
#pvMap { position: absolute; inset: 0; }

/* ---------- misc ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
