/* ==========================================================================
   MOBILE RESPONSIVE AR PHOTOBOOTH - CLEAN CAMERA UI
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   CAMERA VIEWPORT (MOBILE RESPONSIVE FRAME)
   ========================================================================== */

.camera-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 520px;
  overflow: hidden;
  background-color: #000000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#outputCanvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   WHITE CIRCLE SHUTTER BUTTON (INSIDE FRAME, CENTERED AT BOTTOM)
   ========================================================================== */

.shutter-circle-btn {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 20;
  outline: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shutter-circle-btn:active {
  transform: translateX(-50%) scale(0.92);
}

.circle-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #ffffff;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.shutter-circle-btn:active .circle-inner {
  transform: scale(0.88);
  background-color: #e5e5e5;
}

/* ==========================================================================
   SHUTTER FLASH
   ========================================================================== */

.shutter-flash {
  position: absolute;
  inset: 0;
  background-color: #ffffff;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s ease-out;
}

.shutter-flash.flash-active {
  opacity: 1;
  transition: none;
}

/* ==========================================================================
   LOADING & STATUS OVERLAY
   ========================================================================== */

.camera-loader {
  position: absolute;
  inset: 0;
  background: #000000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  z-index: 40;
  color: #ffffff;
  transition: opacity 0.3s ease;
}

.camera-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

#loaderText {
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #cccccc;
}

/* ==========================================================================
   CAPTURE PREVIEW MODAL
   ========================================================================== */

.preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}

.preview-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.preview-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#previewImg {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: block;
}

.preview-actions {
  display: flex;
  width: 100%;
  gap: 12px;
}

.btn-save {
  flex: 1;
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  padding: 14px 20px;
  border-radius: 30px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease;
}

.btn-save:active {
  transform: scale(0.96);
}

.btn-retake {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 14px 20px;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.btn-retake:active {
  transform: scale(0.96);
}

/* On desktop, keep a phone-like aspect ratio with rounded corners */
@media (min-width: 521px) {
  .camera-viewport {
    height: 92vh;
    border-radius: 28px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
  }
}
