/* My notes — list grid, note view chrome, mode toggle, and the Key highlights
   panel. Token-driven throughout, so light and dark both come from css/base.css. */

/* ---- list: card grid ---- */
.note-filters { margin: var(--sp-0) 0 var(--sp-3); }

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
  gap: var(--sp-3);
}

button.card.note-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3);
  text-align: left;
  cursor: pointer;
  color: var(--text);        /* buttons don't inherit — dark-mode readability */
  font: inherit;
}
.note-card:hover { border-color: var(--accent); }

.note-card-top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.note-card-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: var(--fs-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.note-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.note-card-meta .spacer { flex: 1; }
/* The date stays on one line at the row's end, so every card is the same
   height (issue #16 F-71). */
.note-card-date { flex: none; margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.note-card-meta .badge:not(.badge-blue) {
  background: var(--surface-2);
  color: var(--text-muted);
}
.note-card-mode { font-size: var(--fs-xs); }

/* ---- right-click menu on a note card ---- */
.note-menu {
  position: fixed;
  z-index: 60;
  min-width: 160px;
  max-width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--sp-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(16, 24, 40, 0.15);
}
.note-menu-title {
  padding: var(--sp-1) var(--sp-3) var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.note-menu button {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text);
  background: none;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
/* :not(.armed) so the hover fill can't outrank the armed "Delete?" state. */
.note-menu button:not(.armed):hover { background: var(--surface-2); }
/* Element-qualified so it outranks `.note-menu button`'s own color. */
.note-menu button.note-menu-del { color: var(--danger); }

/* ---- ＋ New note: inline creation card ---- */
.note-create {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin: var(--sp-0) 0 var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.note-create-title {
  flex: 1;
  min-width: 200px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.note-create-title:focus {
  outline: none;
  border-color: var(--accent);
}
.note-create-course {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.note-create-type {
  display: inline-flex;
  flex: none;
  gap: var(--sp-2);
}
.note-create-actions {
  display: flex;
  gap: var(--sp-2);
  margin-left: auto;
}

/* ---- note view ---- */
.note-view-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin: var(--sp-0) 0 var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.note-view-bar .note-title-input {
  flex: 1;
  min-width: 160px;
  padding: var(--sp-2);
  font: inherit;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  /* The text lines up with the column; the hover and focus frame hangs into
     the gutter instead of pushing the title 9px in (issue #16 F-96). */
  margin-left: calc(-1 * (var(--sp-2) + 1px));
}
.note-view-bar .note-title-input:hover,
.note-view-bar .note-title-input:focus {
  border-color: var(--border);
  background: var(--surface);
  outline: none;
}
.note-course-select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.note-save {
  min-width: 60px;
  text-align: right;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
}
/* Armed "Delete?" reads the same in the note view bar and the card menu. */
.note-del.armed,
.note-menu-del.armed {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

/* Text | Whiteboard segmented toggle */
.mode-toggle {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.mode-toggle button {
  border: 0;
  background: none;
  padding: var(--sp-1) var(--sp-3);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.mode-toggle button + button { border-left: 1px solid var(--border); }
.mode-toggle button:hover { color: var(--text); }
.mode-toggle button.active {
  background: var(--accent);
  color: var(--on-accent);
}

/* Where Track E / Track W mount. The text page is limitless (grows with the
   document, page scrolls); the board keeps a bounded viewport and pans inside. */
.note-mode-host {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.note-text-host { min-height: 55vh; }
.note-board-host {
  position: relative;
  height: 72vh;
  overflow: hidden;
}

/* ---- Lecture mode: course material beside the note ----
   Left pane is the deck the teacher is presenting, right pane is the same
   editor host as usual, just moved into the split. Both panes scroll inside
   themselves so the page itself never grows a second scrollbar. */
.note-lecture {
  display: grid;
  grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
  gap: var(--sp-3);
  height: calc(100vh - 230px);
  min-height: 420px;
}

.lecture-doc {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.lecture-doc-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.lecture-select {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.lecture-doc-n {
  flex: none;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.lecture-doc-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface-2);
}
.lecture-embed {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.lecture-img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}
.lecture-text {
  white-space: pre-wrap;
  padding: var(--sp-3);
  font-size: var(--fs-sm);
  line-height: var(--lh);
  color: var(--text);
}
.lecture-empty {
  padding: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Right half: the recording strip sits above the editor host, which takes the
   rest of the height and scrolls on its own. */
.lecture-edit {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
  min-height: 0;
}
.lecture-rec {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: none;
  min-height: 30px;
}
.lecture-status {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
}
.lecture-edit .note-mode-host {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.lecture-edit .note-board-host { height: auto; }

/* Split by the page column, not the viewport: beside the sidebar the two
   panes were about 280/330px with the editor toolbar on three rows, so stack
   until each pane gets about 400px (issue #16 item 4). The column is never
   wider than 879px below a 900px viewport, so this also covers the old
   max-width 900px viewport rule it replaces. */
@container main (max-width: 879px) {
  .note-lecture {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 45vh) minmax(280px, 1fr);
    height: auto;
  }
}

/* ---- Key highlights panel ---- */
.note-summary { margin-bottom: var(--sp-3); }
.note-summary-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
  font-weight: 600;
  font-size: var(--fs-md);
}
.note-summary-head .spacer { flex: 1; }
.note-summary-line {
  position: relative;
  margin: var(--sp-1) 0;
  padding-left: var(--sp-4);
  font-size: var(--fs-md);
  line-height: var(--lh);
}
.note-summary-line::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: var(--accent);
}

@media (max-width: 760px) {
  .note-grid { grid-template-columns: minmax(0, 1fr); }
  .note-view-bar .note-title-input { min-width: 100%; order: -1; }
}

