/* QR code studio (templates/studios/qr.html). Builds on tools.css. */

.qr-studio { margin-top: 4px; }

/* What the code holds: one link per QR tool. */
.qr-kinds { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 14px; scrollbar-width: thin; }
.qr-kind { flex: 0 0 auto; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-dim); font-size: 0.9rem; text-decoration: none; white-space: nowrap; transition: border-color 0.15s var(--ease), color 0.15s var(--ease); }
.qr-kind:hover, .qr-kind:focus-visible { border-color: var(--accent-line); color: var(--text); }
.qr-kind[aria-current="page"] { border-color: var(--accent); background: var(--accent-dim); color: var(--text); font-weight: 600; }
.qr-kinds-gap { flex: 0 0 1px; align-self: stretch; margin: 4px 6px; background: var(--border-strong); }

.qr-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 18px; align-items: start; }
@media (max-width: 991px) {
  .qr-layout { grid-template-columns: minmax(0, 1fr); }
  .qr-stage { order: -1; }
}

/* Controls */
.qr-sec { margin-bottom: 12px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.qr-sec-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1rem; font-weight: 650; color: var(--text); }
details.qr-sec > summary.qr-sec-title { margin: 0; cursor: pointer; list-style: none; }
details.qr-sec > summary.qr-sec-title::-webkit-details-marker { display: none; }
details.qr-sec > summary.qr-sec-title::before { content: '›'; display: inline-block; width: 14px; color: var(--text-faint); transition: transform 0.15s var(--ease); }
details.qr-sec[open] > summary.qr-sec-title::before { transform: rotate(90deg); }
details.qr-sec.is-changed > summary.qr-sec-title::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.qr-group-body { margin-top: 14px; }
.qr-step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-family: var(--font-mono); font-size: 0.75rem; }

/* Presets and style tiles: real radios, drawn as pictures. */
.qr-presets, .qr-tiles { margin: 0; padding: 0; border: 0; min-width: 0; }
.qr-preset-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.qr-preset, .qr-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-dim); font-size: 0.78rem; text-align: center; cursor: pointer; transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.qr-preset:hover, .qr-tile:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.qr-preset-pic { width: 64px; height: 64px; border-radius: 6px; background: #fff; }
.qr-preset.is-custom .qr-preset-pic { display: grid; place-items: center; background: var(--surface-3); color: var(--text-faint); font-size: 1.4rem; }
.btn-check:checked + .qr-preset, .btn-check:checked + .qr-tile { border-color: var(--accent); background: var(--accent-dim); color: var(--text); box-shadow: 0 0 0 1px var(--accent) inset; }
.btn-check:focus-visible + .qr-preset, .btn-check:focus-visible + .qr-tile { outline: 2px solid var(--accent); outline-offset: 2px; }
.qr-tile-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.qr-tile img { width: 40px; height: 40px; padding: 4px; border-radius: 6px; background: #fff; }
.qr-tile.is-text { justify-content: center; min-height: 44px; font-family: var(--font-mono); }
.qr-tile span, .qr-preset span { text-transform: capitalize; }
.qr-tile-row.is-wide { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.qr-tile-row.is-wide .qr-tile img { width: 72px; height: 72px; object-fit: contain; }

/* Under the presets: a random look, undo and redo, example designs and the looks saved in this browser. */
.qr-looks-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.qr-seed { margin: 0 -2px 0 6px; color: var(--text-faint); font-size: 0.82rem; }
.qr-looks-bar .qr-seed-input { flex: 0 0 104px; width: 104px; min-height: 31px; padding: 2px 8px; }
.qr-history { display: inline-flex; gap: 6px; margin-left: auto; }
.qr-more { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.qr-more > summary { cursor: pointer; color: var(--text-dim); font-size: 0.9rem; }
.qr-more > summary:hover { color: var(--text); }
.qr-count { color: var(--text-faint); }
.qr-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.qr-gallery-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-dim); font-size: 0.78rem; text-align: center; text-decoration: none; transition: border-color 0.15s var(--ease), transform 0.15s var(--ease); }
.qr-gallery-item:hover, .qr-gallery-item:focus-visible { border-color: var(--accent-line); color: var(--text); transform: translateY(-1px); }
.qr-gallery-item img { width: 64px; height: 64px; border-radius: 6px; background: #fff; object-fit: contain; }
.qr-designs-bar { display: flex; gap: 8px; margin-top: 10px; }
.qr-designs-bar .btn { flex: 0 0 auto; }
.qr-designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.qr-designs:empty { display: none; }
.qr-design { display: flex; align-items: center; min-width: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.qr-design-open { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px; border: 0; background: transparent; color: var(--text); font-size: 0.84rem; text-align: left; }
.qr-design-open:hover .qr-design-name { text-decoration: underline; }
.qr-design-pic { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 4px; background: #fff; object-fit: contain; }
.qr-design-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-design .btn-link, .qr-designs-file .btn-link { color: var(--text-faint); text-decoration: none; }
.qr-design .btn-link:hover, .qr-designs-file .btn-link:hover { color: var(--text); }
.qr-designs-file { display: flex; gap: 6px; margin-top: 8px; }
.qr-designs-file label.btn { cursor: pointer; }
.qr-designs-file label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The middle of the code: picture, text, symbol or emoji. */
.qr-tabs { display: inline-flex; margin-bottom: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.qr-tab { min-height: 36px; padding: 4px 14px; border: 0; background: transparent; color: var(--text-faint); font-size: 0.86rem; }
.qr-tab[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.qr-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.qr-emoji-input { max-width: 120px; font-size: 1.4rem; text-align: center; }
.qr-logo-colours { margin: -4px 0 16px; }
.qr-swatch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.qr-swatch { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); color: var(--text-dim); font-size: 0.8rem; }
.qr-swatch:hover, .qr-swatch:focus-visible { border-color: var(--accent-line); color: var(--text); }
.qr-swatch-dots { display: inline-flex; gap: 3px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 999px; }
.qr-swatch-dot { width: 14px; height: 14px; border-radius: 50%; }

/* A color for each eye. */
.qr-eyes { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 8px; }
.qr-eye { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 0.82rem; }
.qr-eye .tool-color-pick { flex: 0 0 40px; width: 40px; min-height: 32px; }
.qr-eye .btn-link { padding: 0 2px; color: var(--text-faint); text-decoration: none; }
.qr-eye .btn-link:hover { color: var(--text); }

.qr-content .tool-text { min-height: 0; height: 84px; }

.qr-actions { margin-top: 6px; }

/* The preview stage */
@media (min-width: 992px) { .qr-stage { position: sticky; top: calc(var(--nav-h) + 12px); } }
.qr-stage-inner { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.qr-stage-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.qr-stage-head .qr-sec-title { margin-bottom: 8px; }
.qr-canvas { position: relative; display: grid; place-items: center; min-height: 240px; margin-top: 6px; padding: 22px; border-radius: var(--radius-lg);
  background-color: #fff; background-image: linear-gradient(45deg, #f1f1f1 25%, transparent 25%, transparent 75%, #f1f1f1 75%), linear-gradient(45deg, #f1f1f1 25%, transparent 25%, transparent 75%, #f1f1f1 75%);
  background-size: 18px 18px; background-position: 0 0, 9px 9px; box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.55); outline: 2px dashed transparent; outline-offset: -8px; transition: outline-color 0.15s var(--ease); }
.qr-canvas img { width: 100%; max-width: 380px; height: auto; max-height: 460px; object-fit: contain; transition: opacity 0.2s var(--ease); }
.qr-canvas.is-busy img { opacity: 0.8; }
.qr-canvas.is-stale img { opacity: 0.35; }
.qr-canvas.is-drop { outline-color: var(--accent); }
.qr-canvas[data-backdrop="light"] { background-image: none; background-color: #ffffff; }
.qr-canvas[data-backdrop="dark"] { background-image: none; background-color: #111827; }
.qr-stage-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.qr-stage-tools .btn-link { padding: 0 4px; color: var(--text-dim); text-decoration: none; }
.qr-stage-tools .btn-link:hover { color: var(--text); }

/* The photo and bulk pages: the generic result column, and the first codes of a list. */
@media (min-width: 992px) { .qr-stage.qr-stage-job { position: static; } }
.qr-first { margin-bottom: 12px; }
.qr-first-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 10px; }
.qr-first-code { flex: 1 1 28%; min-width: 0; max-width: 160px; height: auto; border-radius: 6px; background: #fff; }

.qr-scan { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: var(--radius); background: var(--surface-2); }
.qr-scan[data-rating="fair"] { border-left-color: var(--warn); }
.qr-scan[data-rating="risky"] { border-left-color: var(--err); }
.qr-scan-badge { margin: 0; font-weight: 650; color: var(--text); }
.qr-scan-print { margin: 2px 0 0; color: var(--text-dim); font-size: 0.86rem; }
.qr-scan-notes { margin: 6px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 0.84rem; }
.qr-scan-notes:empty { display: none; }
.qr-readback { margin: 6px 0 0; font-size: 0.84rem; color: var(--text-dim); }
.qr-readback[data-state="ok"] { color: var(--ok); }
.qr-readback[data-state="warn"] { color: var(--warn); }
.qr-scan-notes li[data-level="risky"] { color: var(--err); }

.qr-export { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.qr-export .form-select { width: auto; }
.qr-export #qr-png { flex: 1 1 auto; }
.qr-include { display: inline-flex; align-items: center; gap: 6px; color: var(--text-faint); font-size: 0.82rem; }
.qr-encoded { margin-top: 12px; }
.qr-encoded summary { cursor: pointer; color: var(--text-dim); font-size: 0.88rem; }
.qr-encoded .tool-output { max-height: 160px; }

@media (prefers-reduced-motion: reduce) {
  .qr-kind, .qr-preset, .qr-tile, .qr-gallery-item, .qr-canvas, .qr-canvas img, details.qr-sec > summary.qr-sec-title::before { transition: none; transform: none; }
}

/* Print and more formats */
.qr-dialog { width: min(520px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); }
.qr-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.qr-dialog-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 14px; align-items: center; margin: 12px 0; }
.qr-dialog-grid .form-label { margin: 0; }
.qr-dialog-pair { display: flex; gap: 8px; }
.qr-dialog-pair .form-select { width: auto; }
.qr-dialog-actions { margin-top: 12px; }
.qr-dialog .btn-link { color: var(--text-faint); text-decoration: none; }
.qr-dialog .btn-link:hover { color: var(--text); }
@media (max-width: 480px) { .qr-dialog-grid { grid-template-columns: minmax(0, 1fr); } }
