﻿.qr-tool-panel {
  overflow: visible;
}
.qr-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, .12));
}
.qr-tab {
  position: relative;
  padding: 10px 4px 12px;
  border: 0;
  color: var(--muted, #a6a4af);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.qr-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}
.qr-tab[aria-selected="true"] {
  color: var(--text, #fff);
}
.qr-tab[aria-selected="true"]::after {
  background: #8b63ff;
}
.qr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr);
  gap: 22px;
  align-items: start;
}
.qr-card {
  min-width: 0;
  border: 1px solid var(--border, rgba(255, 255, 255, .12));
  border-radius: 16px;
  background: rgba(255, 255, 255, .018);
}
.qr-card-head {
  padding: 17px 18px 0;
}
.qr-card-title {
  margin: 0;
  color: var(--text, #fff);
  font-size: 15px;
}
.qr-card-subtitle {
  margin: 6px 0 0;
  color: var(--muted, #aaa8b3);
  font-size: 13px;
  line-height: 1.55;
}
.qr-card-body {
  padding: 18px;
}
.qr-field {
  margin-bottom: 16px;
}
.qr-field:last-child {
  margin-bottom: 0;
}
.qr-field label,
.qr-inline-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text, #fff);
  font-size: 13px;
  font-weight: 700;
}
.qr-input,
.qr-select,
.qr-textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border, rgba(255, 255, 255, .15));
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text, #fff);
  outline: none;
  background: rgba(255, 255, 255, .035);
  font: inherit;
}
.qr-textarea {
  min-height: 122px;
  resize: vertical;
}
.qr-input:focus,
.qr-select:focus,
.qr-textarea:focus,
.qr-color:focus-visible,
.qr-tab:focus-visible {
  border-color: #956fff;
  box-shadow: 0 0 0 3px rgba(139, 99, 255, .23);
}
.qr-select option {
  color: #111;
}
.qr-content-fields {
  min-height: 152px;
}
.qr-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.qr-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 4px;
}
.qr-color-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.qr-color-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--border, rgba(255, 255, 255, .15));
  border-radius: 10px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, .035);
}
.qr-color {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  padding: 0;
  cursor: pointer;
  background: transparent;
}
.qr-color-code {
  overflow: hidden;
  color: var(--muted, #aaa8b3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qr-check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 16px;
  color: var(--muted, #aaa8b3);
  font-size: 13px;
  line-height: 1.45;
}
.qr-check-row input {
  margin: 3px 0 0;
  accent-color: #8b63ff;
}
.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.qr-actions .btn {
  min-height: 42px;
}
.qr-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted, #aaa8b3);
  font-size: 13px;
  line-height: 1.5;
}
.qr-status.is-error {
  color: #ff959f;
}
.qr-status.is-warning {
  color: #ffd282;
}
.qr-preview-card {
  position: sticky;
  top: 18px;
}
.qr-preview-wrap {
  display: grid;
  min-height: 358px;
  place-items: center;
  border: 1px dashed rgba(155, 122, 255, .45);
  border-radius: 13px;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 15%, rgba(128, 83, 255, .16), transparent 52%),
    rgba(255, 255, 255, .018);
}
.qr-preview-wrap canvas {
  display: block;
  width: min(100%, 320px);
  height: min(100%, 320px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 5px;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .28);
  image-rendering: pixelated;
}
.qr-empty {
  max-width: 260px;
  color: var(--muted, #aaa8b3);
  text-align: center;
  line-height: 1.6;
}
.qr-empty-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 13px;
  place-items: center;
  border: 1px solid rgba(139, 99, 255, .45);
  border-radius: 17px;
  color: #ae93ff;
  background: rgba(139, 99, 255, .1);
  font-size: 26px;
}
.qr-download-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.qr-download-actions .btn {
  min-height: 40px;
  padding-right: 8px;
  padding-left: 8px;
  font-size: 13px;
}
.qr-privacy-note {
  margin: 14px 0 0;
  color: var(--muted, #aaa8b3);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.qr-scan-placeholder {
  display: grid;
  min-height: 330px;
  place-items: center;
  padding: 24px;
  border: 1px dashed rgba(155, 122, 255, .45);
  border-radius: 14px;
  color: var(--muted, #aaa8b3);
  text-align: center;
}
.qr-scan-placeholder h2 {
  margin: 12px 0 8px;
  color: var(--text, #fff);
  font-size: 19px;
}
.qr-scan-placeholder p {
  max-width: 460px;
  margin: 0;
  line-height: 1.6;
}
.qr-info {
  margin-top: 24px;
}
.qr-info-card {
  padding: 22px;
}
.qr-info-card h2 {
  margin: 0 0 8px;
  color: var(--text, #fff);
  font-size: 18px;
}
.qr-info-card h2:not(:first-child) {
  margin-top: 24px;
}
.qr-info-card p {
  margin: 0;
  color: var(--muted, #aaa8b3);
  line-height: 1.7;
}
.qr-info-card details {
  border-top: 1px solid var(--border, rgba(255, 255, 255, .12));
  padding: 14px 0;
}
.qr-info-card details:first-of-type {
  margin-top: 16px;
}
.qr-info-card summary {
  color: var(--text, #fff);
  font-weight: 700;
  cursor: pointer;
}
.qr-info-card details p {
  margin-top: 9px;
}
@media (max-width: 820px) {
  .qr-layout {
    grid-template-columns: 1fr;
  }
  .qr-preview-card {
    position: static;
  }
  .qr-preview-wrap {
    min-height: 300px;
  }
}
@media (max-width: 520px) {
  .qr-two-col,
  .qr-options,
  .qr-color-row {
    grid-template-columns: 1fr;
  }
  .qr-download-actions {
    grid-template-columns: 1fr;
  }
  .qr-card-body,
  .qr-card-head {
    padding-right: 14px;
    padding-left: 14px;
  }
}

/* Final QR preview size fix */
.qr-preview-wrap {
  overflow: hidden !important;
}
.qr-preview-wrap canvas#qrCanvas {
  display: block !important;
  width: 260px !important;
  height: 260px !important;
  max-width: 100% !important;
  max-height: 260px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  box-sizing: border-box !important;
}
/* Two-panel automatic QR image scanner */
.qr-scan-layout { align-items: stretch; }
.qr-scan-layout > .qr-card { min-width: 0; }
.qr-scan-box {
  height: 300px;
  box-sizing: border-box;
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed #6f48d7;
  border-radius: 14px;
  background: #0b0b10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.qr-scan-box > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.qr-scan-empty {
  color: #a8a8b2;
  text-align: center;
}
.qr-scan-empty p { margin: 12px 0 0; }
.qr-scan-result-box { align-items: stretch; }
#scanResultGroup { width: 100%; }
#scanResult {
  width: 100%;
  min-height: 150px;
  box-sizing: border-box;
  resize: none;
}
@media (max-width: 760px) {
  .qr-scan-box { height: 260px; }
}
/* Scanner empty-state polish */
#scanPreviewImage:not([src]),
#scanPreviewImage[src=""] {
  display: none !important;
}
#scanImageBox,
.qr-scan-result-box {
  position: relative;
}
#scanImageEmpty,
#scanResultEmpty {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#scanImageEmpty .qr-empty-icon,
#scanResultEmpty .qr-empty-icon {
  margin: 0 0 12px;
}
#scanImageEmpty p,
#scanResultEmpty p {
  max-width: 230px;
  margin: 0;
  line-height: 1.55;
}
#scanPreviewImage[hidden] {
  display: none !important;
}
/* Final scanner result layout */
.qr-scan-result-box {
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-scan-result-value {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-scan-result-value #scanResult {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  height: auto;
  max-height: 230px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f5f5f7;
  text-align: center;
  resize: none;
  overflow-wrap: anywhere;
  font: 600 16px/1.65 inherit;
}
.qr-scan-result-actions {
  margin-top: 14px;
  margin-bottom: 0;
}
/* Final clean result presentation */
#scanResultBox {
  display: flex;
  align-items: center;
  justify-content: center;
}
#scanResultGroup {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#scanResultGroup .qr-inline-label {
  display: none !important;
}
#scanResult {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f5f5f7;
  text-align: center;
  resize: none;
  overflow: hidden;
  overflow-wrap: anywhere;
  font: 600 16px/1.65 inherit;
}
.qr-scan-result-actions {
  margin-top: 14px;
  margin-bottom: 0;
}
/* Fix: never show empty placeholders after an image/result exists */
#scanImageEmpty[hidden],
#scanResultEmpty[hidden] {
  display: none !important;
}
/* Empty state: centered only when it is not hidden */
#scanImageEmpty:not([hidden]),
#scanResultEmpty:not([hidden]) {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}
/* Loaded state: the image or decoded value occupies the box alone */
#scanImageBox:has(#scanPreviewImage:not([hidden])) #scanImageEmpty,
#scanResultBox:has(#scanResultGroup:not([hidden])) #scanResultEmpty {
  display: none !important;
}
/* Keep the loaded QR image centered, without the left placeholder */
#scanImageBox:has(#scanPreviewImage:not([hidden])) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
