/* Image & camera import — the camera scanner modal, the in-flow OCR progress
   modal, and the "Scan with camera" dropzone button. Reuses the shared .modal /
   .modal-card chrome (main.css) and the kpRise entrance; all motion inherits the
   global reduced-motion gate, with a local block below for the capture flash. */

/* ── In-flow OCR progress modal (PF.imageGate) ───────────────────────────────*/
.kp-img-progress-card { max-width: 420px; }
.kp-progress-bar {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 10px;
}
.kp-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary, #0e7490);
  border-radius: 999px;
  transition: width .2s ease-out;
}
.kp-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-soft);
}
.kp-progress-slow {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

/* ── "Scan with camera" button (under PDF dropzones) ─────────────────────────*/
.dropzone-scan-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.dropzone-scan-label { font-size: 13px; color: var(--text-soft); }
.dropzone-scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.dropzone-scan-btn svg { width: 17px; height: 17px; }

/* ── Camera scanner modal (PF.cameraCapture) ─────────────────────────────────*/
.kp-camera-card {
  max-width: 720px;
  width: calc(100% - 24px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  padding: 22px;
}
.kp-camera-card h2 { margin-bottom: 14px; padding-right: 28px; }

.kp-camera-stage {
  position: relative;
  background: #0b1220;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  flex: 1 1 auto;
}
.kp-camera-video {
  display: block;
  width: 100%;
  max-height: 56vh;
  object-fit: contain;
  background: #0b1220;
}
.kp-camera-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.kp-camera-flash.fire { animation: kpCamFlash .22s ease-out; }
@keyframes kpCamFlash { 0% { opacity: 0; } 25% { opacity: .8; } 100% { opacity: 0; } }

/* Fallback (no camera / blocked) — native capture inputs */
.kp-camera-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px;
  text-align: center;
}
.kp-camera-msg-text { margin: 0; color: #cbd5e1; max-width: 38ch; line-height: 1.5; }
.kp-camera-msg-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.kp-camera-filebtn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }

/* Captured-page strip */
.kp-camera-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 2px 4px;
  scrollbar-width: thin;
}
.kp-camera-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 84px;
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.kp-camera-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kp-camera-thumb-enter { animation: kpRise .26s cubic-bezier(.2, .7, .3, 1); }
.kp-camera-thumb-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.kp-camera-thumb-del:hover { background: rgba(220, 38, 38, .9); }
.kp-camera-thumb-num {
  position: absolute;
  bottom: 3px;
  left: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

/* Controls row — flip · shutter · done */
.kp-camera-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.kp-camera-flip { justify-self: start; display: inline-flex; align-items: center; gap: 6px; }
.kp-camera-controls .btn-primary { justify-self: end; }
.kp-camera-shutter {
  justify-self: center;
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: 4px solid var(--primary, #0e7490);
  background: var(--bg-elev);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s ease, box-shadow .15s;
}
.kp-camera-shutter:hover { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary, #0e7490) 22%, transparent); }
.kp-camera-shutter:active { transform: scale(.92); }
.kp-camera-shutter:focus-visible { outline: 2px solid var(--primary, #0e7490); outline-offset: 3px; }
.kp-camera-shutter-dot {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--primary, #0e7490);
}

@media (max-width: 560px) {
  .kp-camera-card { padding: 16px; width: calc(100% - 12px); }
  .kp-camera-video { max-height: 48vh; }
  .kp-camera-shutter { width: 56px; height: 56px; }
  .kp-camera-shutter-dot { width: 40px; height: 40px; }
}

/* Capture flash + thumb entrance are decorative — silence under reduced motion
   (the global gate already collapses durations; this also drops the end-state). */
@media (prefers-reduced-motion: reduce) {
  .kp-camera-flash.fire,
  .kp-camera-thumb-enter { animation: none; }
}
