/* Photos page of a listing (templates/image/index.html.twig, assets/js/images/photo_manager.js) */

.photo-manager {
  --photo-ink: #222;
  --photo-muted: #6a6a6a;
  --photo-soft: #f7f7f7;
  --photo-line: #b0b0b0;
  --photo-radius: 16px;
  max-width: 760px;
  margin-inline: auto;
  color: var(--photo-ink);
}

/* the fixed "back / next" bar: its buttons line up with the centered content */
.photo-manager .add-form-submit-block {
  left: 0;
  right: 0;
  justify-content: center;
  margin: 0;
}

.photo-manager .add-form-submit-col {
  flex: 0 1 auto;
  width: 100%;
  max-width: 760px;
}

/* base.css sizes every svg 24x24 and fills it grey: the icons here use their width attribute and currentColor */
.photo-manager svg[width="16"] { width: 16px; height: 16px; }
.photo-manager svg[width="18"] { width: 18px; height: 18px; }
.photo-manager svg[width="40"] { width: 40px; height: 40px; }
.photo-manager svg[width="64"] { width: 64px; height: 64px; }
.photo-manager svg[width="16"],
.photo-manager svg[width="18"],
.photo-manager svg[width="40"] { fill: currentColor; }
.photo-dropzone-icon { fill: none; }

/* add_obj.css gives every button of the wizard pages 40px height */
.photo-manager .photo-add-tile,
.photo-manager .photo-pill-button,
.photo-manager .photo-dark-button,
.photo-manager .photo-text-button { height: auto; }
.photo-manager .photo-round-button { height: 48px; }
.photo-manager .photo-menu-button,
.photo-manager .photo-icon-button,
.photo-manager .photo-upload-card-button { height: 36px; }

.photo-manager .save-exit-button {
  margin-bottom: 8px;
}

.photo-manager-title {
  margin: 0 0 6px;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 600;
  line-height: 1.2;
  color: var(--photo-ink);
}

.photo-manager-subtitle,
.photo-manager-note {
  margin: 0;
  font-size: 17px;
  color: var(--photo-muted);
}

.photo-manager-note {
  margin: 4px 0 20px;
  font-size: 14px;
}

.photo-manager-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* Empty page: dashed box with a camera and "add photos" */
.photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 420px;
  margin-top: 28px;
  padding: 32px 16px;
  background: var(--photo-soft);
  border: 1px dashed var(--photo-line);
  border-radius: var(--photo-radius);
  transition: background-color .15s, border-color .15s;
}

.photo-empty.is-dragging {
  background: #efefef;
  border-color: var(--photo-ink);
}

.photo-empty-illustration {
  width: 200px;
  max-width: 60%;
  height: auto;
}

.photo-pill-button,
.photo-dark-button,
.photo-text-button,
.photo-round-button,
.photo-icon-button {
  border: 0;
  font-weight: 600;
  color: var(--photo-ink);
  transition: background-color .15s, transform .1s;
}

.photo-pill-button {
  padding: 12px 24px;
  font-size: 16px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
}

.photo-pill-button:hover {
  background: #f2f2f2;
}

.photo-dark-button {
  padding: 12px 24px;
  font-size: 16px;
  color: #fff;
  background: var(--photo-ink);
  border-radius: 10px;
}

.photo-dark-button:hover:not(:disabled) {
  background: #000;
}

.photo-dark-button:disabled {
  color: #b0b0b0;
  background: #ebebeb;
}

.photo-text-button {
  padding: 10px 8px;
  font-size: 16px;
  text-decoration: underline;
  background: transparent;
}

.photo-round-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #f2f2f2;
  border-radius: 50%;
}

.photo-round-button:hover {
  background: #e6e6e6;
}

.photo-pill-button:active,
.photo-dark-button:active:not(:disabled),
.photo-round-button:active {
  transform: scale(.96);
}

/* Uploaded photos: the first one is the cover, the others two per row, "add more" last */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.photo-tile,
.photo-add-tile {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: 12px;
}

.photo-tile {
  cursor: grab;
  touch-action: manipulation;
}

.photo-tile:first-child {
  grid-column: 1 / -1;
}

/* Profile photos (square): three per row, the first one (the avatar) 2x2 */
.photo-manager.is-square .photo-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-manager.is-square .photo-tile,
.photo-manager.is-square .photo-add-tile {
  aspect-ratio: 1;
}

.photo-manager.is-square .photo-tile:first-child {
  grid-column: span 2;
  grid-row: span 2;
}

.photo-tile > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--photo-soft);
  border-radius: 12px;
  user-select: none;
}

.photo-tile.is-ghost > img {
  opacity: .35;
}

.photo-tile.is-chosen > img {
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}

.photo-tile.is-deleting {
  opacity: .4;
  pointer-events: none;
  transition: opacity .2s;
}

.photo-cover-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  display: none;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}

.photo-tile:first-child .photo-cover-badge {
  display: block;
}

.photo-tile-menu {
  position: absolute;
  top: 12px;
  right: 12px;
}

.photo-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--photo-ink);
  background: rgba(255, 255, 255, .9);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
  cursor: pointer;
}

.photo-menu-button:hover,
.photo-menu-button[aria-expanded="true"] {
  background: #fff;
}

.photo-menu-button svg {
  fill: currentColor;
}

.photo-menu {
  min-width: 220px;
  padding: 8px 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}

.photo-menu .dropdown-item {
  padding: 12px 20px;
  font-size: 16px;
  color: var(--photo-ink);
}

.photo-menu .dropdown-item:active {
  color: var(--photo-ink);
  background: #f2f2f2;
}

.photo-add-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 500;
  color: var(--photo-muted);
  background: var(--photo-soft);
  border: 1px dashed transparent;
}

.photo-add-tile:hover,
.photo-add-tile.is-dragging {
  color: var(--photo-ink);
  border-color: var(--photo-line);
}

.photo-grid.is-busy .photo-tile {
  cursor: progress;
}

/* Upload dialog */
.photo-upload-modal .modal-content {
  border: 0;
  border-radius: 28px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
}

.photo-upload-modal .modal-header {
  align-items: center;
  padding: 16px 20px;
  border-bottom: 0;
}

.photo-upload-heading {
  flex: 1;
  text-align: center;
}

.photo-upload-modal .modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.photo-upload-count {
  font-size: 14px;
  color: var(--photo-muted);
}

.photo-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border-radius: 50%;
}

.photo-icon-button:hover:not(:disabled) {
  background: #f2f2f2;
}

.photo-icon-button:disabled {
  opacity: .35;
}

.photo-upload-modal .modal-body {
  position: relative;
  padding: 8px 24px 24px;
}

.photo-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 16px 32px;
  text-align: center;
  border: 2px dashed var(--photo-line);
  border-radius: 12px;
}

.photo-dropzone-icon {
  margin-bottom: 20px;
  color: var(--photo-ink);
}

.photo-dropzone-title {
  font-size: 24px;
  font-weight: 600;
}

.photo-dropzone-text {
  margin: 6px 0 20px;
  font-size: 16px;
}

.photo-dropzone .form-text {
  margin-top: 16px;
}

.photo-upload-drop-hint {
  position: absolute;
  inset: 8px 24px 24px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  background: rgba(255, 255, 255, .92);
  border: 2px dashed var(--photo-ink);
  border-radius: 12px;
  pointer-events: none;
}

.photo-upload-modal .modal-body.is-dragging .photo-upload-drop-hint {
  display: flex;
}

.photo-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.photo-upload-grid[hidden] {
  display: none;
}

.photo-upload-card {
  margin: 0;
}

.photo-upload-card-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--photo-soft);
  border-radius: 10px;
}

.photo-upload-card-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .2s;
}

.photo-upload-card-name {
  padding: 12px;
  font-size: 14px;
  color: var(--photo-muted);
  text-align: center;
  word-break: break-all;
}

.photo-upload-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.photo-upload-card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #fff;
  background: rgba(0, 0, 0, .85);
  border: 0;
  border-radius: 50%;
}

.photo-upload-card-button svg {
  fill: currentColor;
}

.photo-upload-card-button:hover:not(:disabled) {
  background: #000;
}

.photo-upload-card-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  background: #fff;
  border-radius: 6px;
}

.photo-upload-card-badge::before {
  width: 10px;
  height: 10px;
  content: "";
  background: #e5590f;
  border-radius: 50%;
}

.photo-upload-card.is-rejected .photo-upload-card-frame {
  outline: 2px solid #c13515;
  outline-offset: -2px;
}

.photo-upload-card.is-rejected img {
  opacity: .35;
}

.photo-upload-card-error {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #c13515;
  background: #fff;
  border-radius: 6px;
}

.photo-upload-card.is-uploading .photo-upload-card-actions {
  display: none;
}

.photo-upload-card-progress {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  background: rgba(0, 0, 0, .45);
}

.photo-upload-card-bar {
  width: 60%;
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, .35);
  border-radius: 2px;
}

.photo-upload-card-bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: #fff;
  transition: width .15s;
}

.photo-upload-modal .modal-footer {
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid #ebebeb;
}

.photo-upload-submit {
  min-width: 140px;
}

@media (max-width: 575.98px) {
  .photo-empty {
    min-height: 320px;
  }

  .photo-grid,
  .photo-upload-grid {
    gap: 10px;
  }

  .photo-upload-modal .modal-body {
    padding: 8px 16px 16px;
  }

  .photo-manager .photo-upload-card-button {
    width: 32px;
    height: 32px;
  }
}
