/*
 * dashboard.css: sign-in, the student dashboard and the "Save word" star (part of the
 * phrases add-on). Built from your theme's variables; override anything in custom.css.
 */

/* ---------- sign-in ---------- */

.student-login__password { position: relative; display: block; }
.student-login__password .login__input { width: 100%; padding-right: 70px; }
.student-login__show {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 6px 10px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
  background: none;
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
}
.student-login__hint { margin: 14px 0 0; font-size: 0.9rem; color: var(--color-muted); }
.student-login__hint[hidden] { display: none; }

/* ---------- "Save word" on word pages ---------- */

.fav-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
}
.fav-button[hidden] { display: none; }
.fav-button:hover { border-color: var(--color-accent); color: var(--color-accent); }
.fav-button.is-saved { color: var(--color-accent-contrast); background: var(--color-accent); border-color: var(--color-accent); }

/* ---------- dashboard ---------- */

.dash__header { margin-bottom: 14px; }
.dash__title { margin: 0; font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 2.4rem); line-height: 1.2; }
.dash__who { margin: 6px 0 0; font-size: 0.9rem; color: var(--color-muted); }
.dash-link {
  padding: 0;
  font: inherit;
  color: var(--color-accent);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

.dash-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 20px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs__link {
  flex: none;
  padding: 8px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-muted);
  text-decoration: none;
  border-radius: 999px;
}
.dash-tabs__link:hover { color: var(--color-text); background: var(--color-bg); }
.dash-tabs__link[aria-current="page"] { color: var(--color-accent-contrast); background: var(--color-accent); }

.dash-notice {
  margin: 0 0 18px;
  padding: 12px 16px;
  font-size: 0.92rem;
  background: var(--color-accent-soft);
  border-radius: var(--radius);
}
.dash-notice[hidden] { display: none; }
.dash-warning {
  margin: 0 0 18px;
  padding: 12px 16px;
  font-size: 0.92rem;
  background: color-mix(in srgb, #eab308 20%, var(--color-surface));
  border: 1px solid color-mix(in srgb, #eab308 45%, var(--color-border));
  border-radius: var(--radius);
}
.dash__loading, .dash-empty { color: var(--color-muted); }
.dash-empty { margin: 0; }
.dash-muted { color: var(--color-muted); font-size: 0.9rem; }
.dash-hint { margin: 0 0 14px; font-size: 0.92rem; }
.dash-tag {
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}
.dash-on { color: var(--color-accent); }
.dash-off { color: var(--color-muted); }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.dash-card {
  margin: 0 0 16px;
  padding: 18px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dash-grid > .dash-card { margin: 0; }
.dash-card > p:last-child { margin-bottom: 0; }
.dash-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dash-card__title { margin: 0 0 10px; font-family: var(--font-display); font-size: 1.2rem; }
.dash-card__head .dash-card__title { margin: 0; }
.dash-card__more { font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.dash-account summary { cursor: pointer; margin: 0; }
.dash-account[open] summary { margin-bottom: 12px; }
.dash-form { display: grid; gap: 6px; max-width: 420px; }

.dash-next__when { margin: 0; font-size: 1.35rem; font-weight: 700; }
.dash-next__class { margin: 2px 0 12px; color: var(--color-muted); }
.dash-join { min-height: 0; }

.dash-mini { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dash-mini li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.dash-chip {
  padding: 4px 12px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}
.dash-chip:hover { color: var(--color-accent); border-color: var(--color-accent); }

.dash-due { font-size: 0.85rem; font-weight: 600; color: var(--color-muted); }
.dash-due--soon { color: #b45309; }
.dash-due--late { color: #b91c1c; }

.dash-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; }
.dash-toolbar .search__input { width: auto; flex: 1 1 180px; }
.dash-sort select { font: inherit; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-small); background: var(--color-surface); color: var(--color-text); }

.dash-segment {
  display: inline-flex;
  margin: 0 0 14px;
  padding: 3px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}
.dash-segment__button {
  padding: 6px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.dash-segment__button[aria-pressed="true"] { color: var(--color-accent-contrast); background: var(--color-accent); }

.dash-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 0; padding: 0; border: 0; }
.dash-checks legend { margin-bottom: 6px; }
.dash-check { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; }
.dash-check input { width: 18px; height: 18px; accent-color: var(--color-accent); }
.dash-myclasses { border: 1px solid var(--color-border); }
.dash-myclasses legend { float: left; width: 100%; padding: 0; }

.dash-sessions { display: grid; gap: 0; margin: 0 0 10px; padding: 0; list-style: none; }
.dash-session {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
}
.dash-session:first-child { border-top: 0; padding-top: 0; }
.dash-session__when { font-weight: 600; }
.dash-session__class { grid-column: 1; }
.dash-session > :last-child:not(.dash-session__class) { grid-column: 2; grid-row: 1 / span 2; justify-self: end; }

/* homework */
.hw-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.hw {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.hw__check { flex: none; width: 24px; height: 24px; margin-top: 2px; accent-color: var(--color-accent); cursor: pointer; }
.hw__body { flex: 1; min-width: 0; }
.hw__title { display: block; margin: 0; font-size: 1.08rem; font-weight: 700; cursor: pointer; }
h3.hw__title { cursor: default; }
.hw.is-done .hw__title { text-decoration: line-through; color: var(--color-muted); }
.hw__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 0; }
.hw__details { margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.hw__links { margin: 8px 0 0; padding-left: 1.2em; }
.hw__admin { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.hw__doneby summary { cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.hw__doneby p { margin: 6px 0 0; font-size: 0.9rem; }

/* notes */
.notes { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 18px; align-items: start; }
.notes__tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.notes__tools .search__input { flex: 1 1 140px; width: auto; }
.notes__list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; max-height: 65vh; overflow-y: auto; }
.notes__item {
  display: grid;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  text-align: left;
  color: var(--color-text);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
}
.notes__item:hover { background: var(--color-surface); }
.notes__item.is-open { background: var(--color-surface); border-color: var(--color-accent); }
.notes__item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes__item-date { font-size: 0.8rem; color: var(--color-muted); }
.notes__main {
  min-height: 420px;
  padding: 16px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.notes__placeholder { margin-top: 40px; text-align: center; }
.notes__editor { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.notes__bar { display: flex; align-items: center; gap: 10px; }
.notes__back { display: none; }
.notes__status { font-size: 0.85rem; color: var(--color-muted); }
.notes__title {
  width: 100%;
  padding: 4px 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  outline: none;
}
.notes__title:focus { border-bottom-color: var(--color-accent); }
.notes__text {
  width: 100%;
  min-height: 340px;
  flex: 1;
  padding: 4px 0;
  font: inherit;
  font-size: max(16px, 1rem);
  line-height: 1.6;
  color: var(--color-text);
  background: none;
  border: 0;
  outline: none;
  resize: vertical;
}

/* favorites */
.fav-search .search__input { width: 100%; }
.fav-search__results { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.fav-search__results:empty { display: none; }
.fav-search__item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.fav-search__item > a { font-family: var(--font-display); font-weight: 600; }
.fav-search__item > :last-child { margin-left: auto; }
.fav-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fav {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
}
.fav__word { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; text-decoration: none; }
.fav__gloss { flex: 1; min-width: 0; color: var(--color-muted); }
.fav__remove {
  flex: none;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  color: var(--color-accent);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.fav__remove:hover { background: var(--color-accent-soft); }

.practice { display: grid; justify-items: center; gap: 14px; padding: 10px 0; text-align: center; }
.practice__progress { margin: 0; color: var(--color-muted); }
.practice__card {
  display: grid;
  place-content: center;
  gap: 12px;
  width: min(100%, 460px);
  min-height: 240px;
  padding: 24px;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.practice__front { font-family: var(--font-display); font-size: clamp(1.8rem, 7vw, 2.6rem); font-weight: 700; }
.practice__back { font-size: 1.3rem; color: var(--color-accent); }
.practice__tap { font-size: 0.9rem; color: var(--color-muted); }
.practice__answer { display: flex; gap: 10px; margin: 0; }
.practice__done { font-size: 1.4rem; font-weight: 700; }

/* students (admins) */
.dash-add .pdialog__field { margin-bottom: 12px; }
.dash-add textarea, .dash-add input.search__input { width: 100%; max-width: none; font-family: inherit; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.dash-table th, .dash-table td { padding: 10px 8px; text-align: left; vertical-align: top; border-top: 1px solid var(--color-border); }
.dash-table thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); border-top: 0; }
.dash-table__actions { text-align: right; }
.dash-created { border-color: var(--color-accent); }
.dash-created code { font-size: 1rem; user-select: all; }
.dash-dialog { width: min(560px, calc(100vw - 32px)); }

/* ---------- phones ---------- */

@media (max-width: 760px) {
  .dash-tabs { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); border-radius: 0; border-left: 0; border-right: 0; }
  .dash-card { padding: 16px; }
  .notes { grid-template-columns: 1fr; }
  .notes.is-editing .notes__side { display: none; }
  .notes:not(.is-editing) .notes__main { display: none; }
  .notes__back { display: inline-flex; }
  .notes__list { max-height: none; }
  .notes__main { min-height: 60vh; }
  .dash-session { grid-template-columns: 1fr; }
  .dash-session > :last-child:not(.dash-session__class) { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 6px; }
  .dash-table thead { display: none; }
  .dash-table tr { display: grid; padding: 10px 0; border-top: 1px solid var(--color-border); }
  .dash-table th, .dash-table td { padding: 2px 0; border: 0; }
  .dash-table td[data-label]::before { content: attr(data-label) ": "; color: var(--color-muted); font-size: 0.85rem; }
  .dash-table__actions { text-align: left; padding-top: 6px !important; }
}

@media print {
  .site-header, .site-footer, .site-nav, .dash-tabs, .dash__header, .dash-notice, .dash-add, .dash-card:not(.dash-created), .dash-toolbar, .app-hint { display: none !important; }
  .dash-created { box-shadow: none; border: 0; }
}

/* The header link for this section (on phones, pwa.css shows it in the tab bar). */
@media (min-width: 761px) {
  .page--dashboard .site-nav__link[data-nav="dashboard"] { color: var(--color-accent); background: var(--color-accent-soft); }
}

/* ---------- Security (admins) ---------- */
.dash-checklist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.dash-checklist__item {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.dash-checklist__item p { margin: 2px 0 0; font-size: 0.92rem; color: var(--color-muted); }
.dash-checklist__level {
  justify-self: start;
  padding: 2px 9px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}
.dash-checklist__item--ok .dash-checklist__level { color: var(--color-accent); border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border)); }
.dash-checklist__item--warn { border-color: color-mix(in srgb, #eab308 45%, var(--color-border)); }
.dash-checklist__item--warn .dash-checklist__level { background: color-mix(in srgb, #eab308 22%, var(--color-surface)); }
.dash-checklist__item--bad { border-color: color-mix(in srgb, #dc2626 50%, var(--color-border)); }
.dash-checklist__item--bad .dash-checklist__level { color: #fff; background: #b91c1c; border-color: #b91c1c; }
@media (max-width: 520px) {
  .dash-checklist__item { grid-template-columns: 1fr; gap: 6px; }
}

/* Change my password: full-width fields (students and admins) */
.dash-account .dash-form { display: grid; gap: 6px; max-width: 28rem; }
.dash-account .dash-form .search__input { width: 100%; min-width: 0; }
.dash-account .dash-form .dash-muted { margin: 2px 0 6px; font-size: 0.88rem; }
