/* Modern Glassmorphic Scanner Modal Styling */

.scannerA {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 29, 0.82);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  padding: 1.25rem;
  box-sizing: border-box;
}

.scannerB {
  width: 100%;
  max-width: 480px;
  margin: auto;
  background: linear-gradient(165deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 40px rgba(56, 189, 248, 0.1);
  box-sizing: border-box;
  animation: scannerModalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scannerModalIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header */
.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.scanner-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #38bdf8;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.scanner-title {
  color: #f8fafc;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-close-scanner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.btn-close-scanner:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
  transform: scale(1.08);
}

/* Viewport & Viewfinder */
.scanner-viewport-wrapper {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.85);
  min-height: 250px;
}

#qr-cam {
  border: none !important;
  background: transparent !important;
}

#qr-cam video {
  border-radius: 14px;
  width: 100% !important;
  height: auto !important;
  object-fit: cover;
  display: block;
}

#qr-cam__scan_region {
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

#qr-cam__scan_region > img {
  opacity: 0.6;
  max-width: 60px !important;
  margin: 1.5rem auto !important;
}

#qr-cam__header_message {
  color: #94a3b8 !important;
  font-size: 0.85rem !important;
  padding: 6px !important;
  background: transparent !important;
  border: none !important;
}

/* HTML5 QR Code Library Controls */
#qr-cam__dashboard {
  padding: 12px 6px !important;
  background: transparent !important;
}

#qr-cam__dashboard_section_csr {
  text-align: center;
}

#qr-cam select,
#html5-qrcode-select-camera {
  background: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.88rem;
  margin-bottom: 8px;
  width: 100%;
  max-width: 320px;
  outline: none;
  transition: border-color 0.2s;
}

#qr-cam select:focus,
#html5-qrcode-select-camera:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

#qr-cam button,
.html5-qrcode-element {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 12px !important;
  padding: 8px 18px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  margin: 4px 6px !important;
  cursor: pointer;
  transition: all 0.2s ease !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35) !important;
  outline: none;
}

#qr-cam button:hover,
.html5-qrcode-element:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%) !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5) !important;
  transform: translateY(-1px);
}

#qr-cam button:active,
.html5-qrcode-element:active {
  transform: translateY(1px);
}

#html5-qrcode-button-camera-stop {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35) !important;
}

#html5-qrcode-button-camera-stop:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
}

#html5-qrcode-anchor-scan-type-change {
  color: #38bdf8 !important;
  text-decoration: none !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  display: inline-block;
  margin-top: 6px;
  transition: color 0.2s;
}

#html5-qrcode-anchor-scan-type-change:hover {
  color: #7dd3fc !important;
  text-decoration: underline !important;
}

/* Animated Scanner Laser Beam & Corner Brackets */
.scanner-laser-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0) 0%, #38bdf8 50%, rgba(56, 189, 248, 0) 100%);
  box-shadow: 0 0 12px #38bdf8, 0 0 20px rgba(56, 189, 248, 0.6);
  pointer-events: none;
  z-index: 5;
  animation: scanLaserAnim 2.4s ease-in-out infinite alternate;
}

@keyframes scanLaserAnim {
  0% {
    top: 15%;
    opacity: 0.4;
  }
  50% {
    top: 85%;
    opacity: 1;
  }
  100% {
    top: 15%;
    opacity: 0.4;
  }
}

.scanner-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: #38bdf8;
  border-style: solid;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
}

.corner-tl {
  top: 12px;
  left: 12px;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 8px;
}

.corner-tr {
  top: 12px;
  right: 12px;
  border-width: 3px 3px 0 0;
  border-top-right-radius: 8px;
}

.corner-bl {
  bottom: 12px;
  left: 12px;
  border-width: 0 0 3px 3px;
  border-bottom-left-radius: 8px;
}

.corner-br {
  bottom: 12px;
  right: 12px;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 8px;
}

/* Footer Cancel Button */
.btn-scanner-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  border-radius: 9999px;
  padding: 0.65rem 2rem;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.2s ease;
  cursor: pointer;
  outline: none;
}

.btn-scanner-cancel:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  transform: translateY(-1px);
}

/* NFC Modern Styling */
#nfc-wrapC {
  padding: 40px 20px;
  text-align: center;
  color: #ffffff;
  background: radial-gradient(circle at center, rgba(16, 185, 129, 0.2) 0%, rgba(15, 23, 42, 0.6) 70%);
  border-radius: 18px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  position: relative;
  overflow: hidden;
}

.nfc-pulse-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid rgba(16, 185, 129, 0.6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  animation: nfcPulseAnim 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
}

.nfc-pulse-ring i {
  font-size: 54px;
  color: #34d399;
}

@keyframes nfcPulseAnim {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 20px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}