/* ============================================
   CAMERA CAPTURE MODAL - RAF-13 Phase 2
   WebRTC camera with live preview
   ============================================ */

/* Camera Modal Backdrop */
.camera-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: none;
}

.camera-modal-backdrop.show {
  opacity: 1;
}

.camera-modal-backdrop.hidden {
  display: none;
}

/* Camera Modal Container */
.camera-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  height: 80vh;
  max-height: 800px;
  background: #1a1a1a;
  border-radius: 16px;
  overflow: hidden;
  z-index: 10001;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
}

.camera-modal.show {
  display: flex;
  animation: modalSlideIn 0.3s ease-out;
}

/* Camera Header */
.camera-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #2a2a2a;
  border-bottom: 1px solid #444;
  flex-shrink: 0;
}

.camera-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: white;
  margin: 0;
}

.camera-modal-title svg {
  width: 24px;
  height: 24px;
  color: #4BC451;
}

.camera-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: white;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  padding: 0;
}

.camera-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.camera-modal-close svg {
  width: 20px;
  height: 20px;
}

/* Camera Video Container */
.camera-modal-body {
  position: relative;
  background: #000;
  overflow: hidden;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Car Orientation Guide Overlay */
.car-guide-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  max-width: 400px;
  height: auto;
  pointer-events: none;
  z-index: 5;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.car-guide-overlay.hidden {
  opacity: 0;
}

.car-guide-overlay svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 8px rgba(75, 196, 81, 0.8)) 
          drop-shadow(0 0 16px rgba(75, 196, 81, 0.6))
          drop-shadow(0 0 24px rgba(75, 196, 81, 0.4));
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(75, 196, 81, 0.8)) 
            drop-shadow(0 0 16px rgba(75, 196, 81, 0.6))
            drop-shadow(0 0 24px rgba(75, 196, 81, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(75, 196, 81, 1)) 
            drop-shadow(0 0 24px rgba(75, 196, 81, 0.8))
            drop-shadow(0 0 36px rgba(75, 196, 81, 0.6));
  }
}

/* Guide instruction text */
.car-guide-instruction {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #4BC451;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  z-index: 6;
  pointer-events: none;
  border: 2px solid rgba(75, 196, 81, 0.5);
  box-shadow: 0 0 16px rgba(75, 196, 81, 0.3);
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* Ensure video is visible when stream is active */
.camera-video[src] {
  opacity: 1;
}

.camera-canvas {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
}

/* Loading/Permission State */
.camera-loading,
.camera-permission-denied {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  color: white;
  text-align: center;
  padding: 20px;
  z-index: 10;
}

.camera-loading.hidden,
.camera-permission-denied.hidden {
  display: none !important;
}

.camera-loading svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  animation: spin 1s linear infinite;
}

.camera-permission-denied svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: #dc3545;
}

.camera-loading h3,
.camera-permission-denied h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.camera-loading p,
.camera-permission-denied p {
  font-size: 14px;
  color: #999;
  margin: 0;
}

/* Camera Controls */
.camera-modal-footer {
  padding: 20px;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-shrink: 0;
}

.camera-capture-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid white;
  background: #4BC451;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 4px 12px rgba(75, 196, 81, 0.3);
}

.camera-capture-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(75, 196, 81, 0.4);
}

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

.camera-capture-btn svg {
  width: 32px;
  height: 32px;
  color: white;
}

/* Camera switch button (front/back) */
.camera-switch-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid white;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  color: white;
}

.camera-switch-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.camera-switch-btn svg {
  width: 24px;
  height: 24px;
}

/* Animations */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .camera-modal {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
  }
  
  .camera-modal-body {
    height: calc(100vh - 140px);
    aspect-ratio: auto;
  }
  
  .camera-capture-btn {
    width: 72px;
    height: 72px;
  }
}

/* Portrait mode optimization */
@media (max-width: 768px) and (orientation: portrait) {
  .camera-modal-body {
    aspect-ratio: 3 / 4;
  }
}

