/* Galerie — visionneuse plein écran. Copie du pattern .canvas-modal (suffixé). */

.gallery-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.gallery-viewer-modal[hidden] { display: none; }
.gallery-viewer-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.gallery-viewer-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.gallery-viewer-modal-shell {
  position: relative;
  width: 96vw;
  height: 96vh;
  max-width: 1600px;
  background: var(--surface, #1a1a1a);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}

.gallery-viewer-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 0.5px solid var(--border, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
  gap: 12px;
}
.gallery-viewer-modal-title {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #999);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-viewer-modal-index {
  font-size: 12px;
  color: var(--muted, #999);
  flex-shrink: 0;
}
.gallery-viewer-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--muted, #999);
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.gallery-viewer-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.gallery-viewer-modal-body {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.gallery-viewer-modal-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.gallery-viewer-modal-media[hidden] { display: none; }

.gallery-viewer-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.55);
  border: none;
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  z-index: 2;
}
.gallery-viewer-modal-nav:hover { background: rgba(0, 0, 0, 0.8); }
.gallery-viewer-modal-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.gallery-viewer-modal-nav.prev { left: 16px; }
.gallery-viewer-modal-nav.next { right: 16px; }

.gallery-viewer-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 20px;
  border-top: 0.5px solid var(--border, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
}
.gallery-viewer-modal-btn-danger {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 0.5px solid rgba(248, 113, 113, 0.4);
  background: transparent;
  color: #f87171;
  transition: all 0.2s;
  font-family: inherit;
}
.gallery-viewer-modal-btn-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
}

/* Mobile : plein écran, nav plus discrets */
@media (max-width: 768px) {
  .gallery-viewer-modal-shell {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
  }
  .gallery-viewer-modal-header { padding: 8px 12px; }
  .gallery-viewer-modal-footer { padding: 8px 12px; }
  .gallery-viewer-modal-nav {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .gallery-viewer-modal-nav.prev { left: 8px; }
  .gallery-viewer-modal-nav.next { right: 8px; }
}
