/* Popup Overlay */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

/* Popup Container */
.popup-container {
  position: relative;
  max-width: 600px;
  max-height: 80vh;
  margin: 20px;
  background: #fff;
  border: 4px solid #5593c9;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
}

/* Popup Content */
.popup-content {
  position: relative;
  padding: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

/* Default order for elements */
.popup-close {
  order: -1; /* Always first */
}

.popup-image {
  order: 2; /* Default: after title */
}

.popup-title {
  order: 1;
}

.popup-body {
  order: 3;
}

/* Image position variants */
.popup-image-top .popup-image {
  order: 0; /* Before title */
}

.popup-image-after_title .popup-image {
  order: 2; /* After title (default) */
}

.popup-image-after_body .popup-image {
  order: 4; /* After body */
}

/* Close Button */
.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
  background: #5593c9;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background-color 0.2s ease;
}

.popup-close:hover {
  background: #000;
}

/* Popup Image */
.popup-image {
  margin-bottom: 20px;
}

.popup-image img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Popup Title */
.popup-title {
  margin: 0 0 15px 0;
  font-size: 24px;
  font-weight: bold;
  color: #5593c9;
}

/* Popup Body */
.popup-body {
  font-size: 16px;
  line-height: 1.5;
  color: #666;
}

.popup-body p {
  margin-bottom: 15px;
}

.popup-body p:last-child {
  margin-bottom: 0;
}

/* Body class when popup is open */
body.popup-open {
  overflow: hidden;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: scale(0.8) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .popup-container {
    max-width: calc(100% - 40px);
    margin: 20px;
  }

  .popup-content {
    padding: 20px;
  }

  .popup-title {
    font-size: 20px;
  }

  .popup-body {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .popup-container {
    max-width: calc(100% - 20px);
    margin: 10px;
  }

  .popup-content {
    padding: 15px;
  }

  .popup-close {
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    font-size: 16px;
  }
}