/**
 * KNOMAD Mobile CSS — mobile-camera.css
 * Extracted from mobile.css per PRD-64
 */

/* ===========================================
   Camera Capture Overlay (from camera_capture.js)
   =========================================== */
.camera-overlay {
  position: fixed;
  /* Safari <14.5 fallback */
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: #000;
  z-index: 10000;
  display: flex;
  flex-direction: column;
}

.camera-video {
  flex: 1;
  width: 100%;
  object-fit: cover;
}

.camera-controls {
  position: absolute;
  bottom: calc(var(--safe-bottom, 0px) + 2rem);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 0 2rem;
}

.camera-btn {
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-btn--capture {
  width: 72px;
  height: 72px;
  background: #fff;
  border: 4px solid rgba(255,255,255,0.5);
}

.camera-btn--capture:active {
  transform: scale(0.95);
}

.camera-btn--cancel,
.camera-btn--flip {
  width: 48px;
  height: 48px;
  font-size: 0.875rem;
}

/* Photo viewing overlay */
.photo-view-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.photo-view-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.photo-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
}

/* Target photo thumbnail */
.target-photo-thumb {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.5);
  cursor: pointer;
  z-index: 10;
}

.target-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.target-photo-thumb:hover {
  border-color: #ff9800;
}

/* ===========================================
   Photo Tracer Overlay (from photo_tracer.js)
   =========================================== */
.photo-tracer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 10001;
  display: flex;
  flex-direction: column;
}

.photo-tracer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding-top: calc(var(--safe-top, 0px) + 12px);
}

.photo-tracer-title {
  font-weight: 600;
  font-size: 1rem;
}

.photo-tracer-instruction {
  font-size: 0.875rem;
  color: #00ff00;
  animation: pulse-instruction 1.5s infinite;
}

@keyframes pulse-instruction {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* The canvas is sized to the box the rows leave it (photo_tracer.js loadImage): its pixels are its CSS box, so a tap,
   the + and the lock read one set of pixels, and no row clips the photo (PHOTO-LOCK-1-S1A). */
.photo-tracer-canvas {
  flex: none;
  display: block;
  margin: auto;
  touch-action: none;
}

/* THE LOCK (PHOTO-LOCK-1-S1A): the green square's one word, the (i), its sentences, the time's pill, the foot's cells. */
.tracer-square-word {
  position: absolute;
  transform: translate(-50%, -100%);
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid #00e676;
  border-radius: 6px 6px 0 0;
  background: rgba(0, 0, 0, 0.7);
  color: #00e676;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.tracer-square-word:disabled {
  opacity: 1;
  cursor: default;
}

.photo-tracer-header {
  position: relative;
}

.tracer-info > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 32px;
  height: 32px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-style: italic;
  font-weight: 700;
}

.tracer-info > summary::-webkit-details-marker {
  display: none;
}

.photo-tracer-info {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 2;
  padding: 6px 12px;
  font-size: 0.85rem;
  line-height: 1.35;
  color: #eef;
  background: rgba(0, 0, 0, 0.85);
}

.photo-tracer-info p {
  margin: 0 0 6px;
}

.tracer-btn--lock {
  background: #00c853;
  color: #000;
  font-weight: 700;
}

.photo-tracer-station {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 6px 10px;
  font-size: 0.85rem;
  color: #eef;
  background: rgba(0, 0, 0, 0.6);
}

.tracer-cell {
  min-height: 36px;
  font-size: 16px;
  margin-left: 6px;
}

.tracer-cell--in {
  width: 4.5em;
}

.tracer-pill {
  min-height: 32px;
  padding: 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.photo-tracer-say {
  margin: 0;
  padding: 4px 10px;
  font-size: 0.85rem;
  color: #fc6;
  background: rgba(0, 0, 0, 0.6);
}

.photo-tracer-distance {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #fff;
}

.tracer-distance-cell {
  height: 44px;
  box-sizing: border-box;
  font-size: 20px;
  font-weight: 700;
  width: 4em;
}

.tracer-distance-word {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  line-height: 1.15;
}

.photo-tracer-controls {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 16px;
  padding-bottom: calc(var(--safe-bottom, 0px) + 16px);
  background: rgba(0, 0, 0, 0.8);
  gap: 12px;
}

.tracer-btn {
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.tracer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tracer-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.tracer-btn--undo {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.tracer-btn--done {
  background: #4CAF50;
  color: #fff;
  flex: 1;
  max-width: 200px;
}

.tracer-btn--cancel {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.photo-tracer-status {
  position: absolute;
  top: calc(var(--safe-top, 0px) + 60px);
  right: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Canvas wrapper for overflow clipping during zoom */
.photo-tracer-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Zoom controls bar */
.photo-tracer-zoom-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
}

.tracer-zoom-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tracer-zoom-btn:active {
  background: rgba(255, 255, 255, 0.4);
}

#tracerZoomLevel {
  font-size: 0.875rem;
  color: #fff;
  min-width: 40px;
  text-align: center;
}

#tracerZoomFit {
  width: auto;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 0.875rem;
}

/* ===========================================
   Photo Overlay on Target (align grid to photo)
   =========================================== */
.photo-overlay-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: auto;
}

.photo-overlay-container.locked {
  pointer-events: none;
}

.photo-overlay-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: none;
  max-height: none;
  width: 100%;
  height: auto;
  object-fit: contain;
  touch-action: none;
  cursor: grab;
}

.photo-overlay-img:active {
  cursor: grabbing;
}

.photo-overlay-controls {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  padding: 6px 10px;
  border-radius: 20px;
}

.overlay-ctrl-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-ctrl-btn:active {
  background: rgba(255, 255, 255, 0.4);
}

.overlay-done-btn {
  background: #4CAF50;
}

.overlay-remove-btn {
  background: rgba(244, 67, 54, 0.8);
}

.mobile-photo-editor {
  position: fixed;
  inset: 0;
  z-index: 10002;
}

.mobile-photo-editor__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.88);
}

.mobile-photo-editor__sheet {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top, 0px) + 12px) 14px calc(var(--safe-bottom, 0px) + 16px);
  gap: 12px;
}

.mobile-photo-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
}

.mobile-photo-editor__title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobile-photo-editor__close,
.mobile-photo-editor__btn {
  min-height: 42px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.mobile-photo-editor__close {
  padding: 0 14px;
}

.mobile-photo-editor__stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-photo-editor__image {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(120vw, 100%);
  max-width: none;
  max-height: none;
  object-fit: contain;
  touch-action: none;
  user-select: none;
}

.mobile-photo-editor__stats {
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
}

.mobile-photo-editor__controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mobile-photo-editor__btn {
  padding: 0 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.mobile-photo-editor__btn--primary {
  background: rgba(76, 175, 80, 0.92);
}

.mobile-photo-editor__btn--danger {
  background: rgba(244, 67, 54, 0.88);
}

