/* ==========================================================================
   NOVA Dashboard — Project, catatan & editor blok
   ========================================================================== */

/* ---------- Grid project ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 15px;
}
.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer;
  transition: transform var(--normal), box-shadow var(--normal), border-color var(--normal);
  display: flex; flex-direction: column;
  position: relative;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.project-cover {
  height: 78px; position: relative; flex: none;
  background: linear-gradient(135deg, var(--pc, #6366f1), color-mix(in srgb, var(--pc, #6366f1) 55%, #ffffff 45%));
  background-size: cover; background-position: center;
}
.project-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, .18));
}
.project-avatar {
  position: absolute; left: 16px; bottom: -21px; z-index: 2;
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--bg-surface); border: 3px solid var(--bg-surface);
  display: grid; place-items: center; font-size: 22px;
  box-shadow: var(--shadow-sm); overflow: hidden;
  background-size: cover; background-position: center;
}
.project-body { padding: 28px 16px 15px; flex: 1; display: flex; flex-direction: column; }
.project-name { font-size: 15px; font-weight: 640; letter-spacing: -.015em; }
.project-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; min-height: 19px; }
.project-stats { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.project-stat { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-muted); font-weight: 540; }
.project-stat svg { width: 13px; height: 13px; }
.project-menu-btn { position: absolute; top: 9px; right: 9px; z-index: 3;
  background: rgba(255, 255, 255, .9); color: #333; backdrop-filter: blur(6px); opacity: 0;
  transition: opacity var(--fast); }
.project-card:hover .project-menu-btn { opacity: 1; }
.project-menu-btn:hover { background: #fff; color: #000; }

.project-pin { position: absolute; top: 9px; left: 9px; z-index: 3; color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
.project-pin svg { width: 15px; height: 15px; }

.project-progress-track { height: 4px; border-radius: var(--r-pill); background: var(--bg-sunken); margin-top: 10px; overflow: hidden; }
.project-progress-fill { height: 100%; border-radius: var(--r-pill); background: var(--pc, var(--accent)); transition: width var(--normal); }

/* ---------- Header project ---------- */
.project-header {
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px;
  border: 1px solid var(--border); background: var(--bg-surface);
}
.project-banner {
  height: 116px; position: relative;
  background: linear-gradient(135deg, var(--pc, #6366f1), color-mix(in srgb, var(--pc, #6366f1) 50%, #ffffff 50%));
  background-size: cover; background-position: center;
}
.project-header-body { padding: 0 20px 17px; display: flex; align-items: flex-end; gap: 15px; flex-wrap: wrap; }
.project-header-avatar {
  width: 66px; height: 66px; border-radius: 17px; margin-top: -30px; flex: none;
  background: var(--bg-surface); border: 4px solid var(--bg-surface);
  display: grid; place-items: center; font-size: 30px;
  box-shadow: var(--shadow-sm); overflow: hidden;
  background-size: cover; background-position: center; z-index: 2;
}
.project-header-text { flex: 1; min-width: 180px; padding-top: 10px; }

/* ---------- Grid catatan ---------- */
.notes-toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 15px;
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 13px;
  align-items: start;
}
.notes-grid.list-mode { grid-template-columns: 1fr; }

.note-card {
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--nc-bg, var(--bg-surface));
  padding: 14px 15px;
  cursor: pointer; position: relative;
  transition: transform var(--normal), box-shadow var(--normal), border-color var(--normal);
  display: flex; flex-direction: column; gap: 7px;
  min-height: 118px;
  overflow: hidden;
}
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.note-card.list-row { min-height: 0; flex-direction: row; align-items: center; gap: 13px; padding: 11px 14px; }
.note-card.list-row .note-preview { display: none; }
.note-card.list-row .note-head { flex: 1; min-width: 0; }

.note-head { display: flex; align-items: flex-start; gap: 9px; }
.note-emoji { font-size: 17px; line-height: 1.25; flex: none; }
.note-title { font-size: 14px; font-weight: 620; line-height: 1.4; flex: 1; min-width: 0; letter-spacing: -.012em; }
.note-preview { font-size: 12.3px; color: var(--text-soft); line-height: 1.55; flex: 1; }
.note-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.note-date { font-size: 11px; color: var(--text-muted); }
.note-menu-btn { opacity: 0; transition: opacity var(--fast); flex: none; }
.note-card:hover .note-menu-btn { opacity: 1; }
.note-pin-mark { position: absolute; top: 9px; right: 9px; color: var(--warning); }
.note-pin-mark svg { width: 13px; height: 13px; }
.note-card.pinned { box-shadow: inset 0 2px 0 var(--warning); }

.tag-chip {
  font-size: 10.5px; font-weight: 570; padding: 2px 7px;
  border-radius: var(--r-pill); background: var(--bg-sunken); color: var(--text-soft);
  border: 1px solid var(--border);
}

/* ---------- Editor catatan ---------- */
.note-editor-shell {
  min-height: calc(100dvh - var(--header-h));
  background: var(--ne-canvas, var(--bg-app));
  transition: background var(--normal);
}
.note-editor-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 18px;
  background: color-mix(in srgb, var(--ne-canvas, var(--bg-app)) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.note-editor-wrap { max-width: 820px; margin: 0 auto; padding: 26px 26px 200px; }
.note-editor-wrap.wide { max-width: 1180px; }

.note-cover-strip { height: 158px; position: relative; background-size: cover; background-position: center; }
.note-cover-strip .cover-actions { position: absolute; right: 14px; bottom: 12px; display: flex; gap: 6px; opacity: 0; transition: opacity var(--fast); }
.note-cover-strip:hover .cover-actions { opacity: 1; }

.note-icon-big {
  font-size: 52px; line-height: 1; cursor: pointer; width: fit-content;
  border-radius: var(--r-sm); padding: 3px 5px; margin-left: -5px;
  transition: background var(--fast);
}
.note-icon-big:hover { background: var(--bg-hover); }

.note-title-input {
  width: 100%; border: none; background: none; outline: none;
  font-size: 33px; font-weight: 720; letter-spacing: -.035em;
  line-height: 1.2; padding: 6px 0; color: var(--text);
  font-family: inherit; resize: none; overflow: hidden;
}
.note-title-input::placeholder { color: var(--text-muted); opacity: .45; }

.note-meta-row {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 0 13px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}

/* ---------- Blok ---------- */
.blocks { display: flex; flex-direction: column; }

.block {
  position: relative;
  display: flex; align-items: flex-start; gap: 3px;
  padding: 1px 0;
  border-radius: var(--r-xs);
  transition: background var(--fast);
}
.block.drag-over-top { box-shadow: inset 0 2px 0 var(--accent); }
.block.drag-over-bottom { box-shadow: inset 0 -2px 0 var(--accent); }
.block.dragging { opacity: .4; }

.block-handles {
  display: flex; align-items: center; gap: 0;
  position: absolute; left: -50px; top: 2px;
  opacity: 0; transition: opacity var(--fast);
}
.block:hover .block-handles, .block:focus-within .block-handles { opacity: 1; }
.block-handle {
  width: 22px; height: 24px; border-radius: 5px;
  display: grid; place-items: center; color: var(--text-muted);
  cursor: grab; transition: background var(--fast), color var(--fast);
}
.block-handle:hover { background: var(--bg-hover); color: var(--text); }
.block-handle:active { cursor: grabbing; }
.block-handle svg { width: 15px; height: 15px; }

.block-content {
  flex: 1; min-width: 0;
  outline: none; padding: 3px 2px;
  line-height: 1.68; font-size: 15.5px;
  color: var(--text); word-break: break-word;
  caret-color: var(--accent);
}
.block-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted); opacity: .55; pointer-events: none;
}
.block-content a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.block-content code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--bg-sunken); padding: 1.5px 5px; border-radius: 5px;
  border: 1px solid var(--border); color: var(--danger);
}
.block-content mark { background: hsl(48 96% 70% / .5); border-radius: 3px; padding: 0 2px; color: inherit; }
[data-theme="dark"] .block-content mark { background: hsl(48 90% 55% / .3); }

/* Tipe blok */
.block[data-type="h1"] .block-content { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.28; margin-top: 20px; }
.block[data-type="h2"] .block-content { font-size: 22px; font-weight: 670; letter-spacing: -.024em; line-height: 1.3; margin-top: 16px; }
.block[data-type="h3"] .block-content { font-size: 17.5px; font-weight: 640; letter-spacing: -.016em; line-height: 1.35; margin-top: 12px; }
.block[data-type="quote"] {
  border-left: 3px solid var(--accent); padding-left: 14px; margin: 6px 0;
}
.block[data-type="quote"] .block-content { font-style: italic; color: var(--text-soft); font-size: 15.5px; }

.block-marker {
  flex: none; display: flex; align-items: flex-start; justify-content: center;
  min-width: 22px; padding-top: 6px; user-select: none;
  font-size: 15px; color: var(--text-soft);
}
.block-bullet { width: 6px; height: 6px; border-radius: 50%; background: var(--text); margin-top: 11px; }
.block-number { font-size: 14.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; padding-top: 4px; }

.block-todo-check {
  width: 18px; height: 18px; margin-top: 6px; flex: none;
  border: 1.8px solid var(--border-strong); border-radius: 5px;
  display: grid; place-items: center; cursor: pointer;
  transition: all var(--fast); background: var(--bg-surface);
}
.block-todo-check svg { width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity var(--fast); }
.block-todo-check:hover { border-color: var(--accent); }
.block-todo-check.checked { background: var(--success); border-color: var(--success); }
.block-todo-check.checked svg { opacity: 1; }
.block[data-type="todo"].done .block-content { text-decoration: line-through; color: var(--text-muted); }

.block-toggle-arrow {
  width: 20px; height: 20px; margin-top: 5px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  color: var(--text-soft); border-radius: 4px;
  transition: transform var(--fast), background var(--fast);
}
.block-toggle-arrow:hover { background: var(--bg-hover); }
.block-toggle-arrow svg { width: 14px; height: 14px; }
.block[data-type="toggle"].open .block-toggle-arrow { transform: rotate(90deg); }
.block-toggle-children {
  margin-left: 25px; padding-left: 12px;
  border-left: 1.5px solid var(--border);
  display: none; flex-direction: column;
}
.block[data-type="toggle"].open .block-toggle-children { display: flex; }

.block[data-type="divider"] { padding: 11px 0; }
.block-divider-line { flex: 1; height: 1px; background: var(--border-strong); }

.block[data-type="code"] { margin: 6px 0; }
.block-code-wrap {
  flex: 1; min-width: 0; border-radius: var(--r-sm);
  background: var(--bg-sunken); border: 1px solid var(--border);
  overflow: hidden;
}
.block-code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px; border-bottom: 1px solid var(--border); background: var(--bg-surface-2);
}
.block-code-lang { font-size: 11px; color: var(--text-muted); font-weight: 570; }
.block-code-wrap .block-content {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.65;
  padding: 11px 13px; white-space: pre-wrap; tab-size: 2;
}

.block[data-type="callout"] { margin: 6px 0; }
/* Latar callout selalu pastel terang, jadi teksnya dikunci gelap
   agar tetap terbaca pada tema gelap maupun terang. */
.block-callout-wrap {
  flex: 1; display: flex; gap: 11px; padding: 13px 15px;
  border-radius: var(--r-md); background: var(--co-bg, #e0e7ff);
  border: 1px solid color-mix(in srgb, var(--co-bg, #e0e7ff) 72%, #6b7280 28%);
  color: #1b1f2e;
}
.block-callout-wrap .block-content { color: #1b1f2e; caret-color: #1b1f2e; }
.block-callout-wrap .block-content:empty::before { color: #5b6072; opacity: .75; }
.block-callout-wrap .block-content a { color: #3730a3; }
.block-callout-wrap .block-content code {
  background: rgba(255, 255, 255, .62); border-color: rgba(0, 0, 0, .1); color: #9b1c31;
}
.block-callout-icon { font-size: 18px; line-height: 1.4; flex: none; cursor: pointer; }

.block[data-type="link"] { margin: 5px 0; }
.block-link-card {
  flex: 1; display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--bg-surface);
  transition: all var(--fast); text-decoration: none; color: inherit;
  min-width: 0;
}
.block-link-card:hover { border-color: var(--accent); background: var(--bg-hover); text-decoration: none; }
.block-link-fav {
  width: 32px; height: 32px; border-radius: var(--r-xs); flex: none;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text);
}
.block-link-fav svg { width: 15px; height: 15px; }
.block-link-text { min-width: 0; flex: 1; }
.block-link-title { font-size: 13.5px; font-weight: 570; }
.block-link-url { font-size: 11.5px; color: var(--text-muted); }

.block[data-type="image"] { margin: 8px 0; }
.block-image-wrap { flex: 1; border-radius: var(--r-md); overflow: hidden; position: relative; }
.block-image-wrap img { width: 100%; height: auto; display: block; }
.block-image-cap { font-size: 11.5px; color: var(--text-muted); text-align: center; padding: 6px 0 0; }

.block[data-type="table"] { margin: 8px 0; }
.block-table-wrap { flex: 1; overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--border); }
.block-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--bg-surface); }
.block-table td, .block-table th { border: 1px solid var(--border); padding: 7px 10px; min-width: 90px; }
.block-table th { background: var(--bg-surface-2); font-weight: 600; text-align: left; }
.block-table td:focus, .block-table th:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Menu slash ---------- */
.slash-menu { width: 288px; padding: 6px; max-height: 330px; }
.slash-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 7px 9px; border-radius: var(--r-xs);
  text-align: left; cursor: pointer; transition: background var(--fast);
}
.slash-item:hover, .slash-item.focus { background: var(--accent-soft); }
.slash-icon {
  width: 30px; height: 30px; flex: none; border-radius: var(--r-xs);
  display: grid; place-items: center; background: var(--bg-sunken);
  color: var(--text-soft); font-size: 14px;
}
.slash-icon svg { width: 15px; height: 15px; }
.slash-text { min-width: 0; }
.slash-name { font-size: 13.2px; font-weight: 550; }
.slash-desc { font-size: 11px; color: var(--text-muted); }

/* ---------- Toolbar seleksi teks ---------- */
.sel-toolbar {
  position: fixed; z-index: 960;
  display: flex; align-items: center; gap: 1px;
  padding: 4px; border-radius: var(--r-sm);
  background: var(--bg-inverse); box-shadow: var(--shadow-pop);
  animation: pop-in 120ms var(--ease);
}
.sel-toolbar button {
  width: 30px; height: 28px; border-radius: 5px;
  display: grid; place-items: center; color: var(--text-inverse);
  opacity: .8; transition: all var(--fast);
}
.sel-toolbar button:hover { background: rgba(127, 127, 127, .28); opacity: 1; }
.sel-toolbar button.active { background: var(--accent); opacity: 1; color: #fff; }
.sel-toolbar button svg { width: 15px; height: 15px; }
.sel-sep { width: 1px; height: 18px; background: rgba(127, 127, 127, .4); margin: 0 3px; }

/* ---------- Daftar isi ---------- */
.toc {
  position: sticky; top: 16px; align-self: start;
  padding: 12px 0 12px 14px; border-left: 1px solid var(--border);
  max-height: calc(100dvh - var(--header-h) - 90px); overflow-y: auto; width: 200px;
}
.toc-item {
  display: block; width: 100%; text-align: left;
  padding: 4px 8px; border-radius: var(--r-xs);
  font-size: 12.3px; color: var(--text-muted);
  transition: all var(--fast); line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toc-item:hover { background: var(--bg-hover); color: var(--text); }
.toc-item.lvl2 { padding-left: 18px; font-size: 12px; }
.toc-item.lvl3 { padding-left: 28px; font-size: 11.5px; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 216px; gap: 22px; }
@media (max-width: 1120px) { .editor-layout { grid-template-columns: 1fr; } .toc { display: none; } }
@media (max-width: 720px) {
  .note-editor-wrap { padding: 18px 16px 160px; }
  .block-handles { left: -28px; }
  .note-title-input { font-size: 26px; }
}

/* ---------- Warna kanvas ---------- */
.canvas-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.canvas-opt {
  aspect-ratio: 1.35; border-radius: var(--r-sm); cursor: pointer;
  border: 2px solid var(--border); position: relative;
  transition: transform var(--fast), border-color var(--fast);
}
.canvas-opt:hover { transform: scale(1.06); }
.canvas-opt.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.canvas-opt::after {
  content: "Aa"; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 11px; font-weight: 640; opacity: .55;
}
