/* Camera Modal - Mobile Style */
.camera-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 0;
  margin: 0;
}

/*
  Fullscreen camera modal on mobile - Dynamic height calculation
  - Uses dvh (dynamic viewport height) to account for browser UI
  - Automatically adjusts when browser navigation bars appear/disappear
  - Provides smooth height transitions on mobile devices
  - Fixed centering issues with proper box-sizing
*/
@media (max-width: 600px), (max-height: 600px) {
  .camera-modal {
    width: 100vw;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    max-width: 100vw;
    max-height: 100dvh;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    /* Ensure flex centering works on mobile */
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .camera-modal .modal__content,
  .camera-container,
  .camera-feed,
  .camera-canvas {
    width: 100vw;
    height: 100dvh; /* Dynamic height adjusts to available viewport */
    max-width: 100vw;
    max-height: 100dvh;
    padding: 0;
    margin: 0; /* Remove any conflicting margins */
  }
  
  /* Fallback for browsers that don't support dvh */
  @supports not (height: 100dvh) {
    .camera-modal {
      height: 100vh; /* Static fallback for older browsers */
      max-height: 100vh;
    }
    .camera-modal .modal__content,
    .camera-container,
    .camera-feed,
    .camera-canvas {
      height: 100vh;
      max-height: 100vh;
    }
  }
}

.camera-modal .modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #000;
  z-index: 20;
  background: #fff;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-modal .modal__content {
  background: transparent;
  overflow: hidden;
  position: relative;
  height: 100%;
  max-width: 400px;
  width: 100%;
  margin: 0; /* Remove margin auto that conflicts with flex centering */
  display: flex;
  flex-direction: column;
}

.camera-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
}

.camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

/* Camera controls bar - Mobile Style */
/*
  Camera controls bar - Mobile Style
  Overlay background removed for transparent/floating controls when flex is active.
  If you want a subtle background for contrast, use background: rgba(0,0,0,0.1) or remove entirely for full transparency.
*/
.camera-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 2rem;
  z-index: 10;
  height: 100px;
  transition: opacity 0.3s ease;
}
 
/* Browser-specific camera control styles */
/* These styles are scoped to the camera modal only */

/* Native UI mode - used when browser provides its own camera UI */
.js-camera-modal .camera-controls--native-ui {
  opacity: 0.8; /* Semi-transparent to avoid conflicting with native controls */
  pointer-events: none; /* Allow native controls to be clicked through */
}


/* Enhanced capture button for browsers that need it */
.js-camera-modal .camera-capture-btn--enhanced {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px #fff, 0 0 20px rgba(0, 0, 0, 0.8);
}

/* Native UI message styles */
.camera-native-ui-message {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 1rem;
  border-radius: 8px;
  max-width: 80%;
  text-align: center;
  z-index: 20;
  animation: fadeIn 0.5s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.camera-native-ui-message__content {
  font-size: 0.9rem;
  line-height: 1.4;
}

.camera-native-ui-message--fade-out {
  animation: fadeOut 0.5s ease forwards;
}

/* Browser-specific camera feed styles */

/* iOS Safari camera feed */
.camera-feed--ios-safari {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* Orientation-specific styles */
.camera-feed--landscape {
  width: 100%;
  height: auto;
  max-height: 100%;
}

.camera-feed--portrait {
  width: auto;
  height: 100%;
  max-width: 100%;
}

/* Animation keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

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


/* Add camera grid overlay */
.camera-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
  border-radius: 10px;
}

/*
  Camera controls button text: add subtle text shadow for better readability over the camera feed.
*/
.camera-controls .btn {
  margin: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: .9rem;
  text-transform: uppercase;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.7), 0 0 1px #000;
}


/* Camera capture button - Mobile Style */
.camera-capture-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  padding: 0;
  position: relative;
  border: 4px solid white;
  box-shadow: 0 0 0 2px #fff, 0 0 15px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s;
}

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

.camera-capture-btn::after {
  content: '';
  position: absolute;
  width: 80%;
  height: 80%;
  background: #fff;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.2s;
}

.camera-capture-btn:active::after {
  width: 70%;
  height: 70%;
}

.camera-controls .btn {
  margin: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: .9rem;
  text-transform: uppercase;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.7), 0 0 1px #000;
}
