/* =========================================
   THE CAMERA OF THE PHOTO UPLOAD (photo-camera.js)
   1. the "Camera" button under the photo box of the player form and the Coach / Manager form (also inside the dashboards' "Add a new ..." window)
   2. the camera window: the same look as the "Photo size" window (photo-fit.css): grey body, black border, red X, salmon Cancel, lime action.
   ========================================= */

/* ---------- 1. the button (hidden until photo-camera.js knows that it can work) ---------- */
.photo-camera-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: 130px;
  min-height: 44px;
  padding: 6px 10px;
  background: #ffffff;
  color: #111111;
  border: 1px solid #777777;
  border-radius: 8px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.photo-camera-btn[hidden] {
  display: none;
}

.photo-camera-btn:hover {
  background: #f7b731;
  border-color: #d89b1c;
}

.photo-camera-btn:focus-visible {
  outline: 3px solid #1d63d6;
  outline-offset: 2px;
}

.photo-camera-btn svg {
  flex: none;
  color: #1d428a;
}

/* inside the dashboards' window the photo box is 154 px wide and the form is white */
.embedded .photo-camera-btn {
  width: 154px;
  border-color: #555555;
  border-radius: 6px;
  box-shadow: none;
}

/* ---------- 2. the camera window ---------- */
.photo-cam-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2100;
  font-family: Arial, Helvetica, sans-serif;
}

.photo-cam-dialog {
  position: relative;
  box-sizing: border-box;
  width: 380px;
  max-width: 94vw;
  max-height: 96vh;
  overflow-y: auto;
  padding: 14px 20px 20px;
  background: #e6e6e6;
  border: 3px solid #111111;
  border-radius: 22px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  color: #000000;
  text-align: center;
}

.photo-cam-dialog [hidden] {
  display: none !important;
}

.photo-cam-dialog .photo-cam-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 3px solid #d62828;
  border-radius: 50%;
  background: #ffffff;
  color: transparent;
  font-size: 0;
  cursor: pointer;
}

.photo-cam-dialog .photo-cam-close::before,
.photo-cam-dialog .photo-cam-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 4px;
  border-radius: 3px;
  background: #d62828;
}

.photo-cam-dialog .photo-cam-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.photo-cam-dialog .photo-cam-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.photo-cam-title {
  margin: 0 0 10px;
  padding: 4px 46px 0;
  font-size: 1.3rem;
  font-weight: 800;
}

/* the 35 : 45 frame (its size is set by photo-camera.js): the live picture of the camera, the face oval on top of it */
.photo-cam-stage {
  position: relative;
  box-sizing: content-box;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid #111111;
  background: #111111;
}

.photo-cam-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111111;
}

/* the PREVIEW is a mirror (like a selfie); the photo that is taken is not turned over */
.photo-cam-video.photo-cam-mirror {
  transform: scaleX(-1);
}

.photo-cam-waiting .photo-cam-video,
.photo-cam-error .photo-cam-video {
  visibility: hidden;
}

/* the same oval and shoulders as in the "Photo size" window */
.photo-cam-guide {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  background: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 180' preserveAspectRatio='none' fill='none'%3E%3Cellipse cx='70' cy='80' rx='35' ry='49' stroke='%23000' stroke-opacity='.45' stroke-width='4.5'/%3E%3Cellipse cx='70' cy='80' rx='35' ry='49' stroke='%23fff' stroke-width='2' stroke-dasharray='6 4'/%3E%3Cpath d='M6 180C14 150 40 134 70 134S126 150 134 180' stroke='%23000' stroke-opacity='.4' stroke-width='4'/%3E%3Cpath d='M6 180C14 150 40 134 70 134S126 150 134 180' stroke='%23fff' stroke-opacity='.9' stroke-width='1.8' stroke-dasharray='6 4'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}

/* the white flash after "Take photo" */
.photo-cam-flash {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}

.photo-cam-flash.photo-cam-flashing {
  animation: photo-cam-flash 220ms ease-out;
}

@keyframes photo-cam-flash {
  from { opacity: 0.95; }
  to { opacity: 0; }
}

/* the message on the frame while the camera starts, or when it cannot be used */
.photo-cam-msg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
}

.photo-cam-msg:empty {
  display: none;
}

/* the button that turns the camera round (only when the device has two) */
.photo-cam-flip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #111111;
  border-radius: 50%;
  background: #ffffff;
  color: #111111;
  cursor: pointer;
}

.photo-cam-flip:focus-visible,
.photo-cam-btn:focus-visible {
  outline: 3px solid #1d63d6;
  outline-offset: 2px;
}

.photo-cam-help {
  margin: 10px 4px 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.photo-cam-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
}

.photo-cam-btn {
  min-width: 110px;
  padding: 9px 16px;
  border: 1px solid #333333;
  border-radius: 8px;
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.photo-cam-btn-cancel {
  background: #ffa698;
}

.photo-cam-btn-cancel:hover {
  background: #ff9585;
}

/* "Take photo": the big lime button with a camera on it */
.photo-cam-btn-shot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 170px;
  padding: 8px 18px;
  background: #b4d918;
  font-size: 1.1rem;
}

.photo-cam-btn-shot:hover:not(:disabled) {
  background: #a3c714;
}

.photo-cam-btn-shot:disabled {
  opacity: 0.45;
  cursor: default;
}

.photo-cam-btn-other {
  display: block;
  margin: 12px auto 0;
  background: #ffffff;
  border-color: #1d63d6;
  color: #1d63d6;
}

/* when the camera cannot be used there is nothing to take: the useless button and the hint go away, so the window stays short */
.photo-cam-error .photo-cam-btn-shot,
.photo-cam-error .photo-cam-help {
  display: none;
}

/* small phones: a little less padding, so that Cancel and Take photo stay side by side */
@media (max-width: 380px) {
  .photo-cam-dialog {
    padding-left: 12px;
    padding-right: 12px;
  }

  .photo-cam-buttons {
    gap: 10px;
  }

  .photo-cam-btn {
    min-width: 92px;
    padding: 9px 12px;
  }

  .photo-cam-btn-shot {
    min-width: 140px;
    padding: 8px 12px;
    font-size: 1rem;
  }
}

/* a short, wide screen (a phone turned sideways): the frame on the left, the title and buttons on the right */
.photo-cam-dialog.photo-cam-wide {
  display: grid;
  grid-template-columns: auto minmax(200px, 260px);
  column-gap: 22px;
  align-content: center;
  width: auto;
  max-width: 96vw;
  padding: 12px 20px 14px;
}

.photo-cam-wide > .photo-cam-stage {
  grid-column: 1;
  grid-row: 1 / span 5;
  align-self: center;
  margin: 0;
}

.photo-cam-wide > :not(.photo-cam-stage):not(.photo-cam-close) {
  grid-column: 2;
}

.photo-cam-wide .photo-cam-title {
  margin: 0 0 4px;
  padding: 0 44px 0 0;
}

.photo-cam-wide .photo-cam-help {
  margin-top: 6px;
  font-size: 0.88rem;
}
