/* PhotoSync feature modules */

/* ─── Selection action bar ─────────────────────────── */
.gallery-action-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,.35);
  transform: translateY(100%);
  transition: transform 200ms ease;
  flex-wrap: wrap;
}
.gallery-action-bar.visible {
  transform: translateY(0);
}

/* ─── Gallery empty state ───────────────────────────── */
.gallery-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4rem 2rem;
  text-align: center;
}
.gallery-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-light), rgba(24,200,180,.12));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.gallery-empty-icon svg { width: 26px; height: 26px; }
.gallery-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.gallery-empty-sub {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
  margin: 0;
}
.gallery-empty-dropzone {
  margin-top: 4px;
  width: min(320px, 90%);
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.gallery-empty-dropzone:hover,
.gallery-empty-dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-bright);
}
.gallery-empty-upload { margin-top: 4px; }
.gallery-empty-clear {
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.gallery-action-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 80px;
}
.gallery-action-bar .btn-delete {
  border-color: rgba(255,80,80,.35);
  color: #ff8888;
}
.gallery-action-bar .btn-delete:hover {
  background: rgba(255,80,80,.12);
}

#panel-gallery {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  overflow: hidden;
}

#panel-gallery .gallery-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#panel-gallery .gallery-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
}

.albums-section { margin-top: .5rem; }
.albums-list { display: grid; gap: .35rem; max-height: 220px; overflow-y: auto; }
.album-row {
  display: flex; align-items: center; gap: .55rem;
  padding: .45rem .55rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  font-size: 12.5px; color: var(--text-primary);
}
.album-row:hover { background: var(--panel); }
.album-row.active { background: var(--accent-light); border-color: rgba(162,89,255,.35); }
.album-row.drag-over { border-color: var(--accent-bright); background: var(--accent-light); }
.album-thumb {
  width: 32px; height: 32px; border-radius: 6px;
  object-fit: cover; background: var(--panel);
}
.album-meta { flex: 1; min-width: 0; }
.album-meta small { color: var(--text-muted); font-size: 11px; }

.gallery-album-heading {
  display: none; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap;
}
.gallery-album-heading.visible { display: flex; }
.gallery-album-heading h2 { margin: 0; font-size: 1.1rem; }

/* Lightbox edit mode */
.photo-lightbox.edit-mode .lightbox-tools,
.photo-lightbox.edit-mode .lb-filename { display: none !important; }
.photo-lightbox.edit-mode .lb-stage { inset: 0; }
.lb-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 3.5rem 1rem 200px;
}
.lb-stage-inner { position: relative; max-width: 100%; max-height: 100%; }
.lb-stage-inner img { max-width: 90vw; max-height: calc(100vh - 220px); object-fit: contain; border-radius: var(--radius-md); }
.lb-vignette {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,.75) 100%);
  opacity: 0;
}

.lb-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
}
.lb-topbar button {
  border: none; border-radius: 99px; padding: .5rem 1rem;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.lb-edit-cancel { background: rgba(255,255,255,.12); color: #fff; }
.lb-edit-done { background: var(--accent); color: #fff; }
.lb-toolbar-actions { display: flex; gap: .5rem; align-items: center; }
.lb-icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.12); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lb-icon-btn:hover { background: rgba(255,255,255,.22); }

.lb-edit-panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 180px; z-index: 6;
  background: rgba(15,15,15,.88); backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,.08);
  display: none; flex-direction: column;
}
.photo-lightbox.edit-mode .lb-edit-panel { display: flex; }

.lb-transform-row {
  display: flex; gap: .5rem; justify-content: center; padding: .45rem .75rem 0;
}
.lb-slider-row {
  height: 48px; display: flex; align-items: center; padding: 0 1.25rem;
}
.lb-slider-row input[type=range] {
  width: 100%; accent-color: #fff;
}
.lb-tools-scroll {
  flex: 1; display: flex; gap: .5rem; overflow-x: auto;
  padding: .35rem .75rem .75rem; align-items: flex-end;
}
.lb-tool-tile {
  flex: 0 0 72px; height: 60px; border-radius: 10px;
  border: none; background: transparent; color: rgba(255,255,255,.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem; cursor: pointer; font-size: 10px;
}
.lb-tool-tile.active { background: rgba(255,255,255,.15); color: #fff; }
.lb-tool-tile svg { width: 20px; height: 20px; }

.lb-crop-ratios {
  display: none; gap: .35rem; justify-content: center; padding: 0 .75rem .35rem; flex-wrap: wrap;
}
.lb-crop-ratios.visible { display: flex; }
.lb-crop-ratios button {
  font-size: 11px; padding: .25rem .55rem; border-radius: 99px;
  border: 1px solid rgba(255,255,255,.2); background: transparent; color: #ddd; cursor: pointer;
}
.lb-crop-ratios button.active { background: rgba(255,255,255,.2); }

.crop-overlay {
  position: absolute; inset: 0; display: none;
}
.crop-overlay.active { display: block; }
.crop-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.crop-box {
  position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
  cursor: move;
}
.crop-handle {
  position: absolute; width: 10px; height: 10px;
  background: #fff; border: 1px solid rgba(0,0,0,.35);
  border-radius: 2px; z-index: 2;
}
.crop-handle.n { top: -5px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle.s { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle.e { right: -5px; top: 50%; transform: translateY(-50%); cursor: e-resize; }
.crop-handle.w { left: -5px; top: 50%; transform: translateY(-50%); cursor: w-resize; }
.crop-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.crop-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.crop-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.crop-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }

/* Album link toggle */
.album-link-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin: .25rem 0;
}
.album-link-toggle input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Share sheet */
.share-sheet .modal-panel { width: min(96vw, 400px); }
.share-manage { margin-top: .75rem; font-size: 12px; color: var(--text-muted); max-height: 120px; overflow-y: auto; }

/* People tab */
#panel-people, #panel-shared {
  height: calc(100vh - 52px);
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
}
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.person-card {
  width: 100%; max-width: 180px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 1rem .75rem 1.1rem;
  text-align: center; cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  animation: personIn .45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.person-card:hover { transform: scale(1.03); border-color: var(--accent-bright); box-shadow: var(--shadow-md); }
@keyframes personIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.person-avatar {
  width: 100px; height: 100px; border-radius: 50%;
  object-fit: cover; margin: 0 auto .65rem; background: var(--panel);
}
.person-name { font-size: 15px; font-weight: 500; margin-bottom: .2rem; }
.person-count { font-size: 12px; color: var(--text-muted); }

.unnamed-section h3 { font-size: 13px; display: flex; align-items: center; gap: .5rem; }
.unnamed-strip {
  display: flex; gap: .65rem; overflow-x: auto; padding: .75rem 0 1rem;
}
.unnamed-face {
  position: relative; flex: 0 0 80px; width: 80px; height: 80px;
  border-radius: 50%; overflow: hidden; cursor: pointer;
  border: 2px solid var(--border);
}
.unnamed-face img { width: 100%; height: 100%; object-fit: cover; }
.unnamed-face .plus-badge {
  position: absolute; bottom: 2px; right: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

.review-banner {
  background: var(--amber-dim); border: 1px solid rgba(245,166,35,.35);
  border-radius: var(--radius-md); padding: .85rem 1rem;
  margin-bottom: 1.25rem; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.review-inline { display: none; margin-bottom: 1.5rem; }
.review-inline.open { display: block; }
.review-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: .75rem; margin-bottom: .65rem;
}
.review-pair img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

.person-detail { display: none; }
.person-detail.active { display: block; }
.person-detail-header {
  display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.person-detail-avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }

.shared-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .875rem;
}

.shared-album-card {
  grid-column: 1 / -1;
  display: flex;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .875rem;
  align-items: flex-start;
}
.shared-album-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 110px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
}
.shared-album-previews img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.shared-album-previews:has(img:only-child) img { grid-column: 1 / -1; grid-row: 1 / -1; }
.shared-album-meta {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
}
.shared-album-meta strong { font-size: 15px; }
.shared-album-count { font-size: 12px; color: var(--text-muted); }
.shared-album-from { font-size: 12px; color: var(--text-muted); }
.shared-album-save-btn {
  margin-top: .25rem;
  padding: .4rem .85rem;
  border-radius: 99px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: background var(--transition);
}
.shared-album-save-btn:hover { background: var(--accent-dark); }
.shared-album-save-btn.saved { background: var(--panel); color: var(--text-muted); cursor: default; }
.shared-card { position: relative; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 4/3; background: var(--panel); }
.shared-card img { width: 100%; height: 100%; object-fit: cover; }
.shared-card-meta { padding: .5rem .65rem; font-size: 12px; color: var(--text-muted); }
.shared-save-btn {
  position: absolute; bottom: 2.5rem; left: 50%; transform: translateX(-50%);
  opacity: 0; transition: opacity var(--transition);
  padding: .35rem .75rem; border-radius: 99px; border: none;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; cursor: pointer;
}
.shared-card:hover .shared-save-btn { opacity: 1; }

.thumb-menu-btn {
  position: absolute; top: .45rem; right: .45rem; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none;
  opacity: 0; cursor: pointer;
}
.thumb-card:hover .thumb-menu-btn { opacity: 1; }

.album-picker {
  position: fixed; z-index: 15000; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: .5rem; display: none;
}
.album-picker.open { display: block; }
.album-picker label {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .5rem; font-size: 12.5px; cursor: pointer;
}

/* ─── Album dropdown shared pill ────────────────────── */
.album-dd-shared {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent-bright);
  vertical-align: middle;
  letter-spacing: 0.02em;
}

/* ─── Shared album member strip ──────────────────────── */
.shared-member-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--panel);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.shared-member-strip.hidden { display: none; }
.member-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text-primary);
}
.member-chip .owner-crown { font-size: 10px; }
.member-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0 0 4px;
  font-size: 14px;
  line-height: 1;
}
.member-chip-remove:hover { color: var(--text-primary); }
.member-action-btn {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}
.member-action-btn:hover { background: var(--accent-light); border-color: var(--accent); }

/* ─── Shared album photo card overlays ───────────────── */
.shared-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.thumb-card:hover .shared-card-overlay { opacity: 1; pointer-events: auto; }
.shared-added-by {
  font-size: 10px;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shared-remove-btn {
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.shared-remove-btn:hover { background: rgba(200,0,0,0.7); }

@media (max-width: 768px) {
  #panel-gallery { flex-direction: column; height: auto; min-height: calc(100vh - 52px); }
  .upload-sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .lb-edit-panel { height: 200px; }
  .lb-stage { padding-bottom: 220px; }
  .people-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
