/* ===== Person Avatar Upload ===== */
.person-avatar-upload {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.person-avatar-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.person-avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--text-xl);
}
.card-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ===== Person Photo Album ===== */
.form-section-title {
  color: var(--accent);
  font-weight: 600;
  font-size: var(--text-sm);
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.person-album {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  max-height: 350px;
  overflow-y: auto;
  padding: var(--space-1);
}
.album-empty {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-align: center;
  width: 100%;
  padding: var(--space-3);
}
.album-card {
  position: relative;
  width: 130px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: all var(--transition);
}
.album-card:hover { border-color: var(--accent); }
.album-img {
  width: 130px;
  height: 110px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.album-card-overlay {
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition);
}
.album-card:hover .album-card-overlay { opacity: 1; }
.album-delete-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--on-accent);
  border: none;
  cursor: pointer;
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}
.album-caption-input {
  width: 100%;
  padding: var(--space-1) var(--space-2);
  background: var(--bg-app);
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-xs);
  direction: rtl;
}
.album-caption-input::placeholder { color: var(--text-muted); }
.album-caption-input:focus { outline: none; background: var(--bg-input); }

.album-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  cursor: pointer;
  font-size: var(--text-xs);
  transition: all var(--transition);
  margin-bottom: var(--space-3);
}
.album-dropzone:hover, .album-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--scrim);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  max-width: 80%;
  text-align: center;
}

/* ===== Photo Gallery ===== */
.photo-gallery {
  margin-bottom: var(--space-4);
}
.gallery-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.gallery-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-1) 0;
  flex-wrap: wrap;
}
.gallery-thumb {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}
.gallery-thumb:hover { border-color: var(--accent); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb-delete {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--on-accent);
  border: none;
  cursor: pointer;
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.gallery-thumb:hover .gallery-thumb-delete { opacity: 1; }

.gallery-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  flex-shrink: 0;
}
.gallery-upload-btn:hover { border-color: var(--accent); background: var(--accent-bg); }

.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  cursor: pointer;
}
.gallery-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
}
.gallery-lightbox-close {
  position: absolute;
  top: 20px;
  left: 20px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: var(--text-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
