/* The Coverage view of the tutor's course editor (site/coverageExplorer.js).
   Colours come from the site tokens in style.css, so light and dark both
   work. Nothing here is sized to one language's text: labels wrap. */

.cx-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 12px 0 10px;
}

.cx-bar__title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cx-bar__title[hidden] {
  display: none;
}

/* The switch sits on the right whether or not the heading shows. */
.cx-switch {
  margin-left: auto;
}

.cx[hidden],
.cx-panel[hidden],
.cx-notice[hidden],
/* The list blocks the switch hides set their own display in style.css. */
.profile-form__pending[hidden],
.profile-form__selected[hidden] {
  display: none;
}

.cx {
  --cx-sticky-top: 84px;
  margin-top: 4px;
}

.cx-notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
  background: var(--info-bg);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.cx-layout {
  display: block;
}

/* Wide, tall screens with a course open: cards narrow to one column on the
   left, the course stays open on the right. */
.cx-layout.is-docked-open {
  display: grid;
  grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.cx-cards {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cx-search {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.cx-cards__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cx-subject {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cx-subject__title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cx-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 10px;
}

.cx-layout.is-docked-open .cx-card-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.cx-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cx-card:hover {
  border-color: rgba(var(--accent-rgb), 0.6);
}

.cx-card:focus-visible,
.cx-row:focus-visible,
.cx-chip:focus-visible,
.cx-link-btn:focus-visible,
.cx-back-btn:focus-visible,
.cx-icon-btn:focus-visible,
.cx-builds__course:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.cx-card.is-current {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.14);
}

.cx-card--all {
  border-style: dashed;
}

.cx-layout.is-docked-open .cx-card {
  padding: 9px 12px;
}

.cx-card__title {
  max-width: 100%;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.cx-card__school,
.cx-card__meta {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cx-tag {
  display: inline-block;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.cx-tag--new,
.cx-tag--selected {
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.16);
}

.cx-tag--official {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--text);
}

.cx-tag--chain {
  border-color: var(--info-border);
  background: var(--info-bg);
  color: var(--text);
}

.cx-tag--prereq,
.cx-tag--coreq,
.cx-tag--grade {
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--text);
}

.cx-tag--similar {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--text);
}

/* ---- the docked panel ---- */
.cx-panel {
  position: sticky;
  top: var(--cx-sticky-top);
  min-width: 0;
  max-height: calc(100dvh - var(--cx-sticky-top) - 16px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  animation: cx-slide-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cx-slide-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cx-panel { animation: none; }
}

.cx-detail {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  outline: none;
}

/* ---- the bottom sheet body (header styles come from the tutor preview sheet) ---- */
.cx-sheet {
  background: var(--surface);
}

.cx-sheet__body {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.cx-sheet__body .cx-detail {
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

/* ---- detail ---- */
.cx-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cx-detail__titles {
  min-width: 0;
}

.cx-detail__title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.cx-detail__sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.cx-icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.cx-link-btn,
.cx-back-btn,
.cx-plain-btn {
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.cx-plain-btn {
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}

.cx-danger-btn {
  align-self: flex-start;
  padding: 8px 14px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-control);
  background: var(--danger-bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.cx-danger-btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.cx-scope {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.cx-scope__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}

.cx-scope__label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cx-scope__caption {
  color: var(--muted);
  font-size: 0.78rem;
}

.cx-scope__value {
  overflow-wrap: anywhere;
}

.cx-scope__options {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cx-scope__option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: var(--radius-control-sm);
  cursor: pointer;
}

.cx-scope__option:hover {
  background: rgba(var(--accent-rgb), 0.1);
}

.cx-scope__option input {
  margin: 0;
}

.cx-scope__option-name {
  overflow-wrap: anywhere;
}

.cx-scope__option-count {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.cx-builds {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: 0.9rem;
}

.cx-builds__caption {
  color: var(--muted);
}

.cx-builds__chain {
  min-width: 0;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
}

.cx-builds__course {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  cursor: pointer;
  overflow-wrap: anywhere;
  text-align: left;
}

.cx-builds__arrow,
.cx-builds__more {
  color: var(--muted);
}

.cx-chips {
  gap: 6px;
}

.cx-chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
}

.cx-chip.is-active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.22);
}

.cx-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.cx-group__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.cx-group__label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cx-group__count {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.cx-rows {
  margin: 0;
  padding: 0 6px 6px;
  list-style: none;
}

.cx-row-item + .cx-row-item {
  border-top: 1px solid var(--border);
}

.cx-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border: 0;
  border-radius: var(--radius-control-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cx-row:hover {
  background: rgba(var(--accent-rgb), 0.08);
}

.cx-row__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cx-row__label {
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.cx-row__meta {
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.cx-row .cx-tag {
  max-width: 11em;
}

.cx-row__chevron {
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
}

.cx-row-item--hidden {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px;
}

.cx-group--hidden .cx-group__summary {
  color: var(--muted);
}

.cx-empty {
  margin: 4px 0;
}

.cx-remove {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cx-remove.is-confirming {
  padding: 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  background: var(--danger-bg);
}

.cx-remove__title,
.cx-remove__text {
  margin: 0;
  overflow-wrap: anywhere;
}

.cx-remove__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cx-lost {
  margin: 0;
  padding-left: 18px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.88rem;
}

/* ---- why ---- */
.cx-why__title {
  margin: 0;
  font-size: 1.05rem;
}

.cx-why__course {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-wrap: anywhere;
}

.cx-why__school {
  color: var(--muted);
  font-size: 0.88rem;
}

.cx-why__desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.cx-why__lead,
.cx-why__through,
.cx-why__note,
.cx-why__summary,
.cx-why__hint {
  margin: 0;
  overflow-wrap: anywhere;
}

.cx-why__through {
  font-weight: 700;
}

.cx-why__note,
.cx-why__summary,
.cx-why__hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.cx-why {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.cx-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cx-step {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control-sm);
  background: var(--surface);
  overflow-wrap: anywhere;
}

.cx-step--link {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
}

.cx-step__course {
  font-weight: 600;
}

.cx-step__school {
  color: var(--muted);
  font-size: 0.8rem;
}

.cx-step__arrow {
  font-size: 1.05rem;
  color: var(--accent);
}

.cx-why__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

/* Pending selections: picks that go away at the next save. */
.cx-card--removing {
  cursor: default;
  border-style: dashed;
  border-color: var(--danger-border);
  background: var(--surface-2);
}

.cx-card--removing:hover {
  border-color: var(--danger-border);
}

.cx-card--removing .cx-card__title {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.cx-tag--removing {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--text);
}
