/* LSR Profiler — Global Styles (placeholder for future customizations) */

/* ── Create/edit class form grid ────────────────────────────
   THIS is the copy that is actually in effect: backoffice/base.html loads
   style.css, not backoffice.css. Used by new_class.html and edit_class.html. */

/* align-items:start, not end — these fields carry help text of differing
   heights (Class name has none), and bottom-aligning them pushed the field
   without help text a whole line lower than its neighbours. Starting them
   together lines up the labels and therefore the inputs. */
.cc-grid { display: grid; gap: .6rem 1rem; align-items: start; }
.cc-grid--3col { grid-template-columns: 190px minmax(0, 1fr) 190px; }
/* Self-guided classes have no course date. Without this, the two remaining
   fields fall into the 190px and 1fr tracks — so the join code got the wide
   column and the class name the narrow one. */
.cc-grid--3col.cc-grid--no-date { grid-template-columns: minmax(0, 1fr) 190px; }
.cc-grid--1col { grid-template-columns: 1fr; }
.cc-field { min-width: 0; }
.cc-field label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--text-secondary, #6b7280); margin-bottom: .3rem;
  /* Reserve one line so a label that wraps in a narrow column cannot push its
     own input out of line with the others. */
  min-height: 1.15rem; line-height: 1.15rem;
}
.cc-optional { font-weight: 400; font-size: .78rem; color: #999; }
.cc-required { color: #c0392b; }
.cc-code-wrap { display: flex; gap: .35rem; }
.cc-code-wrap input { flex: 1; font-family: monospace; letter-spacing: .08em; }
.btn-regen {
  height: 2.35rem; width: 2.35rem; padding: 0; flex-shrink: 0;
  border: 1.5px solid #cbd5e1; border-radius: 6px;
  background: #f8fafc; cursor: pointer;
  font-size: 1rem; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-regen:hover { background: #e2e8f0; color: #0F1B2D; border-color: #94a3b8; }

/* Below ~640px three tracks cannot hold a date input, a name and a join code;
   stack them instead. (backoffice.css had this rule, but that file is not
   loaded by the class forms, so it never applied.) */
@media (max-width: 640px) {
  .cc-grid--3col,
  .cc-grid--3col.cc-grid--no-date { grid-template-columns: 1fr; }
}

/* ── Password field with show/hide + generate controls ──────── */
.pw-input-wrap { display: flex; gap: .4rem; align-items: stretch; }
.pw-input-wrap input { flex: 1 1 auto; min-width: 0; }
.pw-toggle, .pw-generate {
  flex: 0 0 auto; cursor: pointer; white-space: nowrap;
  border: 1px solid #ccc; background: #f4f5f7;
  border-radius: 6px; padding: 0 .7rem; font-size: .8rem; font-weight: 600;
  color: #555;
}
.pw-toggle:hover, .pw-generate:hover { background: #e9ebef; }
.pw-toggle.is-on { background: #d6eaf8; color: var(--navy, #0F1B2D); }

/* ── Backoffice table controls (search / sort / pagination) ── */
.table-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: .9rem;
  flex-wrap: wrap;
}
.table-search {
  width: 100%;
  max-width: 360px;
}
.table-search__hint {
  font-size: .8rem;
  color: var(--muted, #7f8c8d);
}
.table-page-size-label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .85rem; color: var(--muted, #7f8c8d); white-space: nowrap;
}
.table-page-size {
  padding: .2rem .4rem; font-size: .85rem;
  border: 1px solid #dde3ea; border-radius: 4px; background: #fff;
}
.table-pagination {
  display: flex; align-items: center; gap: .75rem;
  margin: .6rem 0 .25rem; font-size: .85rem;
}
.pagination-info { color: var(--muted, #7f8c8d); }

th.sortable-col {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.4rem !important;
}
th.sortable-col:hover { color: var(--navy, #0F1B2D); background: #f0f0f0; }
th.sortable-col::after {
  content: "⇅";
  position: absolute;
  right: .55rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .8rem;
  opacity: .35;
}
th.sortable-col.is-sorted-asc::after  { content: "↑"; opacity: 1; color: var(--navy, #0F1B2D); }
th.sortable-col.is-sorted-desc::after { content: "↓"; opacity: 1; color: var(--navy, #0F1B2D); }

.table-empty-msg {
  margin-top: 1rem;
  padding: 1rem;
  color: var(--muted, #7f8c8d);
  background: #f6f6f6;
  border-radius: 6px;
  text-align: center;
  font-size: .9rem;
}

/* ── Bulk select ────────────────────────────────────────────── */
.col-check {
  width: 2.5rem;
  padding-left: .75rem !important;
  padding-right: .5rem !important;
}
.col-check input[type="checkbox"] { cursor: pointer; accent-color: var(--navy, #0F1B2D); }

.bulk-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.1rem;
  background: var(--navy, #0F1B2D);
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,.22);
  z-index: 200;
  white-space: nowrap;
  flex-wrap: wrap;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar__count { font-size: .875rem; font-weight: 600; }
.bulk-bar__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.bulk-bar .btn-sm { font-size: .8rem; }
.bulk-bar .btn-secondary { border-color: rgba(255,255,255,.4); color: #fff; }
.bulk-bar .btn-secondary:hover { background: rgba(255,255,255,.12); }
.bulk-bar .btn-danger { background: #c0392b; color: #fff; border-color: #c0392b; }
.bulk-bar .btn-danger:hover { background: #a93226; }
.bulk-deselect { background: none; border: none; color: rgba(255,255,255,.6); font-size: .8rem; cursor: pointer; padding: 0 .25rem; }
.bulk-deselect:hover { color: #fff; }

/* ── Role badges ────────────────────────────────────────────── */
.role-badge { display: inline-block; padding: .15rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 700; }
.role-badge--admin    { background: #fdecea; color: #c0392b; }
.role-badge--educator { background: #d6eaf8; color: var(--navy, #0F1B2D); }

/* Small square icon button beside the class-code field. The hover effect used
   to be inline onmouseover=""/onmouseout="" attributes, which the CSP
   (`script-src 'self' <nonce>`, no 'unsafe-inline') refuses to execute, so the
   button no longer reacted at all. Hover is presentation, so it belongs in CSS
   regardless. :focus-visible included — a mouse-only affordance leaves keyboard
   users with no feedback. */
.icon-btn-square {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    color: #6c757d;
    transition: background .15s, color .15s;
}
.icon-btn-square:hover,
.icon-btn-square:focus-visible {
    background: #e2e8f0;
    color: #0F1B2D;
}
