/* ============================================================
   notes.css — Notes App: read-only viewer
   macOS Desktop Website
   ============================================================ */

/* ── 2-Pane Layout ──────────────────────────────────────────── */
#window-notes .window-content {
  display: flex;
  flex-direction: row;
  overflow: hidden;
  height: 100%;
}

/* ── Pane 1: Note List ──────────────────────────────────────── */
.notes-list-pane {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border-tertiary);
  flex-shrink: 0;
}

.notes-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.notes-list-count {
  font-size: 11px;
  color: var(--text-tertiary);
}

.notes-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 6px;
}

/* ── Section headers in list ────────────────────────────────── */
.notes-section-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  padding: 10px 14px 4px;
}

/* ── Note List Item ─────────────────────────────────────────── */
.note-list-item {
  padding: 9px 14px;
  cursor: pointer;
  border-radius: 6px;
  margin: 1px 6px;
  transition: background 0.1s ease;
}

.note-list-item:hover {
  background: var(--sidebar-hover);
}

.note-list-item.active {
  background: var(--selection-yellow, #ffd60a);
}

.note-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.note-item-date {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Delete button — visitor notes only, appears on hover */
.note-item-delete {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sidebar-hover);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  padding: 0;
  flex-shrink: 0;
}

.note-list-item {
  position: relative;
}

.note-list-item:hover .note-item-delete {
  display: flex;
}

.note-item-delete:hover {
  background: var(--color-error);
  color: var(--surface-primary);
}

/* ── Pane 2: Viewer ─────────────────────────────────────────── */
.notes-viewer-pane {
  flex: 1;
  background: var(--surface-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notes-viewer-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 18px 8px;
  border-bottom: 1px solid var(--border-secondary);
  flex-shrink: 0;
  gap: 12px;
}

.notes-viewer-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notes-viewer-date {
  font-size: 11px;
  color: var(--text-quaternary);
  flex-shrink: 0;
}

/* ── New Note button ────────────────────────────────────────── */
.notes-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 12px;
  border-top: 1px solid var(--border-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: var(--sidebar-bg);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s ease;
  min-height: 44px;
}

.notes-new-btn:hover {
  background: var(--surface-tertiary);
}

/* ── Pane 2: Viewer ─────────────────────────────────────────── */

.notes-viewer-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
  outline: none;
  caret-color: var(--accent);
}

/* Read-only state (owner notes) */
.notes-viewer-content.is-readonly {
  background: var(--surface-inset);
  cursor: default;
}

/* Editable state placeholder */
.notes-viewer-content[contenteditable="true"]:empty::before {
  content: 'Start typing…';
  color: var(--text-placeholder);
  pointer-events: none;
}

/* ── Rich text rendering ────────────────────────────────────── */

.notes-viewer-content p {
  margin: 0 0 0.85em;
}

.notes-viewer-content strong,
.notes-viewer-content b {
  font-weight: 700;
  color: var(--text-heading);
}

.notes-viewer-content em,
.notes-viewer-content i {
  font-style: italic;
}

.notes-viewer-content u {
  text-decoration: underline;
}

.notes-viewer-content h1,
.notes-viewer-content h2,
.notes-viewer-content h3 {
  font-weight: 700;
  color: var(--text-heading);
  margin: 1.1em 0 0.4em;
  line-height: 1.3;
}

.notes-viewer-content h1 { font-size: 20px; }
.notes-viewer-content h2 { font-size: 17px; }
.notes-viewer-content h3 { font-size: 15px; }

.notes-viewer-content ul,
.notes-viewer-content ol {
  margin: 0 0 0.85em 1.4em;
  padding: 0;
}

.notes-viewer-content li {
  margin-bottom: 0.3em;
}

.notes-viewer-content a {
  color: var(--accent);
  text-decoration: none;
}

.notes-viewer-content a:hover {
  text-decoration: underline;
}

.notes-viewer-content hr {
  border: none;
  border-top: 1px solid var(--border-primary);
  margin: 1.2em 0;
}

.notes-viewer-content blockquote {
  border-left: 3px solid #ffd60a;
  margin: 0.8em 0;
  padding: 0.3em 0 0.3em 1em;
  color: var(--text-secondary);
  font-style: italic;
}

.notes-viewer-content code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  background: var(--surface-secondary);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── macOS-style scrollbars ─────────────────────────────────── */
.notes-list-scroll::-webkit-scrollbar,
.notes-viewer-content::-webkit-scrollbar {
  width: 8px;
}

.notes-list-scroll::-webkit-scrollbar-track,
.notes-viewer-content::-webkit-scrollbar-track {
  background: transparent;
}

.notes-list-scroll::-webkit-scrollbar-thumb,
.notes-viewer-content::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.notes-list-scroll::-webkit-scrollbar-thumb:hover,
.notes-viewer-content::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* ── Mobile: stack panes vertically ─────────────────────────── */
@media (max-width: 600px) {
  #window-notes .window-content {
    flex-direction: column;
  }

  .notes-list-pane {
    width: 100%;
    max-height: 160px;
    border-right: none;
    border-bottom: 1px solid var(--border-primary);
  }
}


/* ── Typewriter cursor ───────────────────────────────────────── */
.notes-viewer-content.is-typing::after {
  content: '|';
  display: inline;
  animation: notes-blink 0.6s step-end infinite;
  color: var(--text-tertiary);
  font-weight: 300;
}

@keyframes notes-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .notes-viewer-content.is-typing::after {
    animation: none;
  }
}
