/* ============================================================
   Note-limits — custom styles layered on top of Tailwind
   (editor blocks, slash menu, modals, scrollbars, transitions)
   ============================================================ */

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #334155 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Sidebar collapse transition ---------- */
.sidebar { transition: width .18s ease, opacity .18s ease; }
body.sidebar-collapsed #sidebar { width: 0; opacity: 0; overflow: hidden; border-right-width: 0; }
body.sidebar-collapsed #btn-expand-sidebar { display: inline-block; }

/* ---------- Panes ---------- */
.pane { position: relative; min-width: 0; min-height: 0; background: #020617; }
.pane-col > * + * { border-top: 1px solid #1e293b; }
.pane-row > * + * { border-left: 1px solid #1e293b; }

/* ---------- Resizable split dividers ---------- */
.divider { flex: 0 0 auto; position: relative; z-index: 10; transition: background .12s ease; }
.divider-row { width: 6px; margin-left: -3px; margin-right: -3px; cursor: col-resize; }
.divider-col { height: 6px; margin-top: -3px; margin-bottom: -3px; cursor: row-resize; }
.divider-row:hover, body.resizing-col .divider-row { background: rgba(99, 102, 241, .55); }
.divider-col:hover, body.resizing-row .divider-col { background: rgba(99, 102, 241, .55); }
body.resizing { user-select: none; }
body.resizing-col { cursor: col-resize; }
body.resizing-row { cursor: row-resize; }

/* ---------- Pane tab bar ---------- */
.pane-tabs {
  display: flex; align-items: flex-end; gap: 2px; overflow-x: auto;
  padding: 4px 6px 0; min-height: 30px; background: #0b1120;
}
.pane-tab {
  display: flex; align-items: center; gap: .35rem; max-width: 14rem; flex-shrink: 0;
  padding: .3rem .55rem; font-size: .78rem; color: #94a3b8; cursor: pointer; user-select: none;
  border: 1px solid transparent; border-bottom: none; border-radius: .375rem .375rem 0 0;
  white-space: nowrap;
}
.pane-tab:hover { background: #1e293b; color: #e2e8f0; }
.pane-tab.active { background: #020617; color: #e0e7ff; border-color: #1e293b; }
.pane-tab.dragging { opacity: .35; }
.pane-tab-title { overflow: hidden; text-overflow: ellipsis; max-width: 11rem; }
.pane-tab-close { visibility: hidden; border-radius: .25rem; padding: 0 .25rem; color: #64748b; font-size: .7rem; line-height: 1.2; }
.pane-tab:hover .pane-tab-close { visibility: visible; }
.pane-tab-close:hover { color: #f87171; background: rgba(248, 113, 113, .15); }
.pane-tabs.drop-target { outline: 2px dashed #6366f1; outline-offset: -2px; }
.pane-scroll.drop-target { outline: 2px dashed #6366f1; outline-offset: -4px; }
.pane-header .pane-title { border-top: none; }
.pane-header { border-top: 0; }
.pane.active .pane-header { background: rgba(49, 46, 129, .25); }
.pane-header { transition: background .15s ease; }

.pane-title {
  background: transparent; border: 1px solid transparent; border-radius: .375rem;
  font-weight: 600; font-size: .95rem; color: #e2e8f0; padding: .25rem .5rem; min-width: 0; flex: 1;
}
.pane-title:focus { outline: none; border-color: #6366f1; background: #0f172a; }

/* ---------- Editor blocks ---------- */
.editor { max-width: 48rem; padding: 2.5rem 2rem 8rem; }
.block { position: relative; display: flex; align-items: flex-start; gap: .5rem; border-radius: .375rem; }
.block:hover { background: rgba(30, 41, 59, .35); }
.block-content {
  flex: 1; min-width: 0; outline: none; white-space: pre-wrap; word-break: break-word;
  padding: .125rem .25rem; line-height: 1.6; font-size: .95rem;
}
.block-content:empty::before { content: attr(data-placeholder); color: #475569; pointer-events: none; }
.block-content[data-empty="true"]::before { content: attr(data-placeholder); color: #475569; pointer-events: none; }

/* block types */
.block[data-type="h1"] .block-content { font-size: 1.875rem; font-weight: 700; line-height: 1.25; margin-top: .75rem; }
.block[data-type="h2"] .block-content { font-size: 1.5rem;   font-weight: 700; line-height: 1.3;  margin-top: .6rem; }
.block[data-type="h3"] .block-content { font-size: 1.25rem;  font-weight: 600; line-height: 1.35;  margin-top: .5rem; }
.block[data-type="bullet"]  > .block-bullet  { user-select: none; padding: .125rem .25rem; color: #94a3b8; }
.block[data-type="todo"]    > .block-check   { margin-top: .3rem; accent-color: #6366f1; width: 1rem; height: 1rem; flex-shrink: 0; }
.block[data-type="todo"].done > .block-content { text-decoration: line-through; color: #64748b; }
.block[data-type="quote"]   { border-left: 3px solid #6366f1; padding-left: .75rem; margin: .25rem 0; }
.block[data-type="callout"] { background: rgba(99, 102, 241, .12); border: 1px solid rgba(99, 102, 241, .35);
  border-radius: .5rem; padding: .5rem .75rem; margin: .35rem 0; }
.block[data-type="callout"] > .block-icon { user-select: none; padding: .125rem .25rem; }
.block[data-type="code"]    { margin: .35rem 0; }
.block[data-type="code"] .block-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem; background: #0f172a; border: 1px solid #1e293b; border-radius: .5rem;
  padding: .75rem 1rem; tab-size: 2;
}

/* ---------- Slash menu ---------- */
.slash-menu {
  position: absolute; z-index: 30; min-width: 14rem; max-height: 16rem; overflow-y: auto;
  background: #0f172a; border: 1px solid #334155; border-radius: .5rem;
  box-shadow: 0 12px 32px rgba(0,0,0,.5); padding: .25rem;
}
.slash-item { display: flex; align-items: baseline; gap: .5rem; width: 100%;
  padding: .4rem .6rem; border-radius: .375rem; text-align: left; font-size: .875rem; color: #cbd5e1; }
.slash-item .icon { width: 1.25rem; text-align: center; color: #818cf8; }
.slash-item.selected, .slash-item:hover { background: #1e293b; color: #f1f5f9; }


/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 23, .7); backdrop-filter: blur(4px); padding: 1rem;
}
.modal-card {
  width: 100%; max-width: 26rem; background: #0f172a; border: 1px solid #334155;
  border-radius: .75rem; padding: 1.5rem; box-shadow: 0 24px 64px rgba(0,0,0,.6);
  animation: modal-in .14s ease-out;
}
@keyframes modal-in { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-input {
  width: 100%; border-radius: .5rem; border: 1px solid #334155; background: #020617;
  padding: .55rem .75rem; font-size: .9rem; color: #e2e8f0; outline: none;
}
.modal-input:focus { border-color: #6366f1; }

/* ---------- Toasts ---------- */
.toast {
  pointer-events: auto; border-radius: .5rem; padding: .6rem 1rem; font-size: .85rem;
  background: #1e293b; border: 1px solid #334155; color: #e2e8f0;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: modal-in .15s ease-out;
}
.toast.error { border-color: #b91c1c; background: #450a0a; color: #fecaca; }
.toast.success { border-color: #15803d; background: #052e16; color: #bbf7d0; }

/* ---------- Sidebar note items ---------- */
.note-item { display: flex; align-items: center; gap: .5rem; border-radius: .5rem; padding: .45rem .6rem;
  cursor: pointer; font-size: .875rem; color: #94a3b8; }
.note-item:hover { background: #1e293b; color: #e2e8f0; }
.note-item.active { background: rgba(99, 102, 241, .18); color: #e0e7ff; }
.note-item .note-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item .note-date { font-size: .7rem; color: #475569; }
.note-item .note-delete { visibility: hidden; border-radius: .25rem; padding: 0 .3rem; color: #64748b; }
.note-item:hover .note-delete { visibility: visible; }
.note-item .note-delete:hover { color: #f87171; background: rgba(248, 113, 113, .15); }
