/* Popup overlay - tmavé pozadí */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.popup-overlay.active {
  display: flex;
}

/* Kontejner s obrázkem */
.popup-content {
  position: relative;
  max-width: 50%;
  max-height: 50%;
  animation: popupFadeIn 0.3s ease-in-out;
}

.popup-content img {
  max-width: 100%;
  max-height: 90vh;
  display: block;
  border-radius: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Tlačítko zavření (křížek) */
.popup-close {
  position: absolute;
  top: -40px;
  right: -45px;
  width: 40px;
  height: 40px;
  background-color: transparent;
  border: none;
  border-radius: 100%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: none;
  transition: transform 0.2s;
  color: #a2a7af;
}

.popup-close:hover {
  transform: scale(1.1);
  background-color: transparent;
  color: #ffffff;
}

/* Animace při otevření */
@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === OPTIMALIZACE PRO MOBIL === */
@media screen and (max-width: 768px) {
  /* Větší maximální velikost na mobilech */
  .popup-content {
    max-width: 95%;
    max-height: 95%;
    margin: 10px;
  }

  /* Obrázek vyplní celou šířku na malých displejích */
  .popup-content img {
    max-height: 85vh;
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  /* Větší a lépe klikatelné tlačítko zavření */
  .popup-close {
    width: 50px;
    height: 50px;
    font-size: 28px;
    top: -10px;
    right: -10px;
  }
}

/* Extra malé telefony */
@media screen and (max-width: 480px) {
  .popup-content {
    max-width: 98%;
    margin: 5px;
  }

  .popup-content img {
    max-height: 80vh;
    border-radius: 4px;
  }

  /* Ještě větší křížek pro snadnější zavření */
  .popup-close {
    width: 55px;
    height: 55px;
    font-size: 32px;
    top: -8px;
    right: -8px;
  }
}

/* Prevence zoomu na iOS při dotyku */
@media screen and (max-width: 768px) {
  .popup-overlay {
    -webkit-tap-highlight-color: transparent;
  }

  .popup-close {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}
