/* Scanner overlay styles */
.id-preview {
  position: relative;
  /* NEW: make preview occupy the form width and add spacing */
  width: 100%;
  max-width: 100%;
  margin: 10px 0;
}
/* NEW: scale the image to the container while preserving aspect */
.id-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px; /* adjust if you want taller previews */
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e4e6ea;
}

/* Keep overlay behavior */
.id-preview .scan-overlay {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  overflow: hidden;
  display: none;
}
.id-preview.scanning .scan-overlay {
  display: block;
}

/* Subtle vertical stripes */
.id-preview .scan-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(89, 149, 253, 0.12) 0px,
      rgba(89, 149, 253, 0.12) 10px,
      transparent 12px,
      transparent 20px
    );
  pointer-events: none;
}

/* Moving scan line */
.id-preview .scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(89, 149, 253, 0.9) 50%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(89, 149, 253, 0.7);
  animation: scan-move 1.6s linear infinite;
}

@keyframes scan-move {
  0% { top: 0; }
  100% { top: calc(100% - 3px); }
}

/* Scanning label */
.id-preview .scan-label {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 10px;
  pointer-events: none;
}