/* ------------------------------------------------------------
   MEMBER PHOTOS
   Runners sharing photos from runs they checked into (member run page,
   upload sheet, feed card) and the admin page for taking them down.
   ------------------------------------------------------------ */

/* Share card on the run page */
.member-photos-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  padding: 24px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  scroll-margin-top: var(--spacing-md);
}

.member-photos-share-text {
  flex: 1 1 320px;
  min-width: 0;
}

.member-photos-share-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

.member-photos-share-text p {
  margin: 0;
  max-width: 60ch;
  font-size: var(--font-size-small);
  color: var(--color-text-secondary);
}

.member-photos-share-button {
  min-height: 48px;
  white-space: nowrap;
}

/* Add photos on a past sign-up card */
.member-photos-past-button {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 15px;
  white-space: nowrap;
}

/* Gallery on the run page */
.member-photos-anchor {
  scroll-margin-top: var(--spacing-md);
}

.member-photos-gallery-title {
  margin: 0 0 6px;
  font-size: var(--font-size-h3);
}

.member-photos-gallery-sub {
  margin: 0 0 var(--spacing-sm);
  font-size: var(--font-size-small);
  color: var(--color-text-secondary);
}

.member-photos-item {
  position: relative;
}

.member-photos-item .photo-gallery-item {
  height: 100%;
}

.member-photos-chip,
.member-photos-credit-overlay {
  position: absolute;
  pointer-events: none;
  font-size: 13px;
  font-weight: 600;
}

.member-photos-chip {
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  background: var(--color-white);
  color: var(--color-text);
  border-radius: var(--radius-pill);
}

.member-photos-credit-overlay {
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 10px 8px;
  color: var(--color-white);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  border-radius: 0 0 12px 12px;
}

.member-photos-remove-own-form {
  position: absolute;
  right: 8px;
  bottom: 8px;
  margin: 0;
}

.member-photos-remove-own {
  min-height: 44px;
  padding: 6px 14px;
  font: 600 14px/1 var(--font-stack);
  color: var(--color-text);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.member-photos-remove-own:hover {
  background: var(--color-bg-alt);
}

.member-photos-remove-own:focus-visible,
.member-photos-banner-action:focus-visible,
.member-photos-select-all:focus-visible,
.member-photos-sheet-pick:focus-within,
.member-photos-sheet-thumb-remove:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

/* Undo banners (member and admin) */
.member-photos-undo,
.member-photos-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-xs) var(--spacing-sm);
}

.member-photos-undo {
  margin: 0 0 var(--spacing-sm);
}

.member-photos-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.member-photos-banner-form {
  margin: 0;
}

.member-photos-banner-action {
  min-height: 44px;
  padding: 8px 16px;
  font: 600 15px/1 var(--font-stack);
  color: var(--color-text);
  background: var(--color-white);
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.member-photos-banner-action:hover {
  background: var(--color-bg-alt);
}

/* Upload sheet */
/* The global reset zeroes margins, which would pin the dialog to the
   top-left corner instead of centering it. */
.member-photos-sheet {
  margin: auto;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow-hover);
  color: var(--color-text);
}

.member-photos-sheet::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

@media (max-width: 600px) {
  .member-photos-sheet {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

.member-photos-sheet-title {
  margin: 0 0 4px;
  font-size: 24px;
}

.member-photos-sheet-meta {
  margin: 0 0 var(--spacing-sm);
  font-size: var(--font-size-small);
  color: var(--color-text-secondary);
}

.member-photos-sheet-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--spacing-xs);
  margin: 0 0 var(--spacing-xs);
  padding: 0;
  list-style: none;
}

.member-photos-sheet-thumbs:empty {
  display: none;
}

.member-photos-sheet-thumb {
  position: relative;
  aspect-ratio: 1;
  max-width: 100%;
}

.member-photos-sheet-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

/* A 44px tap area around a smaller dark circle, so the × is easy to hit
   without covering the photo. */
.member-photos-sheet-thumb-remove {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  font-size: 18px;
  line-height: 1;
  color: var(--color-white);
  background: radial-gradient(circle, rgba(0, 0, 0, 0.65) 14px, transparent 15px);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.member-photos-sheet-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
  border: 1px dashed var(--color-text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.member-photos-sheet-pick:hover {
  background: var(--color-bg-alt);
}

.member-photos-sheet-note {
  margin: 0 0 var(--spacing-sm);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.member-photos-sheet-status {
  font-weight: 600;
}

.member-photos-sheet-status:empty {
  display: none;
}

.member-photos-sheet-errors {
  margin: var(--spacing-xs) 0 0;
  padding-left: 1.2em;
  font-size: 15px;
  color: var(--color-danger);
}

.member-photos-sheet-errors:empty {
  display: none;
}

.member-photos-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.member-photos-sheet-actions .btn {
  flex: 1 1 160px;
  min-height: 48px;
}

.member-photos-sheet-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Feed card */
.feed-activity-visual--photos .feed-activity-visual-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.feed-activity-photos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: 12px;
}

.feed-activity-photo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
}

.feed-activity-photo--more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
}

.feed-activity-photos:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 4px;
  border-radius: 10px;
}

/* Admin: Member photos page */
.member-photos-empty {
  padding: var(--spacing-md);
  text-align: center;
  color: var(--color-text-secondary);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

.member-photos-empty-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
}

.member-photos-empty p:last-child {
  margin: 0;
}

.member-photos-run {
  margin-bottom: var(--spacing-md);
}

.member-photos-run-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--spacing-xs);
  margin-bottom: 12px;
}

.member-photos-run-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.member-photos-run-header h2 a {
  color: inherit;
}

.member-photos-run-date {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.member-photos-select-all {
  min-height: 44px;
  padding: 0 4px;
  font: 600 15px var(--font-stack);
  color: var(--color-text);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}

.member-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.member-photos-tile {
  position: relative;
  min-width: 0;
}

.member-photos-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  width: 24px;
  height: 24px;
  accent-color: var(--color-black);
  cursor: pointer;
}

.member-photos-tile-label {
  display: block;
  aspect-ratio: 1;
  max-width: 100%;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  outline: 3px solid transparent;
  outline-offset: 2px;
}

.member-photos-checkbox:checked + .member-photos-tile-label {
  outline-color: var(--color-black);
}

.member-photos-checkbox:focus-visible + .member-photos-tile-label {
  outline-color: var(--color-accent-secondary);
}

.member-photos-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.member-photos-credit {
  display: inline-block;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.member-photos-bar {
  position: sticky;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-xs) var(--spacing-sm);
  padding: 12px 16px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--glass-shadow);
}

.member-photos-bar-count {
  font-weight: 600;
}

.member-photos-bar:not(.is-active) .member-photos-bar-count {
  font-weight: 500;
  color: var(--color-text-secondary);
}

.member-photos-bar-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.member-photos-bar-actions .btn {
  min-height: 44px;
}

.member-photos-bar-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.member-photos-remove {
  color: var(--color-white);
  background: var(--color-danger);
}

.member-photos-remove:hover:not(:disabled) {
  filter: brightness(0.9);
}

.member-photos-pages {
  display: flex;
  justify-content: space-between;
  margin-top: var(--spacing-md);
  font-weight: 600;
}
