/* -----------------------------------------------------------
   1. The Overlay (Backdrop)
   Fixed position to cover the whole screen.
----------------------------------------------------------- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Dark semi-transparent background */
    z-index: 9998; /* High z-index, but behind the modal */
    backdrop-filter: blur(2px); /* Optional: adds a modern blur effect */
    display: none; /* Hidden by default */
    animation: fadeIn 0.3s ease-out;
}

/* -----------------------------------------------------------
   2. The Modal Container
   Centered using top/left 50% + transform.
----------------------------------------------------------- */
.popup-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Keeps it perfectly centered */
    z-index: 9999; /* Highest z-index to sit on top */
    background: var(--color-white);
    width: 90%; /* Responsive width for mobile */
    max-width: 600px; /* Maximum width for desktop */
    max-height: 90vh; /* Prevent it from being taller than the screen */
    overflow-y: auto; /* Scroll inside modal if content is too long */
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: none; /* Hidden by default */
    animation: slideIn 0.3s ease-out;
}

.popup-modal.full-img-modal {
    padding: 0;
    border: none;
}

.popup-modal.full-img-modal img {
    display: block;
}

.popup-modal.full-img-modal .popup-close {
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
}

/* -----------------------------------------------------------
   3. Content Styling
----------------------------------------------------------- */
.popup-modal h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--color-black);
}

.popup-modal .popup-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-grey);
}

.popup-modal .popup-content p, .popup-modal .popup-content li {
    color: var(--color-black);
}

/* Image-only popup tweaks */
.popup-modal img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* -----------------------------------------------------------
   4. Close Button
----------------------------------------------------------- */
.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-grey);
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px;
}

.popup-close:hover {
    color: var(--color-black);
}

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

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translate(-50%, -45%); /* Start slightly higher */
    }
    to { 
        opacity: 1; 
        transform: translate(-50%, -50%); 
    }
}

/* -----------------------------------------------------------
   6. Mobile Tweaks
----------------------------------------------------------- */
@media (max-width: 600px) {
    .popup-modal {
        width: 95%;
        padding: 1.5rem;
    }
}