/* ============================================================================
   Workshop mode (js/components/WorkshopMode.js) and the assessment star
   - The step bar above the storyboard, shown while a workshop runs
   - body.workshop-back-closed: no Edit button on activity cards
   - body.workshop-back-limited: a note in the editor (tabs are hidden in JS)
   - body.workshop-stars: an empty star on cards without one
   - The setup dialog: steps, minutes, link and QR code
   ============================================================================ */

/* --- Step bar ------------------------------------------------------------- */

/* At the top of the page, and in view while scrolling down to the storyboard
   (below Bootstrap's modals and the editor panel) */
.workshop-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 1020;
  margin-bottom: 1rem;
  background: var(--bh-white, #fff);
  border: 2px solid var(--bh-black, #111);
  box-shadow: var(--bh-shadow-sm, 3px 3px 0 #111);
  padding: 0.5rem 0.75rem;
}

body.workshop-on .workshop-bar {
  display: block;
}

.workshop-bar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.workshop-bar-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--bh-navy, #1B2A4A);
}

.workshop-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workshop-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 2px solid var(--bh-black, #111);
  background: var(--bh-white, #fff);
  color: var(--bh-black, #111);
  padding: 0.15rem 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.workshop-chip-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  font-size: 0.75rem;
  border-radius: 50%;
  background: var(--bh-cream, #F5F0E6);
}

.workshop-chip.is-current {
  background: var(--bh-navy, #1B2A4A);
  color: var(--bh-white, #fff);
}

.workshop-chip.is-current .workshop-chip-num {
  background: var(--bh-gold, #E8A820);
  color: var(--bh-black, #111);
}

.workshop-chip.is-done {
  color: #555;
  border-color: #999;
}

.workshop-bar-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.workshop-task {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin: 0.5rem 0 0;
  padding-top: 0.4rem;
  border-top: 1px solid #ddd;
  font-size: 0.9rem;
}

.workshop-task-text {
  flex-basis: 100%;
}

/* The countdown: time left, start or pause, start over, sound */
.workshop-clock {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  border: 2px solid var(--bh-black, #111);
  padding: 0.1rem 0.25rem 0.1rem 0.5rem;
}

.workshop-clock-time {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 3.2em;
}

.workshop-clock .btn {
  padding: 0.05rem 0.45rem;
  font-size: 0.8rem;
}

.workshop-clock .btn[aria-pressed="true"] {
  background: var(--bh-navy, #1B2A4A);
  color: var(--bh-white, #fff);
}

/* The time is up: a quiet signal, and Next step is suggested */
.workshop-clock.is-up {
  background: var(--bh-gold, #D4A017);
}

.workshop-ready {
  flex-basis: 100%;
  font-weight: 600;
}

.workshop-bar .btn.is-suggested {
  outline: 3px solid var(--bh-gold, #D4A017);
  outline-offset: 1px;
}

/* "Nå: …" and "Neste: …" for teams working alone */
.workshop-guide {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 2px solid var(--bh-black, #111);
  font-size: 0.9rem;
}

.workshop-guide p {
  margin: 0 0 0.2rem;
}

.workshop-guide p:last-child {
  margin-bottom: 0;
}

.workshop-guide strong {
  display: inline-block;
  min-width: 3.5em;
}

/* On a small screen the bar stays in view, so it must stay short: only the
   current step has its name, the others their number (the name is still
   read out and shown on hover) */
@media (max-width: 767.98px) {
  .workshop-chip:not(.is-current) .workshop-chip-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .workshop-chip:not(.is-current) {
    padding: 0.15rem 0.3rem;
  }
}

/* What a step scrolls to, and a field that gets the focus, is not hidden under the bar */
body.workshop-on .action-plan,
body.workshop-on .action-plan input {
  scroll-margin-top: calc(var(--workshop-bar-height, 0px) + 1rem);
}

/* On a phone the bar's steps and buttons take less room, and the bar
   scrolls away with the page: kept in view, it would cover most of it */
@media (max-width: 575.98px) {
  .workshop-bar {
    position: static;
  }

  body.workshop-on .action-plan,
  body.workshop-on .action-plan input {
    scroll-margin-top: 1rem;
  }

  .workshop-bar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .workshop-guide,
  .workshop-task {
    font-size: 0.85rem;
  }
}

/* --- Cards and editor during a workshop ------------------------------------ */

body.workshop-back-closed .placed-activity .edit-btn {
  display: none;
}

.workshop-editor-note {
  display: none;
  margin: 0.5rem 0 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  background: var(--bh-cream, #F5F0E6);
  border-left: 4px solid var(--bh-gold, #E8A820);
}

body.workshop-back-limited .workshop-editor-note {
  display: block;
}

/* --- The assessment star on activity cards (ActivityCard.js) --------------- */

.placed-activity .card-header .assessment-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  margin-left: auto;
  padding: 0;
  border: 2px solid var(--bh-black, #111);
  border-radius: 50%;
  background: var(--bh-white, #fff);
  cursor: pointer;
}

/* Clear of the order number in the card's corner (bauhaus-theme.css) */
.dropzone.is-wrapped > .placed-activity .card-header .assessment-star {
  margin-right: 16px;
}

.placed-activity .card-header .assessment-star i {
  margin: 0;
  font-size: 0.85rem;
  color: #999;
}

/* Silver: formative */
.placed-activity .card-header .assessment-star.is-formative i {
  color: #8E9AA6;
  -webkit-text-stroke: 1px #4A5560;
}

/* Gold: summative */
.placed-activity .card-header .assessment-star.is-summative i {
  color: #E8A820;
  -webkit-text-stroke: 1px #8A5E00;
}

.placed-activity .card-header .assessment-star.is-empty {
  visibility: hidden;
}

/* A card without a star shows it, faded, while the pointer or the keyboard
   is on the card: so a star cycled to none can be clicked again, outside a
   workshop too. At the stars step of a workshop every card shows it. */
.placed-activity:hover .card-header .assessment-star.is-empty,
.placed-activity:focus-within .card-header .assessment-star.is-empty {
  visibility: visible;
  opacity: 0.55;
}

body.workshop-stars .placed-activity .card-header .assessment-star.is-empty {
  visibility: visible;
  opacity: 1;
}

/* --- Setup dialog ------------------------------------------------------------ */

.workshop-steps-table .workshop-step-check {
  width: 2rem;
}

.workshop-steps-table .workshop-step-minutes {
  width: 6.5rem;
}

.workshop-steps-table tr.is-off td:not(.workshop-step-check) {
  opacity: 0.55;
}

.workshop-share {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
}

.workshop-share-text {
  flex: 1 1 16rem;
  min-width: 0;
}

.workshop-qr {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  padding: 0;
  border: 2px solid var(--bh-black, #111);
  background: var(--bh-white, #fff);
  cursor: zoom-in;
}

/* Click for a code the room can scan from the projector */
.workshop-qr.is-large {
  width: min(360px, 100%);
  height: auto;
  aspect-ratio: 1;
  cursor: zoom-out;
}

.workshop-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

@media print {
  .workshop-bar,
  .placed-activity .card-header .assessment-star.is-empty {
    display: none !important;
  }
}

/* --- The setup: presets, the instructions switch, the total --------------- */

.workshop-preset-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.workshop-preset-choice .btn {
  font-weight: 700;
}

.workshop-badge-facilitator {
  background: var(--bh-cream, #F5F0E6);
  color: var(--bh-black, #111);
  font-weight: 600;
}

.workshop-guide-switch {
  background: var(--bh-cream, #F5F0E6);
  border: 2px solid var(--bh-black, #111);
  padding: 0.5rem 0.75rem 0.5rem 3rem;
}

.workshop-total-note {
  font-weight: 400;
  color: #555;
  font-size: 0.85rem;
}

/* --- The action plan under the storyboard (ActionPlan.js) ------------------- */

.action-plan {
  display: none;
  margin: 1.5rem 0;
  background: var(--bh-white, #fff);
  border: 2px solid var(--bh-black, #111);
  box-shadow: var(--bh-shadow-sm, 3px 3px 0 #111);
  padding: 0.75rem 1rem;
}

body.workshop-action-plan .action-plan,
.action-plan.has-items {
  display: block;
}

.action-plan .ap-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0 0 0.25rem;
}

.action-plan .ap-intro,
.action-plan .ap-empty {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 0.5rem;
}

.action-plan .ap-rows {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
}

.action-plan .ap-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.action-plan .ap-head {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #444;
  margin-bottom: 0.2rem;
}

.action-plan .ap-print {
  display: none;
}

/* On a phone each item is a small card with its fields under each other */
@media (max-width: 767.98px) {
  .action-plan .ap-head {
    display: none;
  }

  .action-plan .ap-rows .ap-row {
    grid-template-columns: minmax(0, 1fr) auto;
    border: 1px solid #ccc;
    padding: 0.4rem;
  }

  .action-plan .ap-rows .ap-row input {
    grid-column: 1;
  }

  .action-plan .ap-rows .ap-remove {
    grid-column: 2;
    grid-row: 1;
  }
}

@media print {
  .action-plan {
    display: none !important;
    box-shadow: none;
    border: 1px solid #111;
    padding: 4px 8px;
    margin: 8px 0 0;
    break-inside: avoid;
  }

  .action-plan.has-items {
    display: block !important;
  }

  .action-plan .ap-title {
    font-size: 10pt;
  }

  .action-plan .ap-print {
    display: table;
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
  }

  .action-plan .ap-print th,
  .action-plan .ap-print td {
    border: 1px solid #999;
    padding: 2px 4px;
    text-align: left;
    vertical-align: top;
  }
}

/* The course board's columns, under "Hele kurset" in the setup */
.workshop-board-columns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.35rem;
}

.workshop-board-columns select {
  width: auto;
}

.workshop-board-columns input {
  width: 5.5rem;
}
