/**
 * OSFRJ Galeria de Fotos - Estilos do Widget e Lightbox
 * Plugin: OSFRJ Intervenções Fabrica de Plugins
 */

.osfrj-gallery-widget {
  width: 100%;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.osfrj-gallery-widget * {
  box-sizing: border-box;
}

/* ==========================================================
   GRID DE FOTOS
========================================================== */
.osfrj-gallery-grid {
  display: grid;
  /* Desktop padrão: 5 colunas */
  grid-template-columns: repeat(var(--osfrj-grid-cols-desktop, 5), 1fr);
  gap: var(--osfrj-grid-gap, 16px);
  width: 100%;
}

/* Tablet (1024px e abaixo): 4 colunas */
@media (max-width: 1024px) {
  .osfrj-gallery-grid {
    grid-template-columns: repeat(var(--osfrj-grid-cols-tablet, 4), 1fr);
    gap: var(--osfrj-grid-gap-tablet, var(--osfrj-grid-gap, 14px));
  }
}

/* Mobile (767px e abaixo): 3 colunas (conforme especificado) */
@media (max-width: 767px) {
  .osfrj-gallery-grid {
    grid-template-columns: repeat(var(--osfrj-grid-cols-mobile, 3), 1fr);
    gap: var(--osfrj-grid-gap-mobile, var(--osfrj-grid-gap, 10px));
  }
}

/* ==========================================================
   CARD / ITEM DA FOTO
========================================================== */
.osfrj-gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--osfrj-item-radius, 8px);
  background-color: #f1f5f9;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  user-select: none;
}

.osfrj-gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

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

.osfrj-gallery-item:hover .osfrj-gallery-img {
  transform: scale(1.08);
}

/* ==========================================================
   OVERLAY COM ÍCONE DE ZOOM
========================================================== */
.osfrj-gallery-overlay {
  position: absolute;
  inset: 0;
  background: var(--osfrj-overlay-bg, rgba(3, 104, 69, 0.65));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 12px;
  text-align: center;
}

.osfrj-gallery-item:hover .osfrj-gallery-overlay {
  opacity: 1;
}

.osfrj-gallery-zoom-icon {
  color: #ffffff;
  font-size: 24px;
  transform: scale(0.8);
  transition: transform 0.25s ease;
}

.osfrj-gallery-item:hover .osfrj-gallery-zoom-icon {
  transform: scale(1);
}

.osfrj-gallery-item-title {
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 6px;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

@media (max-width: 767px) {
  .osfrj-gallery-zoom-icon {
    font-size: 18px;
  }
  .osfrj-gallery-item-title {
    display: none; /* Oculta títulos nos pequenos cards mobile para preservar visual limpo */
  }
}

/* ==========================================================
   ESTADO VAZIO / SEM FOTOS
========================================================== */
.osfrj-gallery-empty {
  padding: 40px 20px;
  text-align: center;
  background-color: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  font-size: 15px;
}

/* ==========================================================
   LIGHTBOX MODAL EM TELA CHEIA
========================================================== */
.osfrj-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background-color: rgba(5, 10, 15, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  user-select: none;
}

.osfrj-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

/* Botão Fechar */
.osfrj-lightbox-close {
  position: absolute;
  top: 22px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000002;
  transition: background 0.2s ease, transform 0.15s ease;
}

.osfrj-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Setas de Navegação */
.osfrj-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000002;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.osfrj-lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.08);
}

.osfrj-lightbox-prev {
  left: 28px;
}

.osfrj-lightbox-next {
  right: 28px;
}

@media (max-width: 767px) {
  .osfrj-lightbox-arrow {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
  .osfrj-lightbox-prev {
    left: 12px;
  }
  .osfrj-lightbox-next {
    right: 12px;
  }
  .osfrj-lightbox-close {
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
  }
}

/* Estágio Central da Imagem */
.osfrj-lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 80px 100px 90px 100px;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .osfrj-lightbox-stage {
    padding: 60px 16px 80px 16px;
  }
}

.osfrj-lightbox-img-wrap {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.osfrj-lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

.osfrj-lightbox-img.is-loading {
  opacity: 0.3;
  transform: scale(0.98);
}

/* Barra Inferior com Contador e Legenda */
.osfrj-lightbox-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 24px 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 1000001;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  pointer-events: none;
}

.osfrj-lightbox-caption {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.osfrj-lightbox-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

.osfrj-lightbox-counter {
  color: #38bdf8;
  font-weight: 600;
}

