/* FINAL V14 — upload preview + professional camera layout */

/* Registration uploads: every preview owns a fixed box and never pushes/overlaps the form. */
body.v14-register-route .v14-file-thumb{
  display:block!important;
  width:72px!important;
  height:72px!important;
  min-width:72px!important;
  min-height:72px!important;
  max-width:72px!important;
  max-height:72px!important;
  flex:0 0 72px!important;
  overflow:hidden!important;
  border-radius:14px!important;
  position:relative!important;
}
body.v14-register-route .v14-file-thumb img,
body.v14-register-route img[alt="معاينة الملف"]{
  display:block!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:cover!important;
  object-position:center!important;
}
body.v14-register-route .v14-upload-gallery{
  display:grid!important;
  grid-template-columns:repeat(auto-fill,72px)!important;
  gap:10px!important;
  justify-content:start!important;
  align-items:start!important;
  min-height:0!important;
  overflow:visible!important;
}
body.v14-register-route .v14-upload-cell{
  position:relative!important;
  width:72px!important;
  height:72px!important;
  min-width:72px!important;
  min-height:72px!important;
  max-width:72px!important;
  max-height:72px!important;
  overflow:visible!important;
}
body.v14-register-route .v14-upload-cell > .v14-file-thumb{
  width:72px!important;
  height:72px!important;
}
body.v14-register-route label:has(.v14-file-thumb){
  min-height:104px!important;
  overflow:hidden!important;
  align-items:center!important;
}
@media (max-width:640px){
  body.v14-register-route .v14-file-thumb,
  body.v14-register-route .v14-upload-cell,
  body.v14-register-route .v14-upload-cell > .v14-file-thumb{
    width:68px!important;height:68px!important;min-width:68px!important;min-height:68px!important;max-width:68px!important;max-height:68px!important;flex-basis:68px!important;
  }
  body.v14-register-route .v14-upload-gallery{grid-template-columns:repeat(auto-fill,68px)!important;gap:9px!important}
}

/* Admin registration instructions: clearer clickable section + direct preview link. */
.v14-registration-instructions > summary{
  min-height:76px!important;
  position:relative!important;
}
.v14-registration-preview-link{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:7px!important;
  min-height:38px!important;
  padding:0 13px!important;
  border:1px solid rgba(239,29,37,.45)!important;
  border-radius:12px!important;
  background:rgba(239,29,37,.10)!important;
  color:#fff!important;
  font-size:11px!important;
  font-weight:900!important;
  white-space:nowrap!important;
  text-decoration:none!important;
}
.v14-registration-preview-link:hover{background:rgba(239,29,37,.18)!important;border-color:rgba(239,29,37,.75)!important}

/* Camera pages: all controls/info are normal-flow ABOVE the camera, never on top of it. */
body.v14-camera-route .mobile-scanner-box{
  display:flex!important;
  flex-direction:column!important;
  gap:14px!important;
}
body.v14-camera-route .v14-camera-card{
  display:flex!important;
  flex-direction:column!important;
  gap:12px!important;
  overflow:visible!important;
}
body.v14-camera-route .v14-camera-tools-toggle{
  order:-30!important;
  width:100%!important;
  min-height:48px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:12px!important;
  padding:10px 14px!important;
  border:1px solid rgba(239,29,37,.32)!important;
  border-radius:16px!important;
  background:linear-gradient(180deg,rgba(239,29,37,.10),rgba(239,29,37,.04))!important;
  color:#fff!important;
  font-size:12px!important;
  font-weight:900!important;
  cursor:pointer!important;
}
body.v14-camera-route .v14-camera-tools-toggle .v14-chevron{transition:transform .18s ease!important}
body.v14-camera-route .v14-camera-card.v14-tools-collapsed .v14-camera-tools-toggle .v14-chevron{transform:rotate(180deg)!important}
body.v14-camera-route .v14-before-camera{order:0!important}
body.v14-camera-route .v14-camera-card.v14-tools-collapsed .v14-before-camera:not(.v14-camera-tools-toggle){display:none!important}
body.v14-camera-route .scanner-viewport{
  order:100!important;
  margin-top:2px!important;
  isolation:isolate!important;
  overflow:hidden!important;
}
/* The old compact scan card covered the live video. V14 uses the full result panel above instead. */
body.v14-camera-route .scanner-viewport > .pointer-events-auto.absolute{
  display:none!important;
}

/* Full scan result/action appears above the camera as an admin-controlled dropdown. */
body.v14-camera-route .v14-camera-result-toggle{
  order:-20!important;
  width:100%!important;
  min-height:50px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:12px!important;
  padding:11px 14px!important;
  border:1px solid rgba(34,197,94,.34)!important;
  border-radius:16px!important;
  background:linear-gradient(180deg,rgba(34,197,94,.10),rgba(34,197,94,.04))!important;
  color:#fff!important;
  font-size:12px!important;
  font-weight:900!important;
  cursor:pointer!important;
}
body.v14-camera-route .v14-camera-result-toggle .v14-chevron{transition:transform .18s ease!important}
body.v14-camera-route .v14-camera-result-toggle[aria-expanded="false"] .v14-chevron{transform:rotate(180deg)!important}
body.v14-camera-route .v14-camera-result{
  order:-19!important;
  width:100%!important;
  margin:0!important;
  position:relative!important;
  z-index:2!important;
}
body.v14-camera-route .v14-camera-result.v14-result-collapsed{display:none!important}
body.v14-camera-route .v14-camera-result > *{max-width:100%!important}

/* Keep all generated messages/toolbars above the viewport and prevent accidental overlap. */
body.v14-camera-route .v14-camera-card > :not(.scanner-viewport){position:relative!important;z-index:3!important}
body.v14-camera-route .v14-camera-card .scanner-viewport{z-index:1!important}

@media (max-width:640px){
  body.v14-camera-route .v14-camera-card{padding:12px!important}
  body.v14-camera-route .v14-camera-tools-toggle,
  body.v14-camera-route .v14-camera-result-toggle{border-radius:14px!important;min-height:48px!important}
  body.v14-camera-route .scanner-viewport{width:min(100%,420px)!important}
  .v14-registration-preview-link{padding:0 10px!important;font-size:10px!important}
}
