/* QR Scanner Camera Overlay */
.qr-scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #000;
  display: flex;
  flex-direction: column;
  animation: qrScannerIn 0.2s ease-out;
}

.qr-scanner-overlay.qr-scanner-closing {
  animation: qrScannerOut 0.2s ease-in forwards;
}

@keyframes qrScannerIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes qrScannerOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.qr-scanner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
}

.qr-scanner-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qr-scanner-close:active {
  background: rgba(255, 255, 255, 0.25);
}

.qr-scanner-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.qr-scanner-viewfinder {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scanning frame overlay */
.qr-scanner-frame {
  position: absolute;
  width: 240px;
  height: 240px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow:
    0 0 0 4000px rgba(0, 0, 0, 0.4),
    inset 0 0 20px rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

/* Animated scan line */
.qr-scanner-frame::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6cb4ee, transparent);
  animation: qrScanLine 2s ease-in-out infinite;
}

@keyframes qrScanLine {
  0%, 100% { top: 8px; opacity: 0.6; }
  50% { top: calc(100% - 10px); opacity: 1; }
}

/* Corner markers */
.qr-scanner-frame::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 3px solid #6cb4ee;
  border-radius: 16px;
  clip-path: polygon(
    0 20%, 0 0, 20% 0,
    80% 0, 100% 0, 100% 20%,
    100% 80%, 100% 100%, 80% 100%,
    20% 100%, 0 100%, 0 80%
  );
}

.qr-scanner-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  text-align: center;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s;
}

.qr-scanner-hint.qr-scanner-found {
  background: rgba(34, 197, 94, 0.7);
  color: #fff;
}

.qr-scanner-status {
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  color: #aaa;
  background: rgba(0, 0, 0, 0.6);
  min-height: 20px;
}

.qr-scanner-status.qr-scanner-error {
  color: #f87171;
  padding: 16px;
}

/* Success flash */
.qr-scanner-overlay.qr-scanner-success .qr-scanner-frame {
  border-color: #22c55e;
  transition: border-color 0.2s;
}

.qr-scanner-overlay.qr-scanner-success .qr-scanner-frame::before {
  border-color: #22c55e;
}
