/* QrKit: the generator form, the live preview, the bulk grid and the
   scanner. Everything else (cards, buttons, selects, dropzone, results)
   comes from the shared design system in styles.css. */

/* text-like inputs the shared stylesheet does not cover */
input[type="url"], input[type="email"], input[type="tel"], input[type="password"], input[type="search"], textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
.qr-form input[type="text"], .qr-form input[type="number"] { width: 100%; box-sizing: border-box; }
textarea { resize: vertical; min-height: 5.5rem; line-height: 1.45; }
input[type="color"] {
  width: 3rem; height: 2.4rem; padding: 0.15rem;
  border: 2px solid var(--ink); border-radius: 8px; background: var(--paper-bright); cursor: pointer;
}
input[type="file"] { font-size: 0.95rem; max-width: 100%; }

/* form layout */
.qr-form .field { margin: 0.9rem 0; }
.qr-form .field + .field { margin-top: 0.9rem; }
.qr-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
@media (max-width: 600px) { .qr-grid2 { grid-template-columns: 1fr; } }
.qr-form .options-row .field { margin: 0; }
.qr-form .options-row .field select { min-width: 8rem; }
.qr-colorrow { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.qr-swatches { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
.qr-swatch {
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--c); cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 2px var(--paper-bright);
}
.qr-swatch:hover, .qr-swatch:focus-visible { transform: scale(1.12); outline: none; }
.qr-logorow { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.qr-inline { display: flex; gap: 0.7rem; align-items: end; flex-wrap: wrap; }
.qr-inline .field { flex: 1 1 10rem; }

/* preview column: on small screens it comes first */
.qr-preview-card { text-align: center; }
.qr-preview-card h2 { margin-top: 0; }
.qr-preview {
  display: grid; place-items: center;
  min-height: 240px;
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: repeating-conic-gradient(#e8e0cd 0% 25%, #f6efdd 0% 50%) 0 0 / 22px 22px;
  padding: 0.9rem; overflow: hidden;
}
.qr-preview svg { width: 100%; height: auto; max-width: 300px; display: block; }
.qr-empty { color: var(--ink-faint); margin: 0; font-size: 1rem; padding: 0 1rem; }
.qr-info { text-align: center; }
.qr-info.is-error { color: var(--accent); font-weight: 600; }
.qr-actions { justify-content: center; }
.qr-side-rest { display: grid; gap: 1.5rem; }
@media (max-width: 960px) {
  /* the aside dissolves into the page grid: preview first, then the form, then notes and ads */
  .qr-layout .tool-side { display: contents; }
  .qr-layout .qr-preview-card { order: -1; }
  .qr-layout .tool-main { order: 0; }
  .qr-layout .qr-side-rest { order: 1; }
  .qr-preview { min-height: 200px; }
  .qr-preview svg { max-width: 220px; }
}

/* bulk */
.bulk-textarea { min-height: 11rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95rem; }

/* scanner */
.scan-cam { margin-top: 1rem; }
.scan-cam video {
  width: 100%; max-height: 60vh; display: block; background: #000;
  border: 2px solid var(--ink); border-radius: var(--radius);
}
.scan-results { display: grid; gap: 1rem; margin-top: 1rem; }
.scan-result {
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--paper-bright); box-shadow: var(--shadow-soft); padding: 0.9rem 1rem;
  display: grid; gap: 0.6rem;
}
.scan-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.scan-source { font-size: 0.9rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.scan-text {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95rem;
  background: var(--paper); border-radius: 8px; padding: 0.6rem 0.75rem; max-height: 14rem; overflow: auto;
}
.scan-details { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 0.8rem; font-size: 0.95rem; }
.scan-details dt { font-weight: 600; color: var(--ink-soft); }
.scan-details dd { margin: 0; word-break: break-word; }
.scan-result .result-actions { margin-top: 0.2rem; }

/* style block sub-headings and the scan check verdict */
.qr-sub { font-size: 1.05rem; margin: 1.3rem 0 0.2rem; color: var(--ink-soft); }
.qr-form .options-row > .check-row { align-self: center; }
.qr-swatch[disabled] { opacity: 0.4; cursor: default; }
.qr-check { margin: 0.4rem 0 0; font-size: 0.95rem; text-align: center; min-height: 1.4em; color: var(--ink-soft); }
.qr-check.is-pass { color: var(--sage-dark); font-weight: 600; }
.qr-check.is-fail { color: var(--accent); font-weight: 600; }
.qr-check.is-busy { color: var(--ink-faint); font-style: italic; }
