/* Saelyx · app web de NOTAS (§B) · maqueta lista + editor, sobre el lenguaje
 * visual común (sx.css + ui.css, importados desde index.html). Este fichero
 * SOLO tiene la maqueta propia de esta pantalla -- nada de tokens ni de
 * componentes compartidos (`.pill-sx`, `.app-header`, `.orb-wrap`), que ya
 * vienen de sx.css/ui.css. Mismo criterio que dejó `chat.css` para el hilo.
 */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }

.notes-shell {
  display: flex;
  /* --app-header-h (ui.css) refleja la altura REAL de .app-header en vez de
     un 64px fijo -- a ≤560px la cabecera pasa a dos filas y crece bastante
     más que eso. */
  height: calc(100vh - var(--app-header-h));
  max-width: 1080px; margin: 0 auto;
  border-top: 1px solid var(--stroke-hairline);
}

/* ── Panel izquierdo · lista ── */
.notes-list-pane {
  width: 320px; flex: 0 0 320px; min-width: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--stroke-hairline);
}
.notes-list-head { padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.notes-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev-1); border-radius: 999px;
  padding: 8px 14px; box-shadow: inset 0 0 0 1px var(--stroke-hairline);
}
.notes-search svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--text-tertiary); }
.notes-search input {
  border: none; background: transparent; outline: none; flex: 1;
  color: var(--text-primary); font: 14px/1.4 var(--font-sans, inherit);
}
.notes-search input::placeholder { color: var(--text-disabled); }
.notes-new-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; border-radius: 999px; border: none; cursor: pointer;
  color: #fff; font-weight: 600; font-size: 13.5px;
}
.notes-new-btn svg { width: 15px; height: 15px; }

.notes-rows { flex: 1; overflow-y: auto; }
.notes-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 11px 16px; border: none; background: transparent;
  border-bottom: 1px solid var(--stroke-hairline);
  color: inherit; font: inherit;
}
.notes-row:hover { background: var(--bg-elev-1); }
.notes-row.active { background: var(--accent-glow-soft); box-shadow: inset 2px 0 0 var(--accent); }
.notes-row .row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.notes-row .row-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0;
}
.notes-row .row-date { font-size: 11px; color: var(--text-tertiary); flex: 0 0 auto; }
.notes-row .row-preview {
  margin-top: 2px; font-size: 12.5px; color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notes-empty-list {
  margin: auto; text-align: center; color: var(--text-tertiary);
  font-size: 13px; padding: 40px 20px; line-height: 1.5;
}

/* ── Panel derecho · editor ── */
.notes-editor-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notes-editor-empty {
  margin: auto; text-align: center; max-width: 300px; color: var(--text-tertiary);
  display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 13px; line-height: 1.5;
}
.notes-editor-empty .orb-wrap { width: 44px; }
.notes-editor {
  display: flex; flex-direction: column; height: 100%; padding: 22px 30px;
}
.notes-editor-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px;
  min-height: 22px;
}
.notes-editor-saved { font-size: 12px; color: var(--text-tertiary); }
.notes-editor-delete {
  background: none; border: none; cursor: pointer; color: var(--text-tertiary);
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 6px 8px; border-radius: 8px;
}
.notes-editor-delete:hover { color: #ff9b9b; background: rgba(255,107,107,0.08); }
.notes-editor-delete svg { width: 14px; height: 14px; }
.notes-title-input {
  border: none; background: transparent; outline: none; width: 100%;
  color: var(--text-primary); font: 600 21px/1.3 var(--font-sans, inherit);
  margin-bottom: 10px;
}
.notes-title-input::placeholder { color: var(--text-disabled); }
.notes-body-input {
  border: none; background: transparent; outline: none; resize: none;
  flex: 1; width: 100%; color: var(--text-secondary);
  font: 15px/1.65 var(--font-sans, inherit);
}
.notes-body-input::placeholder { color: var(--text-disabled); }

/* ── Deshacer borrado (snackbar) ── */
.notes-undo {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-elev-3); color: var(--text-primary);
  border-radius: 999px; padding: 10px 10px 10px 18px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; z-index: 50;
}
.notes-undo button {
  background: none; border: none; color: var(--accent-bright); font-weight: 600;
  cursor: pointer; padding: 6px 12px; border-radius: 999px; font-size: 13.5px;
}
.notes-undo button:hover { background: var(--accent-glow-soft); }
.notes-undo[hidden] { display: none; }

/* ══════════════ MÓVIL (≤720px) · una sola columna, lista ↔ editor ══════════ */
@media (max-width: 720px) {
  /* .app-header sigue en flujo normal (no está fixed): un 100dvh a secas no
     restaba su altura y la lista quedaba con ~66-103px por debajo del
     borde de la pantalla (más aún con la cabecera en dos filas, ≤560px). */
  .notes-shell { height: calc(100dvh - var(--app-header-h)); }
  .notes-list-pane { width: 100%; flex-basis: 100%; border-right: none; }
  .notes-editor-pane { position: fixed; inset: var(--app-header-h) 0 0; background: var(--bg-base); display: none; }
  .notes-shell.show-editor .notes-list-pane { display: none; }
  .notes-shell.show-editor .notes-editor-pane { display: flex; }
  .notes-editor-back {
    display: inline-flex; align-items: center; gap: 6px; background: none; border: none;
    color: var(--text-secondary); font-size: 13px; cursor: pointer; padding: 4px 0;
  }
  .notes-editor-back svg { width: 16px; height: 16px; }
  .notes-editor { padding: 16px 18px; }
}
@media (min-width: 721px) {
  .notes-editor-back { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .notes-row, .notes-new-btn, .notes-editor-delete { transition: none !important; }
}
