/* camera_scanner_html — the form's rules, kept here because the Anvil server
 * strips a template <style> body.
 *
 * Every rule is scoped :where(.cs-root), the private class on the form's root.
 * :where() adds no specificity, so which rule wins is unchanged. The root rule
 * itself is absent on purpose: the div this root replaces (Anvil's
 * .anvil-html-templated-panel wrapper) carried no declarations, and these are
 * mounted components rather than screens, so no position/flex/min-height is
 * added either.
 *
 * .cs-scanner-container is a CHILD of the root, not the root, so its rule stays
 * a scoped rule.
 *
 * The pxFadeIn and pxSpin animation idents are app-wide (theme.css and the
 * shared dependency's injected theme) and are used here unchanged.
 */

:where(.cs-root) .cs-scanner-container {
  font-family: var(--px-font);
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 12px auto;
  overflow: hidden;
  border-radius: 8px;
}

:where(.cs-root) .cs-scanner-video {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  background: #000;
  border-radius: 8px;
  display: block;
}

@media (max-width: 600px) {
  :where(.cs-root) .cs-scanner-video {
    max-height: 300px;
  }
  :where(.cs-root) .cs-scanner-frame {
    width: 200px;
    height: 200px;
  }
}

:where(.cs-root) .cs-scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

:where(.cs-root) .cs-scanner-frame {
  width: 350px;
  height: 350px;
  border: 2px solid #4CAF50;
  border-radius: 8px;
  position: relative;
}

:where(.cs-root) .cs-scanner-frame::before,
:where(.cs-root) .cs-scanner-frame::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border: 3px solid #4CAF50;
}

:where(.cs-root) .cs-scanner-frame::before {
  top: -3px;
  left: -3px;
  border-right: none;
  border-bottom: none;
}

:where(.cs-root) .cs-scanner-frame::after {
  bottom: -3px;
  right: -3px;
  border-left: none;
  border-top: none;
}

:where(.cs-root) .cs-scanner-status {
  text-align: center;
  padding: 10px;
  margin-top: 10px;
  border-radius: 4px;
  font-weight: 500;
}

:where(.cs-root) .cs-scanner-status.scanning {
  background: #E3F2FD;
  color: #1976D2;
}

:where(.cs-root) .cs-scanner-status.success {
  background: #E8F5E9;
  color: #388E3C;
}

:where(.cs-root) .cs-scanner-status.error {
  background: #FFEBEE;
  color: #C62828;
}

:where(.cs-root) .cs-success-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(76, 175, 80, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: 8px;
  animation: pxFadeIn 0.3s ease-in;
}

:where(.cs-root) .cs-scanner-video.cs-cooldown-blur {
  filter: blur(8px);
  transition: filter 0.2s ease;
}

:where(.cs-root) .cs-success-overlay.show {
  display: flex;
}

:where(.cs-root) .cs-success-message {
  text-align: center;
  color: white;
}

:where(.cs-root) .cs-success-message .icon {
  font-size: 120px;
  margin-bottom: 20px;
}

:where(.cs-root) .cs-success-message .text {
  font-size: 48px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

:where(.cs-root) .cs-failure-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(198, 40, 40, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: 8px;
  animation: pxFadeIn 0.3s ease-in;
}

:where(.cs-root) .cs-failure-overlay.show {
  display: flex;
}

:where(.cs-root) .cs-failure-message {
  text-align: center;
  color: white;
}

:where(.cs-root) .cs-failure-message .icon {
  font-size: 120px;
  margin-bottom: 20px;
}

:where(.cs-root) .cs-failure-message .text {
  font-size: 48px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

:where(.cs-root) .cs-processing-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FF9800;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  border-radius: 8px;
}

:where(.cs-root) .cs-processing-overlay.show {
  display: flex;
}

:where(.cs-root) .cs-processing-message {
  text-align: center;
  color: white;
}

:where(.cs-root) .cs-processing-message .spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255,255,255,0.3);
  border-top: 6px solid white;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: pxSpin 1s linear infinite;
}

:where(.cs-root) .cs-processing-message .text {
  font-size: 36px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
