/* import.css — Legacy OneNote → SharePoint import tool (admin) */

/* Use the full page width (left-aligned), not the centered 900px tab-panel column. */
#panel-import { max-width: none; margin: 0; padding: 1rem 1.25rem; }

.import-intro h3 { margin: 0 0 .25rem; }
.import-intro p  { margin: 0 0 1rem; }

.import-status {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
}
.import-error { color: var(--danger); }

/* ── Source pickers ─────────────────────────────────────────── */
.import-pickers {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: .75rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.import-pickers label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}
.import-pickers select {
  min-width: 220px;
  padding: .4rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
}

.import-type-badge {
  align-self: center;
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: #e0e7ff;
  color: var(--primary);
}
.import-type-badge.import-type-unsupported { background: #fef3c7; color: var(--warning); }

/* Fluency page-level controls (one program + chart type per page) */
.import-flu-head {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .6rem .75rem;
  margin-bottom: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.import-flu-head label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}
.import-flu-head select {
  min-width: 180px;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
}
.import-flu-head .import-hint { align-self: center; }
.import-dim { opacity: .4; }

/* ── Stacked verify layout (OneNote page on top, rows beneath) ─ */
.import-verify {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.import-source-pane {
  max-height: 55vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.import-pane-hdr,
.import-rows-hdr {
  font-weight: 700;
  font-size: .85rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.import-source-content {
  padding: .75rem;
  font-size: .85rem;
  overflow-x: auto;
}
.import-source-content table { border-collapse: collapse; }
.import-source-content td,
.import-source-content th { border: 1px solid var(--border); padding: 2px 4px; }
.import-source-content img { max-width: 100%; height: auto; }

/* ── Rows pane ──────────────────────────────────────────────── */
.import-rows-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.import-summary {
  padding: .5rem .75rem;
  background: #ecfdf5;
  border: 1px solid var(--success);
  border-radius: var(--radius);
  font-size: .85rem;
  margin-bottom: .75rem;
}

/* ── Planning / Behaviour notes (latest-wins, overwrite) ────── */
.import-notes {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: .6rem .75rem;
  margin-bottom: 1rem;
}
.import-notes-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: .5rem;
}
.import-notes-sub { font-weight: 400; color: var(--muted); font-size: .72rem; }
.import-notes-status { font-size: .8rem; color: var(--muted); min-height: 1em; margin-bottom: .4rem; }
.import-note { margin-bottom: .6rem; }
.import-note-top {
  display: flex; align-items: center; gap: .4rem;
  font-size: .78rem; font-weight: 600; color: var(--muted);
  margin-bottom: .25rem; cursor: pointer;
}
.import-note-edit {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .4rem .5rem;
  min-height: 2.5rem;
  max-height: 220px;
  overflow: auto;
  font-size: .85rem;
  background: #fff;
}
.import-note-edit:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.import-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: .6rem .75rem;
  margin-bottom: .6rem;
  box-shadow: var(--shadow);
}
.import-row.import-dup  { border-left: 4px solid var(--warning); }
.import-row.import-done { opacity: .6; }
.import-row.import-flash,
.gbl-att.import-flash { animation: importFlash .8s ease; }
@keyframes importFlash {
  from { background: #fef9c3; }   /* brief yellow pulse when auto-updated */
  to   { background: var(--surface); }
}

.import-row-top {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
}
.import-include { font-weight: 700; font-size: .8rem; cursor: pointer; }
.import-row-label { color: var(--muted); font-size: .8rem; }
.import-row-status { margin-left: auto; font-size: .8rem; color: var(--muted); }

.import-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 999px;
}
.import-badge-dup { background: #fef3c7; color: var(--warning); }

.import-flag {
  display: inline-block;
  width: 14px; height: 14px;
  line-height: 14px;
  text-align: center;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  cursor: help;
}

/* Field grid inside a row */
.import-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .4rem .6rem;
}
.import-fields label {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted);
}
.import-fields input,
.import-fields select,
.import-fields textarea {
  padding: .3rem .4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 400;
  color: var(--text);
}
.import-carried {
  display: inline-block;
  width: 14px; height: 14px;
  line-height: 14px;
  text-align: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  cursor: help;
}

.import-hint {
  font-weight: 400;
  font-size: .65rem;
  color: var(--muted);
  font-style: italic;
}

.import-fields .if-grow { grid-column: span 2; }
.import-fields .if-full { grid-column: 1 / -1; }
.import-fields .if-chk  { align-self: center; }
.import-fields .if-chk input { width: auto; }
.import-fields textarea { resize: vertical; }

/* Binder-review mode: the line is a reviewer's note, not a session — the card
   collapses to Date + Reviewer + Review note and imports into Binder Review. */
.import-binder { font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.import-fields .if-br { display: none; }
.import-row.import-br-mode { border-left: 4px solid var(--primary); }
.import-row.import-br-mode .import-fields label:not(.if-br):not(.if-date) { display: none; }
.import-row.import-br-mode .import-fields .if-br { display: flex; }
.import-row.import-br-mode.import-dup { border-left-color: var(--warning); }

/* ── Fluency table-entry layout (one row per line, fills width) ── */
.flu-table {
  display: grid;
  grid-template-columns:
    auto                  /* select (checkbox + #) */
    minmax(152px, 168px)  /* date */
    minmax(110px, 1.3fr)  /* lesson */
    minmax(150px, 2.1fr)  /* warm-up */
    minmax(82px, .8fr)    /* value */
    minmax(70px, .6fr)    /* errors */
    minmax(70px, .6fr)    /* goal */
    minmax(76px, .6fr)    /* attempt */
    minmax(130px, 2fr)    /* comment */
    auto;                 /* status */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.flu-thead, .flu-trow { display: contents; }

.flu-cell {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: .3rem .45rem;
  border-bottom: 1px solid var(--border);
}
.flu-trow:last-child .flu-cell { border-bottom: 0; }

.flu-th {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--muted);
  background: var(--bg);
}

.flu-cell input:not([type="checkbox"]) {
  width: 100%;
  min-width: 0;
  padding: .3rem .4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
  color: var(--text);
  background: #fff;
}
.flu-c-sel { justify-content: center; gap: 6px; }
.flu-c-sel input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.flu-rownum { font-size: .7rem; color: var(--muted); }
.flu-c-status {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: .78rem;
  color: var(--muted);
}

/* Row state — applied to cells since .flu-trow is display:contents (no box) */
.flu-cell.import-dim { opacity: .4; }
.flu-table .import-row.import-done > .flu-cell { opacity: .55; }
.flu-table .import-row.import-dup  > .flu-cell { background: #fffbeb; }
.flu-table .import-row.import-dup  > .flu-c-sel { box-shadow: inset 3px 0 0 var(--warning); }
.flu-table .import-row.import-flash > .flu-cell { animation: importFlash .8s ease; }

/* ── Goodbye List import (one card per skill, attempts stacked) ── */
.gbl-skill .gbl-title {
  flex: 1;
  min-width: 0;
  padding: .3rem .45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}
.gbl-skill-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: .5rem 0 .6rem;
}
.gbl-skill-meta .if-num {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted);
}
.gbl-skill-meta input {
  width: 64px;
  padding: .3rem .4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
}
.gbl-att-count { font-size: .75rem; color: var(--muted); }

.gbl-atts { display: flex; flex-direction: column; gap: .3rem; }
.gbl-att {
  display: grid;
  grid-template-columns: 160px 130px 1fr;
  gap: .5rem;
  align-items: center;
}
.gbl-att input,
.gbl-att select {
  width: 100%;
  padding: .3rem .4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
  color: var(--text);
  background: #fff;
}
.gbl-att-hdr {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--muted);
}
.gbl-att-empty { font-size: .8rem; color: var(--muted); font-style: italic; }
.gbl-att-bad { border-color: var(--warning); }

/* ── Notes import (whole page → one Session Note) ─────────────── */
.import-notes-head { align-items: center; }
.import-notes-head label { flex-direction: row; align-items: center; gap: .4rem; }
.import-notes-redo { cursor: pointer; font-size: .8rem; color: var(--warning); font-weight: 600; }
.import-notes-redo input { width: 16px; height: 16px; accent-color: var(--warning); }
.import-notes-datewarn { color: var(--warning); font-style: normal; font-weight: 600; }
.import-notes-help { margin: 0 0 .5rem; font-size: .78rem; }

/* The doc is the scroller (not the editor) so the margin gutter scrolls with the text and
   the split marker can be positioned against a single coordinate system. */
.import-notes-doc {
  position: relative;
  display: grid;
  grid-template-columns: 2.1rem 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  min-height: 200px;
  max-height: 60vh;
  overflow: auto;
}

.import-notes-gutter {
  border-right: 1px dashed var(--border);
  background: var(--bg);
  cursor: crosshair;
}
.import-notes-gutter:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }

.import-notes-marker {
  position: absolute;
  left: 0; right: 0;
  border-top: 2px solid var(--primary);
  pointer-events: none;
  z-index: 2;
}
.import-notes-marker span {
  position: absolute;
  top: -.7rem; left: .2rem;
  white-space: nowrap;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  padding: .1rem .35rem;
  border-radius: 3px;
}

.import-notes-editor {
  padding: .75rem 1rem;
  font-size: .9rem;
  line-height: 1.5;
}
.import-notes-editor:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.import-notes-editor img { max-width: 100%; height: auto; border-radius: 6px; margin: .35rem 0; }

/* Split divider — a non-editable marker living in the editor flow. */
.import-note-split {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: .6rem 0;
  padding: .25rem .4rem;
  border-top: 2px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  border-radius: 0 0 4px 4px;
  user-select: none;
}
.import-note-split-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primary);
}
.import-note-split-date { font-size: .78rem; padding: .1rem .25rem; }
.import-note-split-warn { font-size: .7rem; color: var(--warning); font-weight: 600; }
.import-note-split-redo {
  margin-left: auto;
  border: 1px solid var(--warning);
  background: none;
  border-radius: 999px;
  cursor: pointer;
  color: var(--warning);
  font-size: .68rem;
  font-weight: 700;
  padding: .1rem .5rem;
}
.import-note-split-redo.is-on { background: var(--warning); color: #fff; }
/* :not(.hidden) — a display:none sibling still matches "+", and the ✕ must keep its
   margin-left:auto whenever the re-import pill isn't actually taking up space. */
.import-note-split-redo:not(.hidden) + .import-note-split-del { margin-left: 0; }

.import-note-split-del {
  margin-left: auto;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1;
  padding: .15rem .3rem;
}
.import-note-split-del:hover { color: var(--danger); }
.import-note-split-nodate { border-top-color: var(--warning); }
.import-note-split-nodate .import-note-split-date { border: 1px solid var(--warning); }

/* Written segments stay visible but inert — they're skipped on a re-run. */
.import-note-split-done {
  border-top-color: var(--success);
  background: #ecfdf5;
  opacity: .75;
}
.import-note-split-done .import-note-split-label { color: var(--success); }
.import-note-split-done .import-note-split-warn  { color: var(--success); }
.import-note-split-done .import-note-split-del   { display: none; }

/* Imported on an earlier pass: skipped by default, redoable via the pill. */
.import-note-split-prior { border-top-color: var(--muted); }
.import-note-split-prior .import-note-split-label { color: var(--muted); }
.import-note-split-prior .import-note-split-warn  { color: var(--muted); font-weight: 500; }

.import-notes-results {
  margin-top: .4rem;
  font-size: .8rem;
  line-height: 1.6;
}

.import-notes-splitinfo { font-size: .78rem; color: var(--muted); margin-bottom: .4rem; }
.import-note-split-pending { color: var(--warning); font-weight: 600; }
