/* upc_scanner.css
   Minimal styling for injected scanner modal.
   If your app already has these styles, you can skip this file. */

.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.65);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:9999;
}
.modal.open{display:flex}

.modal-card{
  background:#0f141a;
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  padding:12px 12px 10px;
  width:min(96vw,560px);
  max-width:96vw;
  max-height:calc(100dvh - 32px);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  gap:8px;
  color:#e8eef5;
  font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}

.modal .bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:4px;
}
.modal .bar .hint{
  color:#e8eef5;
  font-size:.8rem;
}

#scanBox{
  position:relative;
  width:min(100%, 520px, calc(100dvh - 220px));
  height:min(100%, 520px, calc(100dvh - 220px));
  aspect-ratio:1/1;
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  overflow:hidden;
  background:#000;
  margin-inline:auto;
  flex:0 1 auto;
  min-height:220px;
  touch-action:none;
}
#scanVideo{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  background:#000;
}
#roiOverlay{
  position:absolute;
  inset:0;
  pointer-events:none;
}
.shade{
  position:absolute;
  background:rgba(0,0,0,.55);
}
.roi-rect{
  position:absolute;
  border:2px dashed rgba(255,255,255,.8);
  border-radius:10px;
  background:rgba(0,255,128,0.08);
  box-shadow:0 0 0 2px rgba(0,0,0,.35) inset;
}
.roi-flash{
  position:absolute;
  border-radius:10px;
  background:rgba(0,255,128,0.35);
  box-shadow:0 0 0 2px rgba(0,255,128,.9) inset;
  opacity:0;
  pointer-events:none;
  transition:opacity .12s;
}
.roi-flash.visible{opacity:1}

#scanControls{
  display:grid;
  grid-auto-flow:column;
  grid-template-columns:repeat(5, minmax(0, 1fr));
  gap:8px;
  justify-content:stretch;
  align-items:center;
  margin-top:6px;
  padding-top:6px;

  position:sticky;
  bottom:0;

  /* Solid dark background (no transparency on light sites) */
  background:#0f141a;

  /* Nice separation from the video above */
  box-shadow: 0 -10px 18px rgba(0,0,0,.45);

  /* Ensures it paints as an opaque layer consistently */
  isolation:isolate;
}


.btn{
  height:40px;
  border-radius:10px;
  padding:0 12px;
  font-size:clamp(12px,3.4vw,14px);
  line-height:1;
  border:none;
  background:#1a222e;
  color:#e8eef5;
}
.btn.primary{
  background:#0053E2;
  color:#fff;
}
.btn:disabled{opacity:.5}

#scanStatus{
  margin-top:2px;
  font-size:.8rem;
  color:#9aa5b1;
  text-align:center;
}
.hint.mono{font-family:ui-monospace,Menlo,Monaco,Consolas,monospace}

/* ==== Solid dark controls override (patched) ==== */
/* Force the entire bottom controls area to stay solid dark, even on light-themed pages */
#scanControls,
.controls{
  background:#0f141a !important;
  background-image:none !important;
}

/* Kill any gradient/overlay pseudo elements that can create a white haze */
#scanControls::before,
.controls::before,
.modal-card::before{
  display:none !important;
  content:none !important;
}

#scanControls .btn{
  width:100%;
  min-width:0;
  padding:0 8px;
}


#scanModal .modal-card,
#scanModal #scanControls,
#scanModal #scanStatus,
#scanModal .bar,
#scanModal .hint{
  box-sizing:border-box;
}

body.light #scanModal{
  background:rgba(0,0,0,.25);
}
body.light #scanModal .modal-card{
  background:#f5f7fb;
  border-color:rgba(15,23,42,.12);
  color:#0f172a;
}
body.light #scanModal .bar .hint,
body.light #scanModal #scanStatus{
  color:#475569;
}
body.light #scanModal #scanBox{
  border-color:rgba(15,23,42,.12);
}
body.light #scanModal .shade{
  background:rgba(255,255,255,.45);
}
body.light #scanModal .roi-rect{
  border-color:rgba(15,23,42,.75);
  background:rgba(0,83,226,.08);
  box-shadow:0 0 0 2px rgba(255,255,255,.5) inset;
}
body.light #scanModal #scanControls,
body.light #scanModal .controls{
  background:#f5f7fb !important;
  box-shadow:0 -10px 18px rgba(15,23,42,.08);
}
body.light #scanModal .btn{
  background:#ffffff;
  color:#0f172a;
  border:1px solid rgba(15,23,42,.12);
}
body.light #scanModal .btn.primary{
  background:#0053E2;
  color:#fff;
  border-color:#0053E2;
}
