/* ==========================================================================
   Galeria de fotos do imóvel (painel e site público) e lightbox. Carregado pelas views fotos.php e fotospublico.php.
   ========================================================================== */

/* Grid de miniaturas */

.galeria-wrapper {
  margin-top: 10px;
}

.galeria {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  padding: 10px;
}

/* Título da galeria */

.galeria-titulo {
  margin-left: 20px;
  font-size: 3rem;
  font-weight: bold;
}

/* Container de cada thumbnail */

.thumb-wrapper {
  position: relative;
  width: 130px;
  height: 120px;
  margin: 0 auto;
  text-align: center;
}

/* Botão de imagem */

.thumb {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
  width: 130px;
  height: 90px;
}

.thumb img {
  width: 130px;
  height: 90px;
  object-fit: cover;
  display: block;
  transition: transform .2s ease;
  border-radius: 6px;
}

.thumb:hover img,
.thumb:focus img {
  transform: scale(1.05);
}

/* Botão de exclusão */

.form-excluir,
.btn-excluir {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.btn-excluir {
  background: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 50%;
  padding: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #cc0000;
  transition: background 0.2s ease;
}

.btn-excluir:hover {
  background: rgba(255, 0, 0, 0.2);
}

.btn-excluir i {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
}

/* Lightbox / Modal */

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}

.lb-figure {
  margin: 0;
  max-width: 92vw;
  max-height: 88vh;
  display: grid;
  gap: 12px;
  place-items: center;
}

#lb-img {
  max-width: 92vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
  background: #111;
}

#lb-caption {
  color: #f2f2f2;
  font-size: 0.95rem;
  text-align: center;
}

/* Botões do modal */

.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  background: rgba(0, 0, 0, .4);
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s ease, transform .1s ease;
  user-select: none;
}

.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
  background: rgba(0, 0, 0, .6);
  transform: scale(1.05);
}

/* Posicionamento */

.lb-close {
  top: 18px;
  right: 18px;
}

.lb-prev {
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}

/* Acessibilidade de foco */

.lb-close:focus,
.lb-prev:focus,
.lb-next:focus,
.thumb:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
