/* QR Generator - tool-specific styles.
   Reuses tokens/classes from ../shared/tools.css. */

.qr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.qr-form { display: flex; flex-direction: column; gap: 20px; }
.qr-types { align-self: flex-start; max-width: 100%; overflow-x: auto; }

.qr-panel { display: flex; flex-direction: column; gap: 16px; }

.qr-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.qr-check input { width: auto; accent-color: var(--accent); }
.qr-check-inline { align-self: flex-end; padding-bottom: 9px; }

/* Style disclosure */
.qr-style {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.qr-style > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 540;
  color: var(--text-2);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.qr-style > summary::-webkit-details-marker { display: none; }
.qr-style > summary::before {
  content: "";
  width: 8px; height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.qr-style[open] > summary::before { transform: rotate(45deg); }
.qr-style > summary:hover { color: var(--text); }
.qr-style-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
}
.qr-ec { align-self: flex-start; }
.qr-ec button { min-width: 40px; }

.qr-color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.qr-color-input { display: flex; align-items: center; gap: 8px; }
.qr-color-input input[type="text"] { flex: 1; min-width: 0; }

/* Preview */
.qr-preview-wrap { position: sticky; top: 24px; }
.qr-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.qr-stage {
  position: relative;
  width: 260px;
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-input);
  /* Always-light plate so a white QR is readable in dark theme */
  background: #ffffff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#qr-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
#qr-canvas.hidden { display: none; }

.qr-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #a1a1aa;
  text-align: center;
  padding: 24px;
}
.qr-empty svg { width: 48px; height: 48px; opacity: 0.55; }
.qr-empty-text { font-size: 13px; }

.qr-caption { min-height: 16px; text-align: center; }
.qr-warn { text-align: center; max-width: 30ch; }

.qr-downloads {
  display: flex;
  gap: 10px;
  width: 100%;
}
.qr-downloads .btn { flex: 1; }

@media (max-width: 820px) {
  .qr-layout { grid-template-columns: 1fr; }
  .qr-preview-wrap { position: static; order: -1; }
  .qr-stage { width: 240px; margin: 0 auto; }
}

@media (max-width: 640px) {
  .qr-color-row { grid-template-columns: 1fr; }
  .qr-check-inline { align-self: flex-start; padding-bottom: 0; }
}
