/* =========================================
   THE 35 mm x 45 mm PHOTO WINDOW (photo-fit.js)
   Opens when a photo is chosen on the player form, the Coach / Manager form (also inside the dashboards' "Add a new ..."
   window) and, as the EDIT window, from the Edit button of the Photo Upload column of the AGSCD dashboard. Same look as the
   dashboards' other windows: grey body, black border, red X, salmon Cancel and lime OK. The frame in the middle is always
   7 : 9 (35 mm : 45 mm), its size is set by photo-fit.js. (The photo rules, their warning and their pictures are gone since 2026-11-01.)
   ========================================= */
.photo-fit-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-fit-dialog {
  position: relative;
  box-sizing: border-box;
  width: 400px;
  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-fit-dialog .photo-fit-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-fit-dialog .photo-fit-close::before,
.photo-fit-dialog .photo-fit-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 4px;
  border-radius: 3px;
  background: #d62828;
}

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

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

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

.photo-fit-size {
  margin: 4px 0 12px;
  font-size: 1.05rem;
  font-weight: 800;
}

/* the 35 : 45 frame: the picture behind it is moved and zoomed, only what is inside is saved */
.photo-fit-stage {
  position: relative;
  box-sizing: content-box;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid #111111;
  background: #bdbdbd;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.photo-fit-stage.photo-fit-grabbing {
  cursor: grabbing;
}

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

.photo-fit-img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* four corner marks on the frame, white on a dark edge so they show on any photo */
.photo-fit-corners {
  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' stroke-linecap='square'%3E%3Cpath d='M4 34V4H34M106 4H136V34M4 146V176H34M106 176H136V146' stroke='%23000' stroke-opacity='.55' stroke-width='7'/%3E%3Cpath d='M4 34V4H34M106 4H136V34M4 146V176H34M106 176H136V146' stroke='%23fff' stroke-width='3'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}

.photo-fit-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 300px);
  margin: 14px auto 0;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}

.photo-fit-slider {
  flex: 1;
  min-width: 0;
  height: 28px;
  margin: 0;
  cursor: pointer;
}

.photo-fit-slider:disabled {
  cursor: default;
  opacity: 0.45;
}

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

.photo-fit-error {
  margin: 8px 4px 0;
  color: #a61b1b;
  font-size: 0.95rem;
  font-weight: 700;
}

.photo-fit-error:empty {
  display: none;
}

.photo-fit-buttons {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
}

.photo-fit-btn {
  min-width: 120px;
  padding: 9px 16px;
  border: 1px solid #333333;
  border-radius: 8px;
  color: #000000;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

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

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

.photo-fit-btn-ok {
  background: #b4d918;
}

.photo-fit-btn-ok:hover {
  background: #a3c714;
}

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

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

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

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

.photo-fit-wide .photo-fit-title {
  padding: 0 44px 0 0;
}

.photo-fit-wide .photo-fit-size {
  margin: 4px 0 8px;
}

.photo-fit-wide .photo-fit-zoom {
  margin-top: 6px;
}

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

.photo-fit-wide .photo-fit-buttons {
  margin-top: 12px;
}

@media (max-width: 520px) {
  .photo-fit-dialog {
    padding: 12px 12px 16px;
    border-radius: 16px;
  }
  .photo-fit-btn {
    flex: 1;
    min-width: 0;
  }
  .photo-fit-buttons {
    gap: 12px;
  }
}

/* ---------- the face guide on the frame: where the head goes (it is only drawn over the frame, it is not in the saved photo) ---------- */
.photo-fit-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 EDIT window of the Photo Upload column (AGSCD): the person's name, a Replace / Remove row, what is happening, the question before a removal ---------- */
.photo-fit-name {
  margin: -6px 4px 10px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* the words inside an empty frame: "Loading the photo...", "There is no photo yet." */
.photo-fit-empty {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  padding: 0 14px;
  transform: translateY(-50%);
  color: #222222;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
}

.photo-fit-empty:empty {
  display: none;
}

.photo-fit-stage.photo-fit-empty-state {
  cursor: default;
}

.photo-fit-stage.photo-fit-empty-state .photo-fit-guide {
  display: none;
}

.photo-fit-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 14px;
}

.photo-fit-btn-replace {
  background: #ffd700;
}

.photo-fit-btn-replace:hover:not(:disabled) {
  background: #ffe14d;
}

.photo-fit-btn-remove {
  background: #ffffff;
  border-color: #a61b1b;
  color: #a61b1b;
}

.photo-fit-btn-remove:hover:not(:disabled) {
  background: #ffe9e6;
}

.photo-fit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.photo-fit-status {
  margin: 8px 4px 0;
  color: #333333;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.photo-fit-status:empty {
  display: none;
}

.photo-fit-working,
.photo-fit-working .photo-fit-btn,
.photo-fit-working .photo-fit-stage {
  cursor: progress;
}

.photo-fit-confirm {
  margin-top: 14px;
  padding: 10px 12px 14px;
  border: 2px solid #d62828;
  border-radius: 10px;
  background: #fff2f0;
}

.photo-fit-confirm[hidden] {
  display: none;
}

.photo-fit-confirm-text {
  margin: 0 0 10px;
  color: #a61b1b;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.photo-fit-confirm .photo-fit-buttons {
  margin-top: 0;
}

/* while the question "Remove this photo?" is shown, the other buttons wait */
.photo-fit-confirming .photo-fit-actions,
.photo-fit-confirming .photo-fit-main-buttons {
  display: none;
}

/* a phone turned sideways: the edit window has more rows, so the frame spans more of them and the long help line is left out */
.photo-fit-wide.photo-fit-edit > .photo-fit-stage {
  grid-row: 1 / span 9;
}

.photo-fit-wide.photo-fit-edit .photo-fit-help {
  display: none;
}

.photo-fit-wide .photo-fit-actions {
  margin-top: 8px;
}

@media (max-width: 520px) {
  .photo-fit-actions {
    gap: 12px;
  }
  .photo-fit-actions .photo-fit-btn {
    flex: 1;
    min-width: 0;
  }
}
