

/* ── Barre titre + pagination ────────────────────────────────────────── */
.page-title-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0.75rem 0;
  border-bottom: 2px solid var(--blue-light);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.page-title-bar--bottom {
  position: static;
  box-shadow: none;
  border-top: 2px solid var(--blue-light);
  border-bottom: none;
  margin-top: 2rem;
  margin-bottom: 0;
}

.page-title-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.gallery-pager {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.gallery-per-select {
  height: 28px;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 0.65rem;
  background: var(--white);
  cursor: pointer;
  outline: none;
}

.gallery-per-select:hover { border-color: var(--blue); color: var(--blue); }

.gallery-pager-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  background: var(--white);
  transition: all 0.15s;
}

.pager-btn:hover  { border-color: var(--blue); color: var(--blue); }
.pager-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.pager-ellipsis {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 0.15rem;
}

.page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--blue-light);
}

.process-log {
  background: var(--blue-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.process-log strong { color: var(--blue); }

.gallery-item {
  overflow: hidden;
  border-radius: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
  display: block;
  text-decoration: none;
}

.gallery-item:hover {
  box-shadow: 0 6px 20px rgba(24,85,163,0.12);
  transform: translateY(-2px);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

/* ── Masonry MODE A : photos à ratio naturel ─────────────────────── */
.gallery-masonry-inner {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--white);
  transition: box-shadow 0.2s;
}
.gallery-masonry-inner:hover {
  box-shadow: 0 8px 24px rgba(24,85,163,0.15);
}
/* Annuler le lift de .gallery-item dans masonry (boutons immobiles) */
.gallery-masonry .gallery-item {
  border: none;
  border-radius: 0;
  transition: none;
}
.gallery-masonry .gallery-item:hover {
  box-shadow: none;
  transform: none;
}
/* Photo au ratio naturel — l'image zoome légèrement au survol */
.gallery-masonry .gallery-item img {
  aspect-ratio: unset;
  height: auto;
}
.gallery-masonry .gallery-masonry-inner:hover .gallery-item img {
  transform: scale(1.04);
}
/* Placeholders vidéo / PDF : conserver ratio 4/3 */
.gallery-masonry .gallery-placeholder {
  aspect-ratio: 4/3;
}

/* ── GLightbox : description en overlay transparent ─────────────── */

/* Le conteneur slide devient la référence de positionnement */
.gslide-inner-content {
  position: relative !important;
}

/* Description flottante sur l'image, gradient de bas en haut */
.gslide-description {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: linear-gradient(to top,
    rgba(0,0,0,0.72) 0%,
    rgba(0,0,0,0.35) 55%,
    transparent 100%) !important;
  padding: 1rem 1rem 1.1rem !important;
  transition: opacity 0.4s ease;
  pointer-events: auto;
}

/* L'image peut maintenant occuper toute la hauteur */
.gslide-media {
  max-height: 100% !important;
}

.gslide-title {
  color: #fff !important;
  font-size: 0.88rem !important;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.gslide-desc,
.gdesc-inner {
  color: rgba(255,255,255,0.9) !important;
}

/* ── Zone titre GLightbox : titre + bouton côte à côte ───────────── */
.gdesc-inner {
  display: flex !important;
  align-items: center !important;
  gap: 0.6rem !important;
}

/* ── Bouton téléchargement inline (à côté du titre) ──────────────── */
.lb-dl-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff !important;
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lb-dl-btn:hover {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.7);
  color: #fff;
}

.gallery-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  gap: 0.5rem;
}

.gallery-caption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-download {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1;
  transition: color 0.15s;
}

.gallery-download:hover {
  color: var(--blue);
}

/* ── Bouton retour dans le titre ─────────────────────────────────────── */
.gallery-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  text-decoration: none;
  font-size: 0.85rem;
  margin-right: 0.5rem;
  vertical-align: middle;
  transition: background 0.15s, color 0.15s;
}
.gallery-back:hover { background: var(--blue); color: #fff; }

/* ── Carte galerie (index) ───────────────────────────────────────────── */
.gallery-cover {
  display: block;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  background: var(--white);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
  aspect-ratio: 4/3;
}

.gallery-cover:hover {
  box-shadow: 0 8px 24px rgba(24,85,163,0.15);
}

.gallery-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.gallery-cover:hover img { transform: scale(1.07); }

.gallery-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-light);
  color: var(--blue-mid);
  font-size: 3rem;
}

.gallery-cover-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1rem 0.9rem;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 100%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
}

.gallery-cover-title {
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.gallery-cover-count {
  color: rgba(255,255,255,0.8);
  font-size: 0.75rem;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* ── Placeholders PDF / Vidéo ────────────────────────────────────────── */
.gallery-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--blue-light);
}

.gallery-placeholder img,
.gallery-placeholder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.gallery-placeholder-video {
  background: #111;
}

.gallery-placeholder-pdf {
  background: #f5f5f7 center top / cover no-repeat;
}

.gallery-pdf-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.45);
}

.gallery-pdf-overlay .bi-file-pdf {
  font-size: 4.5rem;
  color: #fff;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.gallery-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24,85,163,0.3);
  font-size: 2rem;
  color: #fff;
  transition: background 0.2s;
}

.gallery-item:hover .gallery-play-btn {
  background: rgba(24,85,163,0.55);
}

.gallery-type-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

/* ── Overlay spinner (traitement en cours) ───────────────────────────── */
#proc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(248,249,251,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.proc-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--blue);
  animation: proc-spin .8s linear infinite;
}
@keyframes proc-spin { to { transform: rotate(360deg); } }
.proc-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}
.proc-progress-wrap {
  width: 260px;
  max-width: 80vw;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 0.85rem 0 0.3rem;
}
.proc-progress-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  transition: width 0.25s ease;
}
.proc-progress-count {
  font-size: 0.82rem;
  color: var(--blue);
  font-weight: 600;
  margin: 0;
}
.proc-progress-file {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Modal résultat traitement ───────────────────────────────────────── */
#proc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(44,62,80,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.proc-modal-box {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(24,85,163,0.18);
  padding: 2rem 2.5rem;
  max-width: 360px;
  width: 90%;
  text-align: center;
}
.proc-modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.proc-modal-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--blue);
  margin-bottom: 0.5rem;
}
.proc-modal-cd {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0 1.5rem;
}
.proc-modal-stop {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.45rem 1.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  transition: border-color .15s, color .15s;
}
.proc-modal-stop:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ── Toast traitement images ─────────────────────────────────────────── */
#proc-toast {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(24,85,163,0.13);
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  max-width: 300px;
  font-size: 0.84rem;
  color: var(--text);
}
.proc-toast-icon {
  color: var(--blue);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.proc-toast-text strong {
  color: var(--blue);
}
.proc-toast-close {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
  line-height: 1;
  margin-left: 0.25rem;
}
.proc-toast-close:hover { color: var(--text); }

/* ── Masonry index galeries (CSS Grid + JS span) ─────────────────────── */
.gallery-masonry {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 10px;   /* unité de base : chaque item = span N×10px  */
  column-gap: 1.25rem;
  row-gap: 0;
  align-items: start;
}
.gallery-masonry-item {
  width: 100%;
  /* grid-row-end: span N — calculé par JS selon la hauteur réelle */
}

/* En masonry : toutes les cartes gardent un ratio uniforme 4/3 */
.gallery-masonry .gallery-cover {
  aspect-ratio: 4/3;
}
.gallery-masonry .gallery-cover img {
  height: 100%;
  object-fit: cover;
}

/* Responsive */
@media (max-width: 1199px) { .gallery-masonry { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 767px)  { .gallery-masonry { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479px)  { .gallery-masonry { grid-template-columns: 1fr; } }

/* ── Admin galerie (barre + bouton crayon) ───────────────────────────── */
.admin-gallery-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--blue-light);
}
.admin-gallery-bar .page-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.btn-new-gallery {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-new-gallery:hover { background: #1244a0; color: #fff; }

.gallery-cover-wrap {
  position: relative;
}

/* Groupe de boutons admin (crayon + corbeille) */
.gallery-admin-btns {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  display: flex;
  gap: 0.3rem;
}

.gallery-admin-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.12);
  color: var(--blue);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  backdrop-filter: blur(4px);
  padding: 0;
  flex-shrink: 0;
}
.gallery-admin-btn:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.gallery-delete-btn:hover {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

/* ── Modal upload ─────────────────────────────────────────────────────── */
.ng-dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
.ng-dropzone:hover,
.ng-dropzone.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
}
.ng-dropzone .bi {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.65;
}
.ng-progress-wrap {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0 0.4rem;
}
.ng-progress-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
  transition: width 0.2s ease;
  width: 0%;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 575px) {
  .gallery-cover-title { font-size: 0.78rem; }
  .gallery-cover-count { display: none; }
  .gallery-cover-info  { padding: 1.25rem 0.6rem 0.6rem; }
  .gallery-item img    { aspect-ratio: 4/3; }
  #proc-toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

