/*
 * Camera capture flow styles (cart page TAKE PHOTO). Ported from the scoped <style> blocks of
 * ClientSpecs/CardUploaderPrototype/CardCapture.vue (.cc*) and CardUploadFlow.vue (.cuf*). Hand-written
 * rather than Tailwind: this is a full-screen camera surface, not a themed page section. The accent
 * follows the site's gold (--color-secondary in DESIGN.md) instead of the prototype's green.
 */

.gra-cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
}

/* ---------------------------------------------------------------- CardCapture */
.cc {
  --cc-frame: rgba(255, 255, 255, 0.85);
  --cc-locked: #ffd700;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  background: #000;
  overflow: hidden;
  color: #fff;
  font: 500 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
}
.cc__video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.cc--nocamera .cc__video { display: none; }
.cc__overlay {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.cc__scrim { fill: rgba(0, 0, 0, 0.55); }
.cc__frame {
  fill: none;
  stroke: var(--cc-frame);
  stroke-width: 2;
  transition: stroke 150ms ease;
}
.cc--locked .cc__frame { stroke: var(--cc-locked); }
.cc__progress {
  fill: none;
  stroke: var(--cc-locked);
  stroke-width: 5;
  stroke-linecap: round;
}
.cc__flash {
  position: absolute; inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}
.cc__flash.is-on { opacity: 0.8; transition: none; }
.cc__hint {
  position: absolute; left: 0; right: 0;
  margin: 0;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
.cc__controls {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
}
.cc__shutter {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  padding: 0;
  position: relative;
  cursor: pointer;
}
.cc__shutter::after {
  content: "";
  position: absolute; inset: 5px;
  border-radius: 50%;
  background: #fff;
  transition: transform 100ms ease;
}
.cc__shutter:active::after { transform: scale(0.85); }
.cc__shutter:disabled { opacity: 0.35; cursor: default; }
.cc__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
}
.cc__btn[aria-pressed="true"] { background: #fff; color: #000; }
.cc__spacer { width: 48px; height: 48px; }
.cc__shutter:focus-visible, .cc__btn:focus-visible {
  outline: 3px solid var(--cc-locked);
  outline-offset: 3px;
}
.cc__file { display: none; }
.cc__diag {
  position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.cc__debug {
  margin: 0; padding: 6px 8px;
  font: 11px/1.4 ui-monospace, monospace;
  white-space: pre-wrap; word-break: break-word;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 6px;
  color: #fff;
}
.cc__diag-row { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.cc__diag-select {
  flex: 1; min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 6px;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  font: 600 12px/1 system-ui, sans-serif;
}
.cc__diag-label { font: 600 12px/1 ui-monospace, monospace; color: #fff; text-shadow: 0 1px 2px #000; min-width: 64px; }
.cc__diag-range { flex: 1; accent-color: var(--cc-locked); }
.cc__diag-btn {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 6px;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  font: 600 12px/1 system-ui, sans-serif;
  cursor: pointer;
}

/* ---------------------------------------------------------------- CardUploadFlow */
.cuf {
  --cuf-accent: #ffd700;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 520px;
  background: #000;
  color: #fff;
  font: 500 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.cuf__bar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px;
}
.cuf__close {
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent; color: #fff;
  font-size: 18px; cursor: pointer;
}
.cuf__title { text-align: center; }
.cuf__steps { display: flex; gap: 6px; justify-content: flex-end; }
.cuf__steps i {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}
.cuf__steps i.current { background: #fff; }
.cuf__steps i.done { background: var(--cuf-accent); }

.cuf__stage { position: relative; flex: 1; min-height: 0; }
.cuf__camera { position: absolute; inset: 0; min-height: 0; }

.cuf__review {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: #000;
}
.cuf__preview {
  max-width: 78%;
  max-height: 62%;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.cuf__thumbs { display: flex; gap: 16px; }
.cuf__thumbs img { height: 180px; border-radius: 6px; object-fit: contain; }
.cuf__question { margin: 0; text-align: center; color: rgba(255, 255, 255, 0.85); }
.cuf__actions { display: flex; gap: 12px; width: 100%; max-width: 420px; }
.cuf__btn {
  flex: 1;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cuf__btn--primary { background: var(--cuf-accent); color: #191022; border-color: var(--cuf-accent); flex: 2; }
.cuf__btn:focus-visible, .cuf__close:focus-visible { outline: 3px solid var(--cuf-accent); outline-offset: 2px; }
.cuf__spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--cuf-accent);
  animation: cuf-spin 0.8s linear infinite;
}
@keyframes cuf-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .cc__frame, .cc__flash, .cc__shutter::after { transition: none; }
  .cuf__spinner { animation-duration: 2s; }
}
