/* Notes page (daily.html). Colours follow the site theme: cz-dark #1e293b, cz-accent #334155. */

/* ── Buttons & inputs ─────────────────────────────── */
.notes-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: .75rem;
  font-size: .875rem; font-weight: 500; line-height: 1.25rem;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s;
  user-select: none;
}
.notes-btn:disabled { opacity: .55; cursor: not-allowed; }
.notes-btn-primary { background: #1e293b; color: #fff; }
.notes-btn-primary:hover:not(:disabled) { background: #334155; }
.notes-btn-ghost { background: #fff; color: #334155; border: 1px solid #e5e7eb; }
.notes-btn-ghost:hover:not(:disabled) { border-color: #cbd5e1; color: #1e293b; background: #f8fafc; }
.notes-btn-ghost.is-active { background: #f1f5f9; border-color: #cbd5e1; color: #1e293b; }
.notes-btn-danger { color: #b91c1c; }
.notes-btn-danger:hover:not(:disabled) { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.notes-btn-sm { padding: .3rem .7rem; font-size: .8rem; border-radius: .6rem; }

.notes-input {
  width: 100%; padding: .65rem .85rem; border-radius: .75rem;
  border: 1px solid #e5e7eb; background: #fff; color: #1a1a1a;
  font-size: .95rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.notes-input:focus { border-color: #334155; box-shadow: 0 0 0 3px rgba(51, 65, 85, .12); }

/* ── Day groups ───────────────────────────────────── */
.notes-day {
  background: #fff; border: 1px solid #f1f5f9; border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  margin-bottom: 1rem; overflow: hidden;
}
.notes-day > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; transition: background-color .15s;
}
.notes-day > summary::-webkit-details-marker { display: none; }
.notes-day > summary:hover { background: #f8fafc; }
.notes-day-title { font-weight: 700; color: #1e293b; font-size: 1.05rem; }
.notes-day-count {
  font-size: .75rem; font-weight: 600; color: #64748b;
  background: #f1f5f9; padding: .15rem .6rem; border-radius: 999px; margin-left: .6rem;
}
.notes-chevron { width: 1.1rem; height: 1.1rem; color: #94a3b8; transition: transform .2s; flex-shrink: 0; }
.notes-day[open] .notes-chevron { transform: rotate(180deg); }
.notes-day-body { border-top: 1px solid #f1f5f9; }

/* Each note inside a day is its own collapsible row (newest first). */
.notes-day-body { padding: .75rem; display: flex; flex-direction: column; gap: .5rem; background: #fcfcfd; }
.notes-item {
  background: #fff; border: 1px solid #eef2f6; border-radius: .8rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  transition: border-color .15s, box-shadow .15s;
}
.notes-item:hover { border-color: #e2e8f0; }
.notes-item[open] { border-color: #e2e8f0; box-shadow: 0 2px 10px rgba(15, 23, 42, .06); }
.notes-item-summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: .55rem;
  padding: .7rem 1rem; border-radius: .8rem; transition: background-color .15s;
}
.notes-item-summary::-webkit-details-marker { display: none; }
.notes-item-summary:hover { background: #f8fafc; }
.notes-item-summary:focus-visible { outline: 2px solid #334155; outline-offset: 2px; }
.notes-item-chevron { width: .95rem; height: .95rem; color: #94a3b8; transition: transform .2s; flex-shrink: 0; }
.notes-item[open] .notes-item-chevron { transform: rotate(90deg); color: #334155; }
.notes-item-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .95rem; font-weight: 600; color: #1e293b; font-variant-numeric: tabular-nums;
}
.notes-item-edited {
  font-size: .7rem; font-weight: 600; color: #64748b; line-height: 1;
  background: #f1f5f9; border: 1px solid #e2e8f0; padding: .2rem .45rem; border-radius: 999px;
}
.notes-item-body { padding: .25rem 1rem 1rem 2.5rem; border-top: 1px solid #f1f5f9; }
.notes-item-body .notes-meta { margin-top: .6rem; }
@media (max-width: 767px) {
  .notes-day-body { padding: .5rem; }
  .notes-item-body { padding-left: 1rem; }
}
.notes-meta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  font-size: .78rem; color: #94a3b8; margin-bottom: .6rem;
}
.notes-actions { display: flex; gap: .4rem; }

.notes-empty {
  text-align: center; padding: 3rem 1rem; color: #94a3b8;
  background: #fff; border: 1px dashed #e5e7eb; border-radius: 1rem;
}

/* ── Rendered markdown ────────────────────────────── */
.notes-md { color: #1f2937; line-height: 1.75; font-size: .975rem; overflow-wrap: anywhere; }
.notes-md > :first-child { margin-top: 0; }
.notes-md > :last-child { margin-bottom: 0; }
.notes-md h1, .notes-md h2, .notes-md h3, .notes-md h4 { color: #1e293b; font-weight: 700; line-height: 1.35; margin: 1.2em 0 .5em; }
.notes-md h1 { font-size: 1.5rem; }
.notes-md h2 { font-size: 1.3rem; }
.notes-md h3 { font-size: 1.12rem; }
.notes-md h4 { font-size: 1rem; }
.notes-md p, .notes-md ul, .notes-md ol, .notes-md blockquote, .notes-md pre, .notes-md table { margin: .7em 0; }
.notes-md ul { list-style: disc; padding-left: 1.4em; }
.notes-md ol { list-style: decimal; padding-left: 1.4em; }
.notes-md li { margin: .2em 0; }
.notes-md li > input[type="checkbox"] { margin-right: .4em; }
.notes-md a { color: #334155; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: #94a3b8; }
.notes-md a:hover { color: #1e293b; text-decoration-color: #1e293b; }
.notes-md strong { color: #1e293b; font-weight: 700; }
.notes-md blockquote { border-left: 3px solid #cbd5e1; padding: .2em 0 .2em 1em; color: #64748b; }
.notes-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em;
  background: #f1f5f9; color: #334155; padding: .12em .4em; border-radius: .35rem;
}
.notes-md pre { background: #1e293b; color: #e2e8f0; padding: 1rem 1.1rem; border-radius: .75rem; overflow-x: auto; }
.notes-md pre code { background: none; color: inherit; padding: 0; font-size: .85rem; }
.notes-md img { max-width: 100%; height: auto; border-radius: .75rem; margin: .6em 0; border: 1px solid #f1f5f9; cursor: zoom-in; }
.notes-md hr { border: 0; border-top: 1px solid #e5e7eb; margin: 1.4em 0; }
.notes-md table { border-collapse: collapse; display: block; overflow-x: auto; font-size: .9rem; }
.notes-md th, .notes-md td { border: 1px solid #e5e7eb; padding: .4em .75em; }
.notes-md th { background: #f8fafc; font-weight: 600; }

/* ── Status banner ────────────────────────────────── */
.notes-status-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.notes-status-ok    { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.notes-status-info  { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }

/* ── Modals ───────────────────────────────────────── */
.notes-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.notes-overlay.hidden { display: none; }
.notes-dialog {
  width: 100%; background: #fff; border-radius: 1rem; padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.notes-editor { max-width: 72rem; max-height: calc(100vh - 2rem); display: flex; flex-direction: column; }

.notes-tabs { display: inline-flex; background: #f1f5f9; border-radius: .7rem; padding: .2rem; }
.notes-tabs button { padding: .3rem .8rem; font-size: .8rem; border-radius: .55rem; color: #64748b; font-weight: 500; }
.notes-tabs button.active { background: #fff; color: #1e293b; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }

.notes-panes { display: grid; gap: 1rem; flex: 1; min-height: 0; }
.notes-textarea {
  min-height: 50vh; resize: vertical; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem;
}
.notes-preview {
  min-height: 50vh; max-height: 65vh; overflow-y: auto;
  border: 1px solid #f1f5f9; background: #fafafa; border-radius: .75rem; padding: .9rem 1.1rem;
}
.notes-panes.view-write   .notes-preview  { display: none; }
.notes-panes.view-preview .notes-textarea { display: none; }
.notes-panes.view-split { grid-template-columns: 1fr 1fr; }
@media (max-width: 767px) {
  .notes-panes.view-split { grid-template-columns: 1fr; }
  .notes-panes.view-split .notes-textarea, .notes-panes.view-split .notes-preview { min-height: 30vh; }
  .notes-dialog { padding: 1.1rem; }
}
