/* Scanner une photo papier */

.photo-scan-shell {
  overflow: hidden;
}

.photo-scan-loading[hidden],
.photo-scan-result[hidden],
.photo-scan-failure[hidden] {
  display: none !important;
}

.photo-scan-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 30px;
  text-align: center;
}

.photo-scan-loading strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.photo-scan-loading span {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
  max-width: 34rem;
}

.photo-scan-spinner {
  width: 42px;
  height: 42px;
  margin-bottom: 6px;
  border: 4px solid #e6eef7;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: photo-scan-spin .85s linear infinite;
}

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

.photo-scan-result {
  display: grid;
  gap: 18px;
}

.photo-scan-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee9e1;
}

.photo-scan-file-info {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.photo-scan-file-info strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-scan-file-info span {
  color: var(--muted);
  font-size: .82rem;
}

.photo-scan-settings {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, .8fr);
  gap: 18px;
  align-items: stretch;
}

.photo-scan-mode-fieldset,
.photo-scan-status-card {
  min-width: 0;
  margin: 0;
  padding: 15px;
  border: 1px solid #e7e4de;
  border-radius: 18px;
  background: #fffdf9;
}

.photo-scan-mode-fieldset legend {
  padding: 0 5px;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 850;
}

.photo-scan-mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.photo-scan-mode-option {
  position: relative;
  cursor: pointer;
}

.photo-scan-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.photo-scan-mode-option span {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 13px;
  border: 2px solid transparent;
  border-radius: 15px;
  background: #f5f7f8;
  transition: .15s ease;
}

.photo-scan-mode-option strong {
  color: #344657;
  font-size: .93rem;
}

.photo-scan-mode-option small {
  color: var(--muted);
  font-size: .77rem;
  line-height: 1.4;
}

.photo-scan-mode-option input:checked + span {
  border-color: rgba(22,119,220,.24);
  background: #edf6ff;
}

.photo-scan-status-card {
  display: grid;
  align-content: center;
  gap: 6px;
}

.photo-scan-status-card strong {
  color: var(--ink);
  font-size: .93rem;
}

.photo-scan-status-card p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.55;
}

.photo-scan-stage {
  min-width: 0;
  max-height: 720px;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 12px;
  border: 1px solid #e3e7ec;
  border-radius: 20px;
  background:
    linear-gradient(45deg,#f1f1f1 25%,transparent 25%),
    linear-gradient(-45deg,#f1f1f1 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#f1f1f1 75%),
    linear-gradient(-45deg,transparent 75%,#f1f1f1 75%),
    #fff;
  background-size: 22px 22px;
  background-position: 0 0,0 11px,11px -11px,-11px 0;
}

.photo-scan-stage canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 680px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(25,43,65,.14);
}

.photo-scan-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.photo-scan-rotate-actions,
.photo-scan-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-scan-download-actions .primary {
  min-width: 180px;
}

.photo-scan-failure {
  min-height: 210px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  padding: 26px;
  text-align: center;
  border: 1px solid #ece5df;
  border-radius: 20px;
  background: #fffdfb;
}

.photo-scan-failure-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff1dd;
  color: #be6f00;
  font-size: 1.2rem;
  font-weight: 900;
}

.photo-scan-failure strong {
  color: var(--ink);
  font-size: 1.02rem;
}

.photo-scan-failure p {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.55;
}

@media (max-width: 780px) {
  .photo-scan-file-head {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-scan-file-head > button {
    width: 100%;
  }

  .photo-scan-settings {
    grid-template-columns: 1fr;
  }

  .photo-scan-mode-options {
    grid-template-columns: 1fr;
  }

  .photo-scan-mode-option span {
    min-height: 70px;
  }

  .photo-scan-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-scan-rotate-actions,
  .photo-scan-download-actions {
    width: 100%;
  }

  .photo-scan-rotate-actions button,
  .photo-scan-download-actions button {
    flex: 1 1 145px;
  }

  .photo-scan-stage {
    padding: 7px;
    border-radius: 16px;
  }
}
