/* Mobile product barcode scanner FAB */

.kc-scan-fab {
  display: none;
}

@media (max-width: 1279px) {
  .kc-scan-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 14px;
    bottom: calc(20vh + env(safe-area-inset-bottom));
    z-index: 2147483000;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: #03499a;
    color: #fff;
    box-shadow: 0 8px 24px rgba(3, 73, 154, 0.35), 0 2px 8px rgba(0, 0, 0, 0.12);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  }

  .kc-scan-fab:hover,
  .kc-scan-fab:focus {
    color: #fff;
    text-decoration: none;
    background: #023d82;
    outline: none;
  }

  .kc-scan-fab:active {
    transform: scale(0.94);
  }

  .kc-scan-fab svg {
    width: 26px;
    height: 26px;
    display: block;
  }

  .kc-scan-fab__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  body.kc-overlay-open .kc-scan-fab,
  body.kc-scan-page .kc-scan-fab {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (min-width: 1280px) {
  .kc-scan-fab {
    display: none !important;
  }
}

/* Full-screen scanner — lock site scroll and hide chrome */
html.kc-scan-page,
body.kc-scan-page {
  overflow: hidden !important;
  height: 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  overscroll-behavior: none;
  background: #000 !important;
  touch-action: none;
}

body.kc-scan-page .kc-bottomNav,
body.kc-scan-page #scrollArrow,
body.kc-scan-page .kc-topnav,
body.kc-scan-page header,
body.kc-scan-page footer,
body.kc-scan-page .ticker,
body.kc-scan-page #top,
body.kc-scan-page .mobile__button__menu__cust,
body.kc-scan-page .product-quick-buy-drawer,
body.kc-scan-page [class*="callibri"],
body.kc-scan-page #jvLabelWrap,
body.kc-scan-page .b24-widget-button-wrapper {
  display: none !important;
}

/* Fixed shell — ignores parent container width/padding/margins */
.kc-scan {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  width: 100vw !important;
  width: 100dvw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  background: #0b0f14 !important;
  color: #fff;
  overflow: hidden !important;
  box-sizing: border-box !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
}

.kc-scan *,
.kc-scan *::before,
.kc-scan *::after {
  box-sizing: border-box;
}

.kc-scan__stage {
  position: relative;
  flex: 1 1 100%;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

/* Primary video for native BarcodeDetector (full-frame decode) */
.kc-scan__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 0;
}

.kc-scan__reader {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  z-index: 0;
}

/* html5-qrcode fallback — keep video natural where possible */
#kc-scan-reader,
#kc-scan-reader__scan_region {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

#kc-scan-reader__scan_region {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#kc-scan-reader video,
#kc-scan-reader__scan_region video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

#kc-scan-reader img {
  display: none !important;
}

#kc-scan-reader__dashboard_section_csr,
#kc-scan-reader__dashboard_section_fsr,
#kc-scan-reader__header_message,
#kc-scan-reader__dashboard,
#qr-shaded-region {
  display: none !important;
}

.kc-scan__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: clamp(72px, 12vh, 140px);
  gap: 16px;
  background: radial-gradient(ellipse at center, transparent 36%, rgba(0, 0, 0, 0.45) 78%);
}

.kc-scan__frame {
  position: relative;
  /* Larger guide — decode uses FULL camera frame, frame is UX only */
  width: min(92vw, 420px);
  height: min(38vh, 220px);
  border-radius: 14px;
}

.kc-scan__guide {
  display: none;
}

@media (max-height: 760px) {
  .kc-scan__overlay {
    padding-top: clamp(64px, 10vh, 110px);
  }
}

.kc-scan__corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #fff;
  border-style: solid;
}

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

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

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

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

.kc-scan__laser {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  top: 50%;
  background: linear-gradient(90deg, transparent, #ed1c24, transparent);
  box-shadow: 0 0 12px rgba(237, 28, 36, 0.7);
  animation: kc-scan-laser 1.6s ease-in-out infinite;
}

@keyframes kc-scan-laser {
  0%,
  100% {
    transform: translateY(-40%);
    opacity: 0.55;
  }
  50% {
    transform: translateY(40%);
    opacity: 1;
  }
}

.kc-scan__close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  z-index: 4;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  backdrop-filter: blur(6px);
}

.kc-scan__lookup {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(11, 15, 20, 0.72);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: "Roboto Flex", sans-serif;
  font-size: 16px;
  font-weight: 500;
}

.kc-scan__lookup[hidden],
.kc-scan__lookup.is-hidden {
  display: none !important;
}

.kc-scan.is-looking-up .kc-scan__lookup {
  display: flex;
}

.kc-scan__lookup-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: kc-scan-spin 0.7s linear infinite;
}

@keyframes kc-scan-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Not found page */
.kc-scan-not-found__box {
  padding: 40px 16px 60px;
}

.kc-scan-not-found__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.kc-scan-not-found__primary {
  min-width: 220px;
  text-align: center;
}

.kc-scan-not-found__secondary {
  color: #03499a;
  font-family: "Roboto Flex", sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.kc-scan-not-found__secondary:hover {
  text-decoration: underline;
}
