/*#/opt/daymark/web/app.css*/
/* --- DAYMARK MASTER CSS (cleaned + aligned + final polish) --- */

:root {
  --bg-sidebar: #f3f4f6;
  --bg-main: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --item-hover: #e5e7eb;
  --item-active: #d1d5db;
  --accent: #3b82f6;
}

[data-theme="dark"] {
  --bg-sidebar: #0f172a;
  --bg-main: #1e293b;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --border-color: #3f3f46;
  --item-hover: #3f3f46;
  --item-active: #52525b;
  --accent: #60a5fa;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- UTILS --- */
.hidden { display: none !important; }

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  border-radius: 6px;
}
.btn:hover { background: var(--item-hover); }

input, select {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px;
  border-radius: 6px;
  box-sizing: border-box;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 15px;
  box-sizing: border-box;
  overflow-x: hidden;
}

#notesList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Sidebar collapse (full hide) */
.sidebar.collapsed { display: none !important; }

/* --- sidebar minimized rail mode --- */
.sidebar.minimized {
  width: 56px !important;
  padding-left: 8px;
  padding-right: 8px;
}

.sidebar.minimized .sidebar-title,
.sidebar.minimized #auth-container,
.sidebar.minimized #notesLabel,
.sidebar.minimized #search,
.sidebar.minimized #noteSort,
.sidebar.minimized #newNote,
.sidebar.minimized #notesList {
  display: none !important;
}

.sidebar.minimized .sidebar-header {
  justify-content: center !important;
}
.sidebar.minimized .sidebar-actions {
  flex-direction: column;
  gap: 10px;
}

/* Tree Rows */
.treeRow, .treeNote {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-main);
  font-size: 14px;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
}

.treeRow:hover, .treeNote:hover { background: var(--bg-main); }
.treeRow.active, .treeNote.active { background: var(--item-active); font-weight: 600; }

.delBtn { margin-left: auto; opacity: 0; font-size: 12px; padding: 2px 6px; }
.treeNote:hover .delBtn { opacity: 1; }

/* --- MAIN EDITOR --- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  overflow: hidden;
  position: relative;
}

.editorContainer {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* tighter top padding */
.editor-top {
  padding: 10px 40px 0 40px;
}

/* Title + save status on same baseline */
.editor-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;

  /* breathing room from kebab menu */
  padding-right: 24px;
}

/* Title */
#title {
  font-size: 28px;
  font-weight: 600;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  color: var(--text-main);
  width: 100%;
}

#title:focus {
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* Save/dirty status */
#saveStatus {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1;
  margin-bottom: 2px;
  margin-right: 12px; /* nudge away from ⋮ */
}

/* --- QUILL OVERRIDES --- */
.ql-toolbar {
  border: none !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 6px 12px !important;
  margin-left: 40px;
  margin-right: 40px;
}

.ql-container {
  border: none !important;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 16px;
}

.ql-editor {
  padding: 20px 40px;
  line-height: 1.6;
}

.ql-toolbar button,
.ql-toolbar .ql-picker {
  height: 28px;
}

.ql-toolbar svg {
  transform: scale(0.9);
}

.ql-snow .ql-editor pre.ql-syntax {
  background-color: #282a36;
  color: #f8f8f2;
  border-radius: 6px;
  padding: 15px;
  font-family: monospace;
}

/* Dark mode quill fixes */
[data-theme="dark"] .blot-formatter__resize-handle { background-color: #fff; border: 1px solid #333; }
[data-theme="dark"] .blot-formatter__overlay { border: 1px solid rgba(255,255,255,0.3); }
[data-theme="dark"] .ql-toolbar .ql-stroke { stroke: #ccc; }
[data-theme="dark"] .ql-toolbar .ql-fill { fill: #ccc; }
[data-theme="dark"] .ql-toolbar .ql-picker { color: #ccc; }
[data-theme="dark"] .ql-editor { color: #e5e7eb; }
[data-theme="dark"] .ql-picker-options { background-color: var(--bg-main); color: #ccc; border-color: var(--border-color); }

#body { display: none; }

/* --- MOBILE LAYOUT --- */
@media (max-width: 768px) {
  .app {
    display: block !important;
    position: relative;
  }

  .sidebar {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: flex !important;
    z-index: 100;
  }

  .main {
    display: none !important;
  }

  .app.mobile-read .sidebar {
    display: none !important;
  }

  .app.mobile-read .main {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 200;
  }

  .delBtn { display: none !important; }

  .treeRow .label,
  .treeNote span:first-child {
    max-width: 85vw !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #auth-container.collapsed { display: none !important; }

  #auth-container {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    background: rgba(255,255,255,0.05);
    padding: 10px;
    box-sizing: border-box;
  }
}


/* between-row drop target for folder reorder */
.daymarkDropGap {
  height: 6px;
}
.daymarkDropGap.dragHover {
  outline: 2px dashed rgba(0,0,0,0.35);
  outline-offset: -2px;
}

/* --- folder drag intent zones --- */
.treeRow.folderRow.dragHover.dropBefore {
  border-top: 2px solid var(--text-muted);
}
.treeRow.folderRow.dragHover.dropAfter {
  border-bottom: 2px solid var(--text-muted);
}
.treeRow.folderRow.dragHover.dropInto {
  outline: 2px solid var(--text-muted);
  outline-offset: -2px;
}
