/*
 * EW University — admin console styles.
 * Admin-specific layout only; brand tokens come from design-system.css and
 * shared components (.section-shell, .admin-card, .button, tables…) from
 * platform.css. Load order: design-system.css → platform.css → admin.css.
 */

/* ------------------------------------------------------------------ */
/* Admin gate                                                           */
/* ------------------------------------------------------------------ */

.admin-gate {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

.gate-card {
  width: min(420px, 100%);
  padding: 34px 30px;
  text-align: center;
}

.gate-card label,
.gate-card .gate-lede { text-align: left; }

.gate-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto;
}

.gate-card h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -.03em;
}

.gate-lede {
  margin: 0;
  color: var(--ewu-slate);
  line-height: 1.55;
}

.gate-error:not(:empty) { color: var(--ewu-danger); font-weight: 650; }

.gate-footnote {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-top: 6px;
  padding-top: 18px;
  border-top: 1px solid var(--ewu-line);
}

/* ------------------------------------------------------------------ */
/* Intro + in-page section nav                                          */
/* ------------------------------------------------------------------ */

.admin-intro h1 {
  margin: 0;
  letter-spacing: -.05em;
  line-height: 1.05;
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.section-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.section-jump a {
  text-decoration: none;
  color: var(--ewu-blue-dark);
  background: var(--ewu-mist);
  font-weight: 700;
  font-size: .9rem;
  padding: 9px 16px;
  border-radius: var(--ewu-radius-pill);
}

.section-jump a:hover { background: var(--ewu-teal-soft); }

/* ------------------------------------------------------------------ */
/* Dashboard                                                            */
/* ------------------------------------------------------------------ */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.metric-card {
  background: var(--ewu-mist);
  border-radius: 18px;
  padding: 18px;
  min-height: 98px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.metric-card strong {
  font-size: 2.1rem;
  letter-spacing: -.05em;
  color: var(--ewu-ink);
}

.subsection-title {
  margin: 0 0 14px;
  font-size: 1.1rem;
  letter-spacing: -.02em;
}

.analytics-table th[scope="row"],
.roster-table th[scope="row"] {
  color: var(--ewu-ink);
  font-size: .9rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 750;
}

.table-sub {
  color: var(--ewu-slate);
  font-weight: 500;
  font-size: .82rem;
}

.drill-cell { width: 48px; }

.drill-toggle {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--ewu-mist);
  color: var(--ewu-blue-dark);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.drill-toggle:hover { background: var(--ewu-teal-soft); }

.drill-icon { transition: transform .15s ease; }
.drill-toggle[aria-expanded="true"] .drill-icon { transform: rotate(90deg); }

/* Hovering anywhere on a course row highlights it and hints at the drill-down. */
#analyticsRows tr:has(.drill-toggle):hover > td,
#analyticsRows tr:has(.drill-toggle):hover > th {
  background: var(--ewu-mist);
}

.drill-row > td {
  background: var(--ewu-paper);
  padding: 16px;
}

.drill-shell {
  background: var(--ewu-panel);
  border-radius: 14px;
}

.drill-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.cert-link { text-decoration: none; }
.cert-link:hover { text-decoration: underline; }

.drill-table { min-width: 480px; }

.drill-empty {
  margin: 0;
  color: var(--ewu-slate);
}

/* ------------------------------------------------------------------ */
/* Courses section                                                      */
/* ------------------------------------------------------------------ */

.courses-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
  gap: 22px;
  align-items: start;
}

.course-list {
  display: grid;
  gap: 12px;
}

.course-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--ewu-panel);
  box-shadow: rgba(34, 42, 53, .08) 0 0 0 1px;
}

.course-row.editing { box-shadow: 0 0 0 2px var(--ewu-blue); }

.course-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.course-row-title h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}

.course-row-meta {
  margin: 6px 0 0;
  color: var(--ewu-slate);
  font-size: .88rem;
  line-height: 1.5;
}

/* Course form */

.course-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
}

.course-form legend {
  padding: 0;
  color: var(--ewu-slate);
  font-size: .84rem;
  font-weight: 750;
  margin-bottom: 2px;
}

/* Section groups inside the course form: separated by a hairline, headed by
   a small uppercase slate legend (mirrors the table th treatment). */
.course-form > .form-section {
  gap: 14px;
  border-top: 1px solid var(--ewu-line);
  padding-top: 18px;
}

.course-form > .form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.course-form .form-section > legend {
  float: left; /* legends don't join the fieldset's grid flow without this */
  width: 100%;
  color: var(--ewu-slate);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .74rem;
  font-weight: 800;
}

.form-section .section-help { margin-top: -8px; }

.choice-fieldset { grid-auto-flow: column; justify-content: start; gap: 18px; }
.choice-fieldset legend { float: left; width: 100%; }

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ewu-ink);
  font-weight: 650;
  font-size: .92rem;
}

.choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--ewu-blue);
  padding: 0;
}

.form-help {
  margin: -6px 0 0;
  color: var(--ewu-slate);
  font-size: .8rem;
  line-height: 1.5;
}

.instructor-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.button.small {
  min-height: 34px;
  padding: 0 14px;
  font-size: .85rem;
  justify-self: start;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ */
/* Roster section                                                       */
/* ------------------------------------------------------------------ */

.roster-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 420px) minmax(0, 1fr);
  gap: 6px 18px;
  align-items: end;
  margin-bottom: 14px;
}

.roster-course-picker { grid-column: 1; margin: 0; }
.roster-toolbar select { grid-column: 1; }

.roster-buttons {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#rosterNote:not(:empty) { margin: 0 0 12px; }

.roster-table { min-width: 760px; }

.roster-table .status-control { min-width: 150px; }

.roster-table .promote-btn { margin-top: 6px; }

/* ------------------------------------------------------------------ */
/* Empty-state guidance links                                           */
/* ------------------------------------------------------------------ */

.empty-state a,
.table-empty a {
  color: var(--ewu-blue-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  border-radius: 4px;
}

.empty-state a:hover,
.table-empty a:hover { color: var(--ewu-blue); }

.table-empty { color: var(--ewu-slate); }

/* ------------------------------------------------------------------ */
/* Footer                                                               */
/* ------------------------------------------------------------------ */

.admin-footer { align-items: center; }

.footer-utility {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-note { font-size: .84rem; }

/* ------------------------------------------------------------------ */
/* Toast — single polite live region for action confirmations           */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed;
  inset-inline: 16px;          /* mobile: centered via auto margins */
  bottom: 20px;
  z-index: 40;
  margin-inline: auto;
  width: fit-content;
  max-width: calc(100vw - 32px);
  padding: 13px 18px;
  border-radius: var(--ewu-radius-md);
  border-left: 4px solid var(--ewu-success);
  background: var(--ewu-panel);
  color: var(--ewu-ink);
  font-size: .92rem;
  font-weight: 650;
  line-height: 1.45;
  box-shadow: var(--ewu-shadow-card);
  pointer-events: none;
  opacity: 0;
  translate: 0 8px;
  transition: opacity .22s ease, translate .22s ease;
}

.toast.visible {
  opacity: 1;
  translate: 0 0;
}

@media (min-width: 720px) {
  .toast {
    inset-inline: 24px;
    bottom: 24px;
    margin-inline: auto 0;     /* desktop: bottom-right */
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
    translate: 0 0;
  }
}

/* datetime-local inputs have a wide intrinsic minimum (~232px in Chrome);
   let the Start/End pair wrap to one column instead of overlapping when the
   form column is narrow. */
.date-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ------------------------------------------------------------------ */
/* Responsive                                                           */
/* ------------------------------------------------------------------ */

@media (max-width: 960px) {
  .courses-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .metric-card strong { font-size: 1.7rem; }
  .instructor-row { grid-template-columns: 1fr; align-items: stretch; }
  .course-row { flex-direction: column; }
  .roster-toolbar { grid-template-columns: 1fr; }
  .roster-buttons { grid-column: 1; grid-row: auto; justify-content: flex-start; }
}
