/* ==========================================================================
 * Festival Studio - QR codes (js/views/qr-codes.js, Milestone B7)
 *
 *  1. Page and table      st-qr-toolbar  st-qr-table  st-qr-name  st-qr-action  st-qr-target
 *  2. The editor          st-qr-editor  st-qr-types (what a scan does)  st-qr-preview (the card)
 *  3. Make in bulk        st-qr-bulk
 *  4. Link code dialog    st-qrdlg__link  st-qrdlg__strip (the many-cards preview)
 *  5. Narrow screens, reduced motion
 * ========================================================================== */

/* ---------- 1. Page and table ---------- */
.st-qr-list { margin-top: 16px; }
.st-qr-toolbar { margin-bottom: 12px; }
.st-qr-toolbar .st-toolbar { margin-bottom: 8px; min-height: 38px; }
.st-qr-toolbar .st-toolbar:last-child { margin-bottom: 0; }
.st-qr-notes { display: flex; flex-direction: column; gap: 10px; }
.st-qr-notes .st-callout[hidden] { display: none; }

.st-qr-selection { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 2px; padding-left: 14px; border-left: 1px solid var(--st-border-strong); }
.st-qr-selection__count { font-size: 13px; font-weight: 600; color: var(--st-text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

.st-qr-table .st-table__table { table-layout: fixed; min-width: 1060px; }
.st-qr-table .st-table__table td { overflow: hidden; }
.st-qr-table tr.is-off td { color: var(--st-text-muted); }
.st-qr-when { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-qr-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-qr-name__icon {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--st-r-8);
  background: #fff; color: #05060a;
}
.is-off .st-qr-name__icon { opacity: 0.45; }
.st-qr-name__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.st-qr-name__label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-qr-name__id { font-family: var(--st-mono); font-size: 11.5px; letter-spacing: 0.06em; color: var(--st-text-muted); }

.st-qr-action { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-qr-action__main { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.st-qr-action__main .st-icon { color: var(--st-lavender); flex: 0 0 auto; }
.st-qr-action__sub { font-size: 12px; color: var(--st-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.st-qr-target { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; white-space: nowrap; }
.st-qr-target__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-qr-target.is-missing { color: #fcd34d; }
.st-qr-target .st-icon { flex: 0 0 auto; }
.st-qr-tools { display: inline-flex; align-items: center; gap: 2px; }

/* ---------- 2. The editor ---------- */
.st-qr-editor-dialog { --st-modal-w: 960px; }
.st-qr-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.st-qr-editor__form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.st-qr-editor__foot { font-size: 12.5px; line-height: 1.5; color: var(--st-text-muted); }

.st-qr-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.st-qr-type {
  display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 52px; padding: 8px 10px; text-align: left;
  border: 1px solid var(--st-border); border-radius: var(--st-r-10); background: rgba(255, 255, 255, 0.02);
  color: var(--st-text-dim); font: inherit; font-size: 13px; line-height: 1.3; cursor: pointer;
  transition: border-color var(--st-ease), background-color var(--st-ease), color var(--st-ease);
}
.st-qr-type:hover { border-color: var(--st-border-strong); color: var(--st-text); }
.st-qr-type.is-active { border-color: rgba(124, 92, 255, 0.75); background: rgba(109, 92, 255, 0.13); color: var(--st-text); font-weight: 600; }
.st-qr-type:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 2px; }
.st-qr-type__icon {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.05); color: var(--st-lavender);
}
.st-qr-type.is-active .st-qr-type__icon { background: rgba(124, 92, 255, 0.3); color: #fff; }
.st-qr-type__label { min-width: 0; overflow-wrap: anywhere; }
.st-qr-types__help { margin-top: 8px; font-size: 12.5px; line-height: 1.5; color: var(--st-text-muted); }

.st-qr-points { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.st-qr-points__custom { width: 160px; }

.st-qr-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.st-qr-preview__label { font-size: 12.5px; font-weight: 600; color: var(--st-text-dim); }
.st-qr-preview__card {
  display: grid; place-items: center; min-height: 360px; padding: 16px; border-radius: var(--st-r-14);
  background: radial-gradient(120% 80% at 30% 0%, rgba(109, 92, 255, 0.28), transparent 60%), #0a0d18;
  border: 1px solid var(--st-border);
}
.st-qr-preview__card > div { width: 100%; }
.st-qr-preview__canvas { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45)); }
.st-qr-preview__link { font-family: var(--st-mono); font-size: 11.5px; color: var(--st-text-muted); overflow-wrap: anywhere; }
.st-qr-preview__hint { font-size: 12px; line-height: 1.5; color: var(--st-text-muted); }

/* ---------- 3. Make in bulk ---------- */
.st-qr-bulk .st-dialog__body > * + * { margin-top: 14px; }
.st-qr-bulk__types { display: flex; flex-direction: column; gap: 8px; }
.st-qr-bulk__type {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; text-align: left;
  border: 1px solid var(--st-border); border-radius: var(--st-r-10); background: rgba(255, 255, 255, 0.02);
  color: var(--st-text); font: inherit; cursor: pointer; transition: border-color var(--st-ease), background-color var(--st-ease);
}
.st-qr-bulk__type:hover { border-color: var(--st-border-strong); }
.st-qr-bulk__type.is-active { border-color: rgba(124, 92, 255, 0.75); background: rgba(109, 92, 255, 0.13); }
.st-qr-bulk__type:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 2px; }
.st-qr-bulk__type.is-active .st-qr-type__icon { background: rgba(124, 92, 255, 0.3); color: #fff; }
.st-qr-bulk__type-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-qr-bulk__type-label { font-size: 13.5px; font-weight: 600; }
.st-qr-bulk__type-help { font-size: 12.5px; line-height: 1.45; color: var(--st-text-muted); }

/* ---------- 4. Link code dialog ---------- */
.st-qrdlg__link { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 8px 8px 8px 12px; border: 1px solid var(--st-border); border-radius: var(--st-r-10); background: var(--st-bg-elev); }
.st-qrdlg__url { min-width: 0; font-family: var(--st-mono); font-size: 12.5px; color: var(--st-text-dim); overflow-wrap: anywhere; }
.st-qrdlg__strip { display: flex; gap: 10px; margin: 14px 0 4px; }
.st-qrdlg__strip img { width: calc((100% - 30px) / 4); max-width: 120px; height: auto; border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }

/* ---------- 5. Narrow screens, reduced motion ---------- */
@media (max-width: 900px) {
  .st-qr-editor { grid-template-columns: minmax(0, 1fr); }
  .st-qr-preview { position: static; max-width: 320px; }
  .st-qr-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .st-qr-types { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .st-qr-type, .st-qr-bulk__type { transition: none; }
}
