/* STUDY space — revision tracker. Dark theme, white accent, per-subject hue
   carried in --sc. Mirrors the calendar/vault chrome. */

/* shared row grid: name | 4 revisions | note | 100% | delete */
.study-legend,
.chap-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px minmax(120px, 220px) 40px 32px;
  align-items: center;
  gap: 14px;
}

/* ---- topbar overall ---- */
.study-overall { display: inline-flex; align-items: baseline; gap: 6px; padding: 0 12px; }
.study-overall-num { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 15px; color: var(--text-strong); }
.study-overall-lbl { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }

/* ---- sidebar: subjects ---- */
.study-side { padding: var(--space-5); overflow-y: auto; }
.study-subjects { display: flex; flex-direction: column; gap: 4px; margin-top: var(--space-3); }
.subj {
  display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px;
  width: 100%; text-align: left; padding: 9px 11px; border-radius: var(--radius-md);
  background: transparent; border: 1px solid transparent; cursor: pointer;
  position: relative; transition: background var(--dur-fast), border-color var(--dur-fast);
}
.subj:hover { background: var(--surface-inset); }
.subj.on { background: var(--surface-inset); border-color: var(--line); }
.subj-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sc); box-shadow: 0 0 7px color-mix(in srgb, var(--sc) 70%, transparent); }
.subj-name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subj.on .subj-name { color: var(--text-strong); }
.subj-count { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-faint); }
.subj-bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--line-subtle); overflow: hidden; margin-top: 2px; }
.subj-bar-fill { display: block; height: 100%; background: var(--sc); border-radius: 2px; transition: width var(--dur-base) var(--ease-smooth); }

.subj-dot.full { box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc) 40%, transparent), 0 0 9px var(--sc); }

/* ---- main ---- */
.study-main { padding: var(--space-6) var(--space-7); overflow-y: auto; }
.study-main-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 4px; flex-wrap: wrap; }
.study-head-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.study-subj-title { font-family: var(--font-display); font-size: 22px; font-weight: var(--fw-bold); color: var(--text-strong); }
.study-subj-sub { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-faint); }

/* filter chips */
.study-filters { display: inline-flex; gap: 4px; padding: 3px; border-radius: var(--radius-md); background: var(--surface-inset); border: 1px solid var(--line); }
.sf {
  height: 28px; padding: 0 13px; border-radius: var(--radius-sm); border: none; cursor: pointer;
  background: transparent; color: var(--text-muted); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast);
}
.sf:hover { color: var(--text-strong); }
.sf.on { background: var(--accent); color: var(--text-on-accent); }

/* subject badge shown in global search results */
.chap-subj {
  flex-shrink: 0; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.04em;
  text-transform: uppercase; color: color-mix(in srgb, var(--sc) 75%, var(--text));
  background: color-mix(in srgb, var(--sc) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--sc) 35%, transparent);
  border-radius: 5px; padding: 2px 7px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chap-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.study-legend { padding: 0 12px 8px; margin-top: 18px; border-bottom: 1px solid var(--line-subtle); }
.study-legend span { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.study-legend .lg-revs { text-align: center; }
.study-legend .lg-done { text-align: center; }

.study-rows { display: flex; flex-direction: column; }
.chap-row {
  padding: 11px 12px; border-bottom: 1px solid var(--line-subtle);
  transition: background var(--dur-fast);
}
.chap-row:hover { background: var(--surface-subtle); }
.chap-row:hover .chap-del { opacity: 1; }
.chap-row.done { background: color-mix(in srgb, var(--positive) 6%, transparent); }
.chap-row.done .chap-name { color: var(--text-muted); }

.chap-name { font-size: var(--fs-sm); color: var(--text); min-width: 0; display: flex; align-items: center; gap: 8px; }
.chap-tag { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; flex-shrink: 0; }

.chap-revs { display: flex; gap: 8px; justify-content: center; }
.rev {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: var(--fw-semibold);
  color: var(--text-faint); background: transparent; border: 1.5px solid var(--line);
  cursor: pointer; transition: all var(--dur-fast) var(--ease-smooth);
}
.rev:hover { border-color: var(--sc); color: var(--text); }
.rev.on { background: var(--sc); border-color: var(--sc); color: var(--ink-950); box-shadow: 0 0 10px color-mix(in srgb, var(--sc) 45%, transparent); }

.chap-note {
  height: 30px; border-radius: var(--radius-sm); padding: 0 10px;
  background: var(--surface-inset); border: 1px solid var(--line); color: var(--text);
  font-size: var(--fs-xs); width: 100%; transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.chap-note::placeholder { color: var(--text-faint); }
.chap-note:focus { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-ring); }

.chap-done {
  width: 30px; height: 30px; border-radius: 50%; justify-self: center;
  display: grid; place-items: center; cursor: pointer;
  color: var(--text-faint); background: transparent; border: 1.5px solid var(--line);
  transition: all var(--dur-fast) var(--ease-smooth);
}
.chap-done:hover { border-color: var(--positive); color: var(--positive); }
.chap-done.on { background: var(--positive); border-color: var(--positive); color: var(--ink-950); box-shadow: 0 0 12px color-mix(in srgb, var(--positive) 50%, transparent); }

.chap-del {
  width: 28px; height: 28px; border-radius: var(--radius-sm); justify-self: center;
  display: grid; place-items: center; cursor: pointer; opacity: 0;
  color: var(--text-faint); background: transparent; border: none;
  transition: opacity var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.chap-del:hover { color: var(--critical); background: var(--critical-soft); }

.study-empty { padding: 40px 12px; text-align: center; color: var(--text-faint); font-size: var(--fs-sm); }

/* ---- add chapter ---- */
.chap-add-btn {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 16px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-md);
  background: transparent; border: 1px dashed var(--line); color: var(--text-muted);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); cursor: pointer;
  transition: all var(--dur-fast) var(--ease-smooth);
}
.chap-add-btn:hover { border-color: var(--accent-ring); color: var(--text-strong); border-style: solid; }
.chap-add { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.chap-add-input {
  flex: 1; max-width: 360px; height: 38px; border-radius: var(--radius-md); padding: 0 13px;
  background: var(--surface-inset); border: 1px solid var(--line); color: var(--text); font-size: var(--fs-sm);
}
.chap-add-input:focus { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .study-legend { display: none; }
  .chap-row { grid-template-columns: 1fr auto; grid-template-areas: 'name done' 'revs del' 'note note'; gap: 8px 12px; }
  .chap-name { grid-area: name; }
  .chap-revs { grid-area: revs; justify-content: flex-start; }
  .chap-note { grid-area: note; }
  .chap-done { grid-area: done; justify-self: end; }
  .chap-del { grid-area: del; opacity: 1; justify-self: start; }
}
