/* Manager Photo Gallery — mobile-first, artistic field gallery. Namespaced .mpg-* */

:root {
  --mpg-green: var(--accent-green, #16a34a);
  --mpg-ink: var(--text-primary, #0f1f17);
  --mpg-muted: var(--text-muted, #64748b);
  --mpg-card: var(--card-bg, #ffffff);
  --mpg-line: var(--border-color, #e5e7eb);
  --mpg-radius: 16px;
  --mpg-shadow: 0 2px 10px rgba(15, 31, 23, 0.08);
}

#managerPhotoGalleryContent { padding-bottom: 96px; }

/* ---- toolbar / segmented ---- */
.mpg-toolbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.mpg-seg { display: inline-flex; background: rgba(22, 163, 74, 0.08); border-radius: 999px; padding: 4px; gap: 4px; }
.mpg-seg-btn { border: 0; background: transparent; color: var(--mpg-muted); font-weight: 600; font-size: 0.92rem; padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: all 0.15s; }
.mpg-seg-btn.active { background: var(--mpg-card); color: var(--mpg-green); box-shadow: var(--mpg-shadow); }

/* ---- album grid ---- */
.mpg-album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
@media (min-width: 700px) { .mpg-album-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.mpg-album-card { position: relative; border: 0; padding: 0; text-align: left; background: var(--mpg-card); border-radius: var(--mpg-radius); overflow: hidden; box-shadow: var(--mpg-shadow); cursor: pointer; display: flex; flex-direction: column; transition: transform 0.15s, box-shadow 0.15s; }
.mpg-album-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(15, 31, 23, 0.14); }
.mpg-cover { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #eef2f0; }
.mpg-cover-empty { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: #b9c6bf; }
.mpg-album-meta { padding: 12px 14px 14px; }
.mpg-album-title { font-weight: 700; color: var(--mpg-ink); font-size: 1rem; line-height: 1.25; }
.mpg-album-sub { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mpg-chip { background: rgba(22, 163, 74, 0.1); color: var(--mpg-green); font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.mpg-count { color: var(--mpg-muted); font-size: 0.78rem; }

.mpg-new-album { align-items: center; justify-content: center; min-height: 200px; border: 2px dashed rgba(22, 163, 74, 0.35); background: rgba(22, 163, 74, 0.04); }
.mpg-new-album-plus { font-size: 2.6rem; color: var(--mpg-green); line-height: 1; }
.mpg-new-album-label { color: var(--mpg-green); font-weight: 700; margin-top: 6px; }

/* ---- detail head ---- */
.mpg-detail-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.mpg-back { border: 0; background: transparent; color: var(--mpg-green); font-weight: 700; font-size: 0.95rem; cursor: pointer; padding: 6px 0; }
.mpg-detail-titles { flex: 1 1 auto; min-width: 180px; }
.mpg-detail-title { font-size: 1.4rem; font-weight: 800; color: var(--mpg-ink); }
.mpg-detail-desc { color: var(--mpg-muted); margin-top: 4px; font-size: 0.9rem; }
.mpg-detail-actions { display: flex; gap: 8px; }

/* ---- masonry ---- */
.mpg-masonry { column-count: 2; column-gap: 12px; }
@media (min-width: 560px) { .mpg-masonry { column-count: 3; } }
@media (min-width: 900px) { .mpg-masonry { column-count: 4; } }
.mpg-tile { position: relative; break-inside: avoid; margin-bottom: 12px; border-radius: 12px; overflow: hidden; cursor: pointer; background: #eef2f0; box-shadow: var(--mpg-shadow); }
.mpg-tile-img { width: 100%; display: block; object-fit: cover; background: #eef2f0; }
.mpg-img-broken { min-height: 80px; }
.mpg-play { position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.45); color: #fff; border-radius: 50%; font-size: 1.2rem; pointer-events: none; }
.mpg-heart { position: absolute; top: 8px; right: 8px; border: 0; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,0.4); color: #fff; font-size: 1.1rem; cursor: pointer; line-height: 1; }
.mpg-heart.on { color: #ffd34d; }
.mpg-badge-live { position: absolute; bottom: 8px; left: 8px; background: var(--mpg-green); color: #fff; font-size: 0.66rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }

/* ---- folder chips ---- */
.mpg-folder-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.mpg-folder-chip { flex: 0 0 auto; border: 1px solid var(--mpg-line); background: var(--mpg-card); color: var(--mpg-muted); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.mpg-folder-chip.active { background: var(--mpg-green); color: #fff; border-color: var(--mpg-green); }
.mpg-folder-new { color: var(--mpg-green); border-style: dashed; }

/* ---- buttons ---- */
.mpg-btn { border: 1px solid var(--mpg-line); background: var(--mpg-card); color: var(--mpg-ink); border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.mpg-btn-primary { background: var(--mpg-green); color: #fff; border-color: var(--mpg-green); }
.mpg-btn-danger { color: #dc2626; border-color: rgba(220,38,38,0.3); }

/* ---- FAB ---- */
.mpg-fab { position: fixed; right: 22px; bottom: 22px; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--mpg-green); color: #fff; font-size: 2rem; line-height: 1; box-shadow: 0 6px 18px rgba(22,163,74,0.4); cursor: pointer; z-index: 50; }

/* ---- states ---- */
.mpg-loading, .mpg-empty, .mpg-error { padding: 40px 20px; text-align: center; color: var(--mpg-muted); }
.mpg-error { color: #dc2626; }
.mpg-empty { grid-column: 1 / -1; }

/* ---- lightbox ---- */
.mpg-lb { position: fixed; inset: 0; z-index: 3000; background: rgba(8, 14, 11, 0.96); display: none; flex-direction: column; align-items: center; justify-content: center; }
.mpg-lb.open { display: flex; }
.mpg-lb-stage { flex: 1 1 auto; width: 100%; display: flex; align-items: center; justify-content: center; padding: calc(56px + env(safe-area-inset-top, 0px)) 12px 12px; min-height: 0; overflow: hidden; touch-action: none; }
.mpg-lb-media { max-width: 96vw; max-height: 78vh; object-fit: contain; border-radius: 8px; will-change: transform; }
.mpg-lb-close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px)); border: 0; background: rgba(255,255,255,0.12); color: #fff; width: 42px; height: 42px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; z-index: 2; }
.mpg-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); border: 0; background: rgba(255,255,255,0.1); color: #fff; width: 48px; height: 48px; border-radius: 50%; font-size: 1.8rem; cursor: pointer; }
.mpg-lb-prev { left: 12px; } .mpg-lb-next { right: 12px; }
.mpg-lb-caption { position: absolute; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); padding: 16px 20px; background: linear-gradient(transparent, rgba(0,0,0,0.7)); color: #fff; text-align: center; }
.mpg-lb-cap-title { font-weight: 700; font-size: 1.05rem; }
.mpg-lb-cap-desc { font-size: 0.92rem; opacity: 0.92; margin-top: 4px; max-width: 720px; margin-left: auto; margin-right: auto; }
.mpg-lb-cap-meta { font-size: 0.76rem; opacity: 0.65; margin-top: 5px; }
.mpg-lb-bar { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(0,0,0,0.5); overflow-x: auto; }
.mpg-lb-act { border: 0; background: rgba(255,255,255,0.14); color: #fff; border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.mpg-lb-act.on { background: rgba(255,211,77,0.25); color: #ffd34d; }
.mpg-lb-counter { margin-left: auto; color: rgba(255,255,255,0.7); font-size: 0.85rem; white-space: nowrap; padding-right: 4px; }

/* ---- modal ---- */
.mpg-modal-back { position: fixed; inset: 0; z-index: 3100; background: rgba(8,14,11,0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mpg-modal { background: var(--mpg-card); border-radius: var(--mpg-radius); padding: 22px; width: 100%; max-width: 440px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.mpg-modal-title { font-size: 1.2rem; font-weight: 800; color: var(--mpg-ink); margin-bottom: 14px; }
.mpg-label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--mpg-muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 12px 0 5px; }
.mpg-input { width: 100%; border: 1px solid var(--mpg-line); border-radius: 10px; padding: 10px 12px; font-size: 0.95rem; font-family: inherit; color: var(--mpg-ink); box-sizing: border-box; }
.mpg-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---- photo comments ---- */
.mpg-cmt-modal { display: flex; flex-direction: column; max-height: 72vh; }
.mpg-cmt-list { flex: 1; overflow-y: auto; margin: 4px 0 10px; min-height: 70px; }
.mpg-cmt { padding: 9px 12px; border: 1px solid var(--mpg-line); border-radius: 10px; margin-bottom: 8px; }
.mpg-cmt-head { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; }
.mpg-cmt-name { font-weight: 700; color: var(--mpg-ink); }
.mpg-cmt-date { color: var(--mpg-muted); }
.mpg-cmt-del { margin-left: auto; border: none; background: none; color: var(--mpg-muted); cursor: pointer; font-size: 0.85rem; padding: 2px 4px; }
.mpg-cmt-del:hover { color: #dc2626; }
.mpg-cmt-body { font-size: 0.92rem; color: var(--mpg-ink); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

/* ---- folder picker ---- */
.mpg-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; margin-top: 6px; }
.mpg-pick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--mpg-line); background: var(--mpg-card); color: var(--mpg-ink); border-radius: 10px; padding: 13px 14px; font-size: 0.95rem; font-weight: 600; cursor: pointer; }
.mpg-pick-row:hover { background: rgba(22, 163, 74, 0.06); border-color: var(--mpg-green); }
.mpg-pick-count { color: var(--mpg-muted); font-size: 0.8rem; font-weight: 600; }
.mpg-pick-new { color: var(--mpg-green); border-style: dashed; justify-content: flex-start; }

/* ---- toast ---- */
.mpg-toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--mpg-ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 4000; }
.mpg-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
