/* ── Notes Page ────────────────────────────────────────────── */

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
}

.notes-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.notes-search {
  padding: 0 16px 8px;
}

.notes-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
}

.notes-search input:focus {
  outline: none;
  border-color: var(--ws-accent);
}

/* ── Category tabs ── */
.notes-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.notes-cat-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.notes-cat-btn.active,
.notes-cat-btn:hover {
  background: var(--ws-accent);
  color: var(--ws-bg-base);
  border-color: var(--ws-accent);
}

.notes-cat-add {
  border-style: dashed;
}

/* ── Note cards ── */
.notes-list {
  padding: 0 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notes-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.notes-card:hover {
  border-color: var(--ws-accent-muted);
  background: var(--ws-bg-elevated);
}

.notes-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.notes-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.notes-cat-badge {
  background: var(--ws-bg-elevated);
  color: var(--ws-accent);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.notes-card-preview {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notes-card-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--muted2, var(--muted));
}

.notes-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
  font-size: 13px;
}

/* ── Editor header ── */
.notes-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.notes-back-btn {
  background: none;
  border: none;
  color: var(--ws-accent);
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 4px 0;
}

.notes-editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Delete confirmation banner ── */
.notes-del-confirm {
  background: var(--ws-danger-bg);
  border-bottom: 1px solid var(--ws-danger-border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ws-danger-text);
  flex-wrap: wrap;
}

/* ── Editor body ── */
.notes-editor-body {
  padding: 12px 16px 0;
}

.notes-title-input {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-body);
  padding: 6px 0 10px;
  margin-bottom: 8px;
  outline: none;
}

.notes-editor-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.notes-cat-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-body);
}

.notes-meta-date {
  font-size: 11px;
  color: var(--muted);
}

/* ── Markdown toolbar ── */
.notes-md-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.notes-md-toolbar button {
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-body);
  cursor: pointer;
}

.notes-md-toolbar button:hover {
  border-color: var(--ws-accent);
  color: var(--ws-accent);
}

/* ── Textarea + Preview ── */
.notes-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 300px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: 'Courier New', monospace;
  padding: 12px;
  resize: vertical;
  line-height: 1.6;
}

.notes-textarea:focus {
  outline: none;
  border-color: var(--ws-accent);
}

.notes-preview {
  min-height: 300px;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.notes-preview h1, .notes-preview h2, .notes-preview h3 {
  color: var(--text);
  margin: 12px 0 6px;
}

.notes-preview code {
  background: var(--bg3, var(--bg2));
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.notes-preview ul, .notes-preview ol {
  padding-left: 20px;
}

.notes-preview a {
  color: var(--ws-accent);
}

/* ── Attachments ── */
.notes-attachments {
  padding: 14px 16px 80px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.notes-att-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notes-upload-btn {
  cursor: pointer;
}

.notes-att-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notes-att-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
}

.notes-att-name {
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notes-att-name:hover { color: var(--ws-accent); }

.notes-att-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0 0 0 8px;
  flex-shrink: 0;
}

.notes-att-del:hover { color: var(--ws-danger); }

/* ── Manage categories modal ── */
.notes-cat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--ws-black-rgb), .6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.notes-cat-modal-box {
  background: var(--bg-card, var(--bg2));
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.notes-cat-modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.notes-cat-modal-hd button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.notes-cat-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notes-cat-modal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
