/* ═══════════════════════════════════════════════
   NOTED PAD PRO v4 — editor.css
   Toolbar, content area, syntax highlight, attachments
═══════════════════════════════════════════════ */

/* ── TOOLBAR ── */
#toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  background: rgba(13,15,20,.5);
}
.toolbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }
.tb-btn {
  width: 28px; height: 28px;
  border-radius: 5px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font-body);
  transition: all var(--t-fast);
}
.tb-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tb-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  padding: 2px 5px;
  cursor: pointer;
  outline: none;
  height: 28px;
  transition: border-color var(--t-fast);
}
.tb-select:focus { border-color: var(--border-accent); }
.color-dot {
  width: 12px; height: 12px; border-radius: 50%;
  cursor: pointer; flex-shrink: 0;
  transition: transform var(--t-fast);
  border: 1.5px solid transparent;
}
.color-dot:hover  { transform: scale(1.4); }
.color-palette    { display: flex; align-items: center; gap: 3px; }

/* ── CONTENT SCROLLABLE AREA ── */
#editor-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 40px;
  position: relative;
}

/* ── CONTENT EDITABLE ── */
#editor-content {
  min-height: 260px;
  outline: none;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  caret-color: var(--accent);
  word-break: break-word;
}
#editor-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  font-style: italic;
  pointer-events: none;
}

/* Content elements */
#editor-content h1 { font-family: var(--font-display); font-size: 2em;   margin: 1em 0 .4em; }
#editor-content h2 { font-family: var(--font-display); font-size: 1.5em; margin: 1em 0 .4em; }
#editor-content h3 { font-size: 1.2em; margin: .8em 0 .3em; font-weight: 600; color: var(--accent); }
#editor-content p  { margin-bottom: .5em; }
#editor-content ul, #editor-content ol { padding-left: 1.5em; margin-bottom: .5em; }
#editor-content li { margin-bottom: .2em; }
#editor-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 15px; margin: 1em 0;
  color: var(--text-secondary);
  font-style: italic;
}
#editor-content a { color: var(--accent); text-decoration: underline; }
#editor-content hr { border: none; border-top: 1px solid var(--border); margin: 1.4em 0; }
#editor-content img { max-width: 100%; border-radius: var(--radius); margin: 7px 0; display: block; }

/* Tables */
#editor-content table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; }
#editor-content th {
  background: var(--bg-input);
  padding: 7px 11px;
  border: 1px solid var(--border);
  text-align: left; font-weight: 600;
  color: var(--accent);
}
#editor-content td { padding: 7px 11px; border: 1px solid var(--border); }
#editor-content tr:hover td { background: rgba(255,255,255,.02); }

/* Checklist */
#editor-content .cli {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 5px;
}
#editor-content .cli input {
  margin-top: 4px;
  accent-color: var(--accent);
  width: 14px; height: 14px;
  cursor: pointer; flex-shrink: 0;
}
#editor-content .cli.done span { text-decoration: line-through; color: var(--text-muted); }

/* Backlink chips inside editor */
#editor-content a.bl-chip { font-size: .88em; }

/* ── SYNTAX HIGHLIGHT ── */
#editor-content pre {
  margin: 1em 0;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
#editor-content pre code.hljs {
  font-family: var(--font-mono) !important;
  font-size: 12.5px !important;
  line-height: 1.65 !important;
  border-radius: var(--radius) !important;
  padding: 16px 18px !important;
  background: var(--bg-input) !important;
}
/* Language label */
#editor-content pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px; right: 12px;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
#editor-content code:not(.hljs) {
  font-family: var(--font-mono);
  font-size: .85em;
  background: rgba(0,0,0,.4);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--teal);
}

/* hljs token colors */
.hljs-comment,.hljs-quote    { color: #546e7a; font-style: italic; }
.hljs-keyword,.hljs-selector-tag { color: #c792ea; }
.hljs-number,.hljs-string    { color: #f07178; }
.hljs-title,.hljs-built_in   { color: #82aaff; }
.hljs-literal,.hljs-type     { color: #ffcb6b; }
.hljs-variable               { color: #eeffff; }
.hljs-function,.hljs-name    { color: #82aaff; }
.hljs-symbol,.hljs-link      { color: #c3e88d; }
.hljs-meta                   { color: #89ddff; }
.hljs-strong { font-weight: bold; }
.hljs-emphasis { font-style: italic; }

/* ── ATTACHMENTS PANEL ── */
#attach-panel {
  border-top: 1px solid var(--border);
  background: rgba(13,15,20,.55);
  flex-shrink: 0;
  max-height: 140px;
  overflow: hidden;
  transition: max-height var(--t-normal);
}
#attach-panel.collapsed { max-height: 33px; }

.attach-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 22px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.attach-header:hover { color: var(--text-primary); }
.attach-count {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 14px;
  font-size: 9.5px;
}
.attach-chevron { margin-left: auto; font-size: 9px; transition: transform var(--t-normal); }
#attach-panel.collapsed .attach-chevron { transform: rotate(180deg); }

#attach-list {
  display: flex;
  gap: 8px;
  padding: 8px 22px;
  overflow-x: auto;
  min-height: 78px;
  align-items: flex-start;
}
.attach-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t-fast);
  min-width: 64px;
  position: relative;
  flex-shrink: 0;
}
.attach-item:hover { border-color: var(--border-accent); }
.attach-icon  { font-size: 20px; }
.attach-name  { font-size: 9.5px; color: var(--text-secondary); max-width: 64px; }
.attach-size  { font-size: 9px; color: var(--text-muted); }
.attach-del {
  position: absolute; top: -5px; right: -5px;
  width: 15px; height: 15px;
  background: var(--danger); border: none; border-radius: 50%;
  color: white; font-size: 9px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
}
.attach-item:hover .attach-del { display: flex; }
.attach-upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 60px; height: 64px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 9.5px;
  font-family: var(--font-body);
  flex-shrink: 0;
}
.attach-upload-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.attach-upload-btn span  { font-size: 17px; }

/* Drag over state */
.drag-over {
  outline: 2px dashed var(--accent) !important;
  background: var(--accent-soft) !important;
}

/* ── PASSWORD STRENGTH ── */
.pwd-wrap  { position: relative; }
.pwd-wrap input { padding-right: 38px !important; }
.pwd-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 15px; transition: color var(--t-fast);
}
.pwd-eye:hover { color: var(--text-primary); }
.pwd-strength {
  height: 3px; border-radius: 2px;
  margin-top: 5px; margin-bottom: 12px;
  background: var(--border); overflow: hidden;
}
.pwd-bar { height: 100%; border-radius: 2px; transition: width .3s, background .3s; width: 0%; }
