/* =========================================
   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 when AGSCD replaces a photo. 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.
   ========================================= */
.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,
.photo-rules-dialog .photo-rules-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,
.photo-rules-dialog .photo-rules-close::before,
.photo-rules-dialog .photo-rules-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,
.photo-rules-dialog .photo-rules-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.photo-fit-dialog .photo-fit-close::after,
.photo-rules-dialog .photo-rules-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;
}

/* a phone turned sideways: the list of problems is made smaller and the long help line is hidden, so that the buttons stay in reach */
.photo-fit-wide.photo-fit-has-problems .photo-fit-help {
  display: none;
}

.photo-fit-wide .photo-fit-problems {
  margin-top: 8px;
  padding: 6px 8px;
}

.photo-fit-wide .photo-fit-problems .photo-fit-problem-pic {
  width: 52px;
  padding-top: 45px;
}

.photo-fit-wide .photo-fit-problem-words {
  font-size: 0.82rem;
  line-height: 1.25;
}

.photo-fit-wide .photo-fit-problems-title {
  margin-bottom: 4px;
  font-size: 0.9rem;
}

@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;
}

.photo-fit-rules-link {
  display: block;
  margin: 10px auto 0;
  padding: 7px 16px;
  border: 2px solid #1d63d6;
  border-radius: 8px;
  background: #ffffff;
  color: #1d63d6;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.photo-fit-rules-link:hover {
  background: #eaf1ff;
}

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

/* ---------- what the check found (photo-check.js) ---------- */
.photo-fit-problems {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 2px solid #d62828;
  border-radius: 10px;
  background: #fff2f0;
  text-align: left;
}

.photo-fit-problems[hidden],
.photo-fit-btn-anyway[hidden] {
  display: none !important;
}

.photo-fit-problems-title {
  margin: 0 0 8px;
  color: #a61b1b;
  font-size: 0.98rem;
  font-weight: 800;
}

.photo-fit-problems ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-fit-problem {
  display: flex;
  align-items: center;
  gap: 10px;
}

.photo-fit-problems .photo-fit-problem-pic {
  flex: none;
  width: 78px;
  height: 0;
  padding-top: 67px;                          /* (a small picture; the plain .photo-rules-pic below is as wide as its box) */
  border: 2px solid #d62828;
  border-radius: 6px;
  box-sizing: content-box;
}

.photo-fit-problem-mark {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #d62828;
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 900;
}

.photo-fit-problem-words {
  font-size: 0.92rem;
  line-height: 1.3;
}

.photo-fit-btn.photo-fit-checking {
  cursor: progress;
  opacity: 0.85;
}

.photo-fit-btn-anyway {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  background: #ffffff;
  border-color: #a61b1b;
  color: #a61b1b;
}

.photo-fit-btn-anyway:hover {
  background: #ffe9e6;
}

/* ---------- the six pictures of the official examples (one picture file, 3 x 2) ---------- */
.photo-rules-pic {
  display: block;
  width: 100%;
  height: 0;
  padding-top: 86.4%;                         /* 162 : 140, the shape of each picture */
  background: #d9d9d9 url("photo-rules.jpg") 0 0 / 300% 200% no-repeat;
}

.photo-rules-pic[data-pic="good"]    { background-position: 0% 0%; }
.photo-rules-pic[data-pic="up"]      { background-position: 50% 0%; }
.photo-rules-pic[data-pic="turned"]  { background-position: 100% 0%; }
.photo-rules-pic[data-pic="dark"]    { background-position: 0% 100%; }
.photo-rules-pic[data-pic="glasses"] { background-position: 50% 100%; }
.photo-rules-pic[data-pic="busy"]    { background-position: 100% 100%; }

/* ---------- the PHOTO RULES window ---------- */
.photo-rules-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.65);
  z-index: 2200;
  font-family: Arial, Helvetica, sans-serif;
}

.photo-rules-dialog {
  position: relative;
  box-sizing: border-box;
  width: 620px;
  max-width: 100%;
  max-height: 96vh;
  overflow-y: auto;
  padding: 14px 20px 18px;
  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-rules-title {
  margin: 0;
  padding: 4px 46px 0;
  font-size: 1.4rem;
  font-weight: 800;
}

.photo-rules-lead {
  margin: 6px 0 12px;
  font-size: 1.02rem;
}

.photo-rules-good {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 22px;
}

.photo-rules-figure {
  position: relative;
  margin: 0;
}

.photo-rules-figure-good {
  width: 176px;
}

.photo-rules-figure figcaption {
  margin-top: 5px;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
}

.photo-rules-figure .photo-rules-pic {
  border: 2px solid #111111;
  border-radius: 6px;
}

.photo-rules-figure-good .photo-rules-pic {
  border-color: #1b8a1b;
}

.photo-rules-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.photo-rules-badge-yes {
  background: #1b8a1b;
}

.photo-rules-badge-no {
  background: #d62828;
}

.photo-rules-list {
  margin: 0;
  padding: 0 0 0 22px;
  max-width: 330px;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.photo-rules-sub {
  margin: 16px 0 10px;
  color: #a61b1b;
  font-size: 1.1rem;
  font-weight: 800;
}

.photo-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 14px 12px;
}

.photo-rules-also {
  margin: 14px 4px 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.photo-rules-source {
  margin: 8px 0 0;
  color: #555555;
  font-size: 0.8rem;
}

.photo-rules-buttons {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

/* ---------- the WARNING window: opens on top of the photo window when the check refuses a photo (photo-fit.js) ----------
   The look of the warning other official websites show: white card, orange "!", "Warning", one bold line, one OK button. */
.photo-warn-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2300;
  font-family: Arial, Helvetica, sans-serif;
}

.photo-warn-dialog {
  box-sizing: border-box;
  width: 440px;
  max-width: 100%;
  max-height: 100%;                           /* of the screen minus the 12 px edge: it scrolls inside when a short screen cannot hold it */
  overflow-y: auto;
  padding: 24px 22px 20px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  color: #333333;
  text-align: center;
}

.photo-warn-icon {
  box-sizing: border-box;
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border: 4px solid #f8d2a8;
  border-radius: 50%;
  color: #f0a04b;
  font-size: 46px;
  font-weight: 700;
  line-height: 62px;
}

.photo-warn-title {
  margin: 0 0 10px;
  color: #4d4d4d;
  font-size: 1.25rem;
  font-weight: 700;
}

.photo-warn-main {
  margin: 0 0 6px;
  color: #111111;
  font-size: 1.15rem;
  font-weight: 800;
}

.photo-warn-lead {
  margin: 0 0 6px;
  color: #333333;
  font-size: 1rem;
}

.photo-warn-list {
  max-width: 360px;
  margin: 0 auto 12px;
  padding: 0 0 0 22px;
  color: #a61b1b;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
}

.photo-warn-list li {
  margin: 3px 0;
}

.photo-warn-next,
.photo-warn-help {
  margin: 0 0 12px;
  color: #444444;
  font-size: 0.95rem;
  line-height: 1.35;
}

.photo-warn-help {
  padding: 8px 10px;
  border: 1px solid #f0c78f;
  border-radius: 6px;
  background: #fff4e5;
  color: #333333;
  font-weight: 700;
}

.photo-warn-ok {
  min-width: 120px;
  min-height: 44px;
  padding: 10px 34px;
  border: 0;
  border-radius: 6px;
  background: #1d63d6;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
}

.photo-warn-ok:hover {
  background: #1853b4;
}

.photo-warn-ok:focus-visible {
  outline: 3px solid #f0a04b;
  outline-offset: 2px;
}

@media (max-width: 520px), (pointer: coarse) {
  .photo-warn-dialog {
    padding: 20px 16px 16px;
  }
  .photo-warn-ok {
    width: 100%;
    min-height: 48px;
  }
}

@media (max-height: 520px) {
  .photo-warn-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
    font-size: 30px;
    line-height: 40px;
  }
  .photo-warn-dialog {
    padding: 12px 16px 12px;
  }
}

/* ---------- on the registration forms: the link and the tick under the photo box ---------- */
.photo-rules-open {
  display: inline-block;
  margin: 2px 0 0;
  padding: 6px 12px;
  border: 2px solid #f7b731;
  border-radius: 8px;
  background: #fff8e1;
  color: #000000;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
}

.photo-rules-open:hover {
  background: #ffefb8;
}

.photo-confirm {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 150px;
  margin-top: 4px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 1px 1px 2px #000000;
  text-align: left;
  cursor: pointer;
}

.photo-confirm input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  cursor: pointer;
}

.embedded .photo-confirm {
  max-width: 190px;
  color: #000000;
  font-size: 0.85rem;
  text-shadow: none;
}

@media (max-width: 520px) {
  .photo-rules-dialog {
    padding: 12px 12px 16px;
    border-radius: 16px;
  }
  .photo-rules-badge {
    top: -7px;
    right: -7px;
  }
}

.photo-confirm.field-error {
  outline: 2px solid #ff6b5e;
  outline-offset: 3px;
  border-radius: 6px;
  background: rgba(214, 40, 40, 0.28);
}
