/* === Scanner Screen === */
.scanner-screen {
  background: #000;
}

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

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

#scanner-reader {
  width: 100%;
  height: 100%;
}

#scanner-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Hide html5-qrcode UI elements */
#scanner-reader img[alt="Info"] { display: none !important; }
#scanner-reader > div:last-child { display: none !important; }

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner-frame {
  width: 260px;
  height: 260px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  position: relative;
}

.scanner-frame::before,
.scanner-frame::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--color-accent);
  border-style: solid;
}

.scanner-frame::before {
  top: -1px;
  left: -1px;
  border-width: 3px 0 0 3px;
  border-radius: var(--radius-sm) 0 0 0;
}

.scanner-frame::after {
  top: -1px;
  right: -1px;
  border-width: 3px 3px 0 0;
  border-radius: 0 var(--radius-sm) 0 0;
}

.scanner-frame-bottom::before,
.scanner-frame-bottom::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--color-accent);
  border-style: solid;
}

.scanner-frame-bottom::before {
  bottom: -1px;
  left: -1px;
  border-width: 0 0 3px 3px;
  border-radius: 0 0 0 var(--radius-sm);
}

.scanner-frame-bottom::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 var(--radius-sm) 0;
}

.scanner-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent-glow);
  animation: scanner-sweep 2s ease-in-out infinite;
}

@keyframes scanner-sweep {
  0%, 100% { top: 20%; }
  50% { top: 80%; }
}

.scanner-hint {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--font-size-sm);
  margin-top: var(--space-6);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* Scanner Controls */
.scanner-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-4);
  padding-bottom: calc(var(--safe-bottom) + var(--space-4));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  pointer-events: auto;
}

.scanner-control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  color: white;
  padding: var(--space-2) var(--space-3);
}

.scanner-control-btn__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-control-btn__icon--active {
  background: var(--color-accent);
}

.scanner-control-btn__label {
  font-size: var(--font-size-xs);
}

/* Scanner top controls (back button) */
.scanner-top-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: var(--space-4);
  padding-top: calc(var(--safe-top) + var(--space-4));
  background: linear-gradient(rgba(0, 0, 0, 0.6), transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto;
  z-index: 10;
}

.scanner-back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
