/* --- FUNDO ESCURO (OVERLAY) --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  padding: 20px; /* Evita que o popup cole nas bordas da tela */
}

.modal-overlay.show {
  opacity: 1;
}

/* --- A CAIXA DO POP-UP --- */
.modal-box {
  position: relative;
  width: auto;
  max-width: 500px; /* Tamanho máximo no PC */
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- A IMAGEM (AJUSTADA) --- */
.modal-img-responsive {
  width: 100%; /* Ocupa a largura da caixa */
  max-width: 100%; /* Não deixa a imagem crescer mais que a caixa */
  height: auto; /* Mantém a proporção sem achatar */
  max-height: 80vh; /* Não deixa a imagem ficar mais alta que a tela */
  border-radius: 15px;
  display: block;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  object-fit: contain; /* Garante que a imagem inteira apareça */
}

/* --- BOTÃO DE FECHAR (POSIÇÃO CORRIGIDA) --- */
#btnClose {
  z-index: 10001 !important;
  position: absolute !important;
  top: -15px !important;
  right: -15px !important;

  width: 40px !important;
  height: 40px !important;

  background-color: #000 !important;
  color: #fff !important;
  border-radius: 50% !important;
  border: 2px solid #fff !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  cursor: pointer !important;
  font-size: 24px !important;
  font-weight: bold !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* AJUSTES PARA CELULAR */
@media (max-width: 768px) {
  .modal-box {
    max-width: 95%; /* Quase a largura toda no celular */
  }

  #btnClose {
    top: 5px !important; /* No celular, entra um pouco na imagem para não sumir */
    right: 5px !important;
    width: 35px !important;
    height: 35px !important;
    font-size: 20px !important;
  }
}
