/* ============================================================
   lightbox.css — Estilos do componente Lightbox reutilizável
   Versão: 1.0.0
   Depende de: lightbox.js
   ============================================================ */

/* ── Modal base ── */
#lb-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  font-family:
    "DM Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

#lb-modal.lb-active {
  opacity: 1;
  pointer-events: all;
}

/* ── Overlay escuro ── */
#lb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 14, 0.94);
  backdrop-filter: blur(12px) saturate(0.6);
  -webkit-backdrop-filter: blur(12px) saturate(0.6);
}

/* ── Container central ── */
#lb-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: min(1100px, 94vw);
  max-height: 92vh;
  gap: 0;
  transform: scale(0.93);
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

#lb-modal.lb-active #lb-wrap {
  transform: scale(1);
}

/* ── Barra superior ── */
#lb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0 0.65rem;
}

#lb-caption-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#lb-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

#lb-counter {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.35);
  letter-spacing: 0.04em;
}

/* ── Palco central (imagem + setas) ── */
#lb-stage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

/* ── Área da imagem ── */
#lb-img-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* Altura máxima deixa espaço para topbar e bottombar */
  max-height: calc(92vh - 130px);
  aspect-ratio: auto;
  cursor: zoom-in;
  user-select: none;
}

#lb-img {
  max-width: 100%;
  max-height: calc(92vh - 130px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transform-origin: center center;
  opacity: 0;
  transition: opacity 0.2s ease;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Loader ── */
#lb-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.6);
  animation: lb-spin 0.7s linear infinite;
}

@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

/* ── Botões de navegação (prev / next) ── */
#lb-prev,
#lb-next {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(226, 232, 240, 0.7);
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease,
    border-color 0.2s ease;
  padding: 0;
}

#lb-prev svg,
#lb-next svg {
  width: 20px;
  height: 20px;
}

#lb-prev:hover,
#lb-next:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  transform: scale(1.1);
}

/* ── Botão fechar ── */
#lb-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(226, 232, 240, 0.65);
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

#lb-close svg {
  width: 16px;
  height: 16px;
}

#lb-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  transform: scale(1.1) rotate(90deg);
}

/* ── Barra inferior ── */
#lb-bottombar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0 0;
}

/* Controles de zoom */
#lb-zoom-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
}

#lb-zoom-bar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(226, 232, 240, 0.55);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
  padding: 0;
}

#lb-zoom-bar button svg {
  width: 15px;
  height: 15px;
}

#lb-zoom-bar button:hover {
  color: rgba(226, 232, 240, 0.95);
  transform: scale(1.18);
}

#lb-zoom-pct {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.5);
  min-width: 42px;
  text-align: center;
  letter-spacing: 0.02em;
}

.lb-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 0.25rem;
}

/* Dica de uso */
#lb-hint {
  font-size: 0.65rem;
  color: rgba(226, 232, 240, 0.22);
  text-align: center;
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════
   MOBILE — fullscreen, setas flutuantes
══════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Modal ocupa 100% da tela */
  #lb-modal {
    padding: 0;
    align-items: stretch;
  }

  /* Overlay cobre tudo */
  #lb-overlay {
    border-radius: 0;
  }

  /* Container ocupa a tela toda */
  #lb-wrap {
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    gap: 0;
    border-radius: 0;
  }

  /* Topbar: strip fino, com fundo semitransparente */
  #lb-topbar {
    padding: 0.6rem 1rem;
    background: rgba(4, 6, 14, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
    z-index: 2;
  }

  #lb-caption-text {
    font-size: 0.78rem;
  }

  /* Palco: ocupa todo o espaço restante */
  #lb-stage {
    flex: 1;
    min-height: 0;
    position: relative; /* setas vão ser absolutas aqui */
    gap: 0;
  }

  /* Imagem ocupa 100% do palco */
  #lb-img-wrap {
    flex: 1;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: none;
    background: rgba(0, 0, 0, 0.5);
  }

  #lb-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
  }

  /* Setas flutuam sobre a imagem */
  #lb-prev,
  #lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    background: rgba(4, 6, 14, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-color: rgba(255, 255, 255, 0.12);
  }

  #lb-prev { left: 0.6rem; }
  #lb-next { right: 0.6rem; }

  #lb-prev svg,
  #lb-next svg {
    width: 18px;
    height: 18px;
  }

  /* Bottombar: strip fino, fundo semitransparente */
  #lb-bottombar {
    flex-shrink: 0;
    padding: 0.5rem 1rem 0.6rem;
    background: rgba(4, 6, 14, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    gap: 0.25rem;
    z-index: 2;
  }

  #lb-hint {
    display: none;
  }

  /* Zoom bar mais compacta */
  #lb-zoom-bar {
    padding: 0.2rem 0.6rem;
  }

  #lb-zoom-bar button {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 400px) {
  #lb-caption-text {
    font-size: 0.72rem;
  }

  #lb-prev,
  #lb-next {
    width: 34px;
    height: 34px;
  }
}
