/* ============================================================
   St Anthony's Church — Gallery styles
   Part 1: public gallery additions (video tiles, lightbox video)
   Part 2: Gallery Manager in the Parish Register (prefix gm-)
   Load AFTER pages.css.
   ============================================================ */

/* ── Part 1: Public gallery ───────────────────────────────── */
.gallery-item { background: var(--navy-mid); }

.gallery-item__badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(13, 27, 62, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  padding-left: 3px;              /* optical centring of the play triangle */
  pointer-events: none;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.gallery-item:hover .gallery-item__badge {
  background: rgba(201, 146, 42, 0.92);
  transform: translate(-50%, -50%) scale(1.08);
}

.lightbox__video {
  max-height: 70vh;
  max-width: 100%;
  width: 100%;
  border-radius: var(--radius-md);
  background: #000;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
}

/* ── Part 2: Gallery Manager ──────────────────────────────── */
/* .btn / .gm-actions set their own display, which would otherwise override the hidden attribute */
.gm-card [hidden],
.gm-actions[hidden] { display: none !important; }

.gm-card {
  background: var(--white);
  border: 1px solid rgba(15, 33, 71, 0.08);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: var(--space-lg);
}

.gm-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}
.gm-step__num {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold-light);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.gm-step__title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--navy);
  font-size: 1.02rem;
}
.gm-step__hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}
.gm-target {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gold);
  margin-left: 6px;
}

/* Category chips */
.gm-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.gm-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.gm-cat:hover:not(:disabled) { border-color: var(--gold); color: var(--navy); }
.gm-cat:disabled { opacity: 0.55; cursor: not-allowed; }
.gm-cat--active,
.gm-cat--active:hover:not(:disabled) {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.gm-cat__count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--cream-dark);
  color: var(--navy);
  font-size: 0.72rem;
  text-align: center;
}
.gm-cat--active .gm-cat__count { background: var(--gold); color: var(--navy); }
.gm-cat--add {
  border-style: dashed;
  border-color: var(--gold);
  color: var(--gold);
}

/* New category form */
.gm-newcat {
  margin-top: 18px;
  padding: 18px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-width: 560px;
}
.gm-newcat .form-group { margin-bottom: 14px; }
.gm-icons { display: flex; flex-wrap: wrap; gap: 8px; }
.gm-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.gm-icon:hover { border-color: var(--gold); color: var(--gold); }
.gm-icon--active { background: var(--navy); border-color: var(--navy); color: var(--gold-light); }
.gm-inline-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Drop zone */
.gm-drop {
  border: 2px dashed var(--gold);
  background: var(--cream);
  border-radius: var(--radius-lg);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.gm-drop:hover,
.gm-drop:focus-visible { background: var(--gold-pale); outline: none; }
.gm-drop--over { background: var(--gold-pale); border-color: var(--navy); transform: scale(1.01); }
.gm-drop--disabled {
  border-color: var(--border);
  background: var(--cream-dark);
  cursor: not-allowed;
  opacity: 0.75;
}
.gm-drop--disabled:hover { background: var(--cream-dark); }
.gm-drop__icon { font-size: 2.4rem; color: var(--gold); display: block; margin-bottom: 10px; }
.gm-drop--disabled .gm-drop__icon { color: var(--text-light); }
.gm-drop__title { font-family: 'Cinzel', serif; font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.gm-drop__sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* Upload queue */
.gm-queue { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.gm-q {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--white);
}
.gm-q[data-state="done"]  { border-color: #86d3a3; background: #f3fbf6; }
.gm-q[data-state="error"] { border-color: #f1a4a4; background: #fff6f6; }
.gm-q__thumb {
  position: relative;
  flex: none;
  width: 84px; height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--navy-mid);
}
.gm-q__thumb img,
.gm-q__thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gm-q__badge {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: 1rem;
  background: rgba(13, 27, 62, 0.35);
}
.gm-q__body { flex: 1; min-width: 0; }
.gm-q__meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.gm-q__name {
  font-size: 0.85rem; font-weight: 600; color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gm-q__size { flex: none; font-size: 0.78rem; color: var(--text-muted); }
.gm-q__caption { padding: 7px 10px; font-size: 0.85rem; }
.gm-q__bar {
  height: 4px; margin-top: 8px;
  background: var(--cream-dark);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.gm-q__fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.2s ease;
}
.gm-q[data-state="done"] .gm-q__fill { background: var(--success); }
.gm-q[data-state="error"] .gm-q__fill { background: var(--danger); }
.gm-q__status { margin-top: 5px; font-size: 0.78rem; color: var(--text-muted); }
.gm-q[data-state="done"] .gm-q__status { color: var(--success); }
.gm-q[data-state="error"] .gm-q__status { color: var(--danger); }
.gm-q__remove {
  flex: none;
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.gm-q__remove:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger); }
.gm-q__remove:disabled { opacity: 0.35; cursor: not-allowed; }

.gm-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.gm-actions .btn:disabled,
.gm-card .btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Uploaded media grid */
.gm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.gm-empty {
  grid-column: 1 / -1;
  padding: 28px 12px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}
.gm-tile {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.gm-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gm-tile__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--navy-mid);
}
.gm-tile__media img,
.gm-tile__media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gm-tile__badge {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(13, 27, 62, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; padding-left: 2px;
  pointer-events: none;
}
.gm-tile__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px;
}
.gm-tile__caption {
  font-size: 0.8rem; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gm-tile__delete {
  flex: none;
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.gm-tile__delete:hover { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 600px) {
  .gm-card { padding: 16px; }
  .gm-q { align-items: flex-start; }
  .gm-q__thumb { width: 64px; height: 52px; }
  .gm-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
