body {
  margin: 0px;
  padding: 0px;
  background: #000;
}

#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #d2dfd5ff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

#upload_overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#upload_overlay.hidden {
  display: none;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid white;
  border-top: 6px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

#vid_container {
  position: fixed;
  top: 0;
  left: 0;
}

#vid_container canvas, #video {
  position: fixed;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#video {
  z-index: 100;
}

#vid_container canvas {
  z-index: 200;
}

#gui_controls {
  position: fixed;
  background-color: #111; /*rgba(255, 0, 0, 0.5);*/
  z-index: 2;
  bottom: 0;
}

#camera_controls,
#upload_controls {
  display: flex;
  gap: 20px;
}

#upload_controls {
  display: none;
}

#video_overlay {
  position: fixed;
  display: none;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;

  z-index: 10;
  background-color: #111;
}

/*  Button style from: 
    https://googlesamples.github.io/web-fundamentals/fundamentals/media/mobile-web-video-playback.html */

button {
  outline: none;
  position: absolute;
  color: white;
  display: block;
  opacity: 1;
  background: transparent;
  border: solid 2px #fff;
  padding: 0;
  text-shadow: 0px 0px 4px black;
  background-position: center center;
  background-repeat: no-repeat;
  pointer-events: auto;
  z-index: 2;
}

#takePhotoButton {
  left: calc(50% - 40px);
  top: calc(50% - 40px);
  width: 80px;
  height: 80px;
  background-image: url('img/ic_photo_camera_white_48px.svg');
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
}

#takePhotoButton:active {
  background-color: #fff;
}

#cancelButton {
  width: 80px;
  height: 80px;
  background-image: url('img/ic_cancel_white_48px.svg');
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
}

#cancelButton:active {
  background-color: #fff;
}

#uploadButton {
  width: 80px;
  height: 80px;
  background-image: url('img/ic_upload_white_48px.svg');
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
}

#uploadButton:active {
  background-color: #fff;
}

#toggleFullScreenButton {
  display: none;
  width: 64px;
  height: 64px;
  background-image: url('img/ic_fullscreen_white_48px.svg');
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
}

#toggleFullScreenButton[aria-pressed='true'] {
  background-image: url('img/ic_fullscreen_exit_white_48px.svg');
}

#switchCameraButton {
  display: none;
  width: 64px;
  height: 64px;
  background-image: url('img/ic_camera_rear_white_36px.svg');
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
}

#switchCameraButton[aria-pressed='true'] {
  background-image: url('img/ic_camera_front_white_36px.svg');
}

#welcome_screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #d2dfd5ff;
  color: #333;
  display: flex;
  justify-content: center;       /* vertically center */
  align-items: center;           /* horizontally center */
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
  text-align: center;
  z-index: 10000;
  overflow: auto;
}

#couple_photo {
  max-width: 300px;
  width: 80%;
  height: auto;
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#welcome_screen h1,
#welcome_screen p {
  margin: 10px 0;
}

#welcome_screen div {
  display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#welcome_screen input {
  padding: 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 250px;
  max-width: 80%;
  box-sizing: border-box;
  margin-bottom: 12px;
}

#welcome_screen button {
  margin-top: 100px;
  padding: 12px 24px;
  font-size: 16px;
  background-color: #2e7d32;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#welcome_screen button:hover {
  background-color: #1b5e20;
}

#user_info {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
  font-size: 18px;
  font-weight: 500;
  color: white;
}

#greeting_wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 12px;
  border-radius: 12px;
}

#change_name_button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#change_name_button i {
  font-size: 18px;
  color: white;
}

#change_name_button:hover i {
  color: #ccc;
}

.upload-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  z-index: 1000;
  text-align: center;
  max-width: 90vw;
  width: 300px;
  border-radius: 10px;
  font-size: 1rem;
}

.upload-dialog-message {
  margin-bottom: 15px;
}

.upload-dialog-button {
  padding: 10px 20px;
  border: none;
  background: #007bff;
  color: #fff;
  border-radius: 5px;
  font-size: 1rem;
  cursor: pointer;
}


@media screen and (orientation: portrait) {
  /* portrait-specific styles */

  /* video_container (video) doesn't respect height... 
       so we will fill it in completely in portrait mode
    */
  #vid_container {
    width: 100%;
    height: 80%;
  }

  #gui_controls {
    width: 100%;
    height: 20%;
    left: 0;
  }

  #switchCameraButton {
    left: calc(20% - 32px);
    top: calc(50% - 32px);
  }

  #toggleFullScreenButton {
    left: calc(80% - 32px);
    top: calc(50% - 32px);
  }

  #cancelButton {
    left: calc(30% - 40px);
    top: calc(50% - 40px);
  }

  #uploadButton {
    left: calc(70% - 40px);
    top: calc(50% - 40px);
  }
}

@media screen and (orientation: landscape) {
  #vid_container {
    width: 80%;
    height: 100%;
  }

  #vid_container.left {
    left: 20%;
  }

  /* we default to right */
  #gui_controls {
    width: 20%;
    height: 100%;
    right: 0;
  }

  /* for the lefties */
  #gui_controls.left {
    left: 0;
  }

  #switchCameraButton {
    left: calc(50% - 32px);
    top: calc(18% - 32px);
  }

  #toggleFullScreenButton {
    left: calc(50% - 32px);
    top: calc(82% - 32px);
  }

  #cancelButton {
    left: calc(50% - 40px);
    top: calc(30% - 40px);
  }

  #uploadButton {
    left: calc(50% - 40px);
    top: calc(70% - 40px);
  }
}
