/* QR & Barcode Scanner — local styles */

/* Root container */
.qr-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Video / canvas stage */
.qr-stage {
  position: relative;
  background: #000;
  border-radius: var(--r-input);
  overflow: hidden;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-stage video,
.qr-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.qr-stage video {
  width: 100%;
}

/* Hidden canvas used for frame processing */
#qrCanvas {
  display: none;
}

/* Scan overlay ring — shown while scanning */
.scan-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-ring::after {
  content: "";
  display: block;
  width: min(220px, 60%);
  height: min(220px, 60%);
  border: 2px solid var(--accent);
  border-radius: 12px;
  opacity: 0.6;
}

/* Controls row */
.qr-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* File input styled as button */
.qr-file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--r-btn, 6px);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.qr-file-label:hover {
  background: var(--surface-3);
}
#qrFileInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

/* Status line */
.qr-status {
  font-size: 13.5px;
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: var(--r-input);
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-height: 38px;
  display: flex;
  align-items: center;
}
.qr-status.ok {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-d);
}
.qr-status.err {
  background: var(--danger-soft);
  border-color: var(--danger-soft-2);
  color: var(--danger);
}
.qr-status.info {
  background: var(--info-soft);
  border-color: transparent;
  color: var(--info);
}

/* Result card */
.qr-result {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
}
.qr-result.visible {
  display: flex;
}

.qr-result-type {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-d);
  align-self: flex-start;
}

.qr-result-text {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--text);
  word-break: break-all;
  overflow-wrap: anywhere;
}

.qr-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* Wifi details grid */
.qr-wifi-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  font-size: 13.5px;
}
.qr-wifi-grid .k {
  font-weight: 600;
  color: var(--text-2);
}
.qr-wifi-grid .v {
  font-family: var(--mono);
  color: var(--text);
  word-break: break-all;
}

/* Permission prompt */
.perm-prompt {
  padding: 14px 16px;
  background: var(--info-soft);
  border: 1px solid transparent;
  border-radius: var(--r-input);
  font-size: 13.5px;
  color: var(--info);
}
.perm-prompt p { margin: 0; }

@media (max-width: 560px) {
  .qr-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .qr-controls .btn,
  .qr-file-label {
    width: 100%;
    justify-content: center;
  }
}
