/* Base styles for the popup wrapper */
#custom-html-popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: none; /* Hidden by default, shown by JS */
    pointer-events: none; /* Let clicks pass through where there is no popup */
}

/* Show class */
#custom-html-popup-wrapper.is-visible {
    display: flex;
}

/* Overlay */
.custom-html-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#custom-html-popup-wrapper.is-visible .custom-html-popup-overlay {
    opacity: 1;
}

/* Popup Content Container */
.custom-html-popup-content {
    position: relative;
    background: transparent;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: auto; /* Center by default */
}

/* Inner content */
.custom-html-popup-inner {
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
}





/* === POSITIONS === */

/* Center */
.popup-pos-center {
    align-items: center;
    justify-content: center;
}
.popup-pos-center .custom-html-popup-content {
    transform: scale(0.8);
}
#custom-html-popup-wrapper.is-visible.popup-pos-center .custom-html-popup-content {
    transform: scale(1);
    opacity: 1;
}

/* Bottom Right */
.popup-pos-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 20px;
}
.popup-pos-bottom-right .custom-html-popup-overlay {
    display: none; /* Usually no overlay for corner popups */
}
.popup-pos-bottom-right .custom-html-popup-content {
    margin: 0;
    transform: translateY(50px);
}
#custom-html-popup-wrapper.is-visible.popup-pos-bottom-right .custom-html-popup-content {
    transform: translateY(0);
    opacity: 1;
}

/* Bottom Left */
.popup-pos-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
    padding: 20px;
}
.popup-pos-bottom-left .custom-html-popup-overlay {
    display: none;
}
.popup-pos-bottom-left .custom-html-popup-content {
    margin: 0;
    transform: translateY(50px);
}
#custom-html-popup-wrapper.is-visible.popup-pos-bottom-left .custom-html-popup-content {
    transform: translateY(0);
    opacity: 1;
}

/* Top Bar */
.popup-pos-top-bar {
    align-items: flex-start;
    justify-content: center;
}
.popup-pos-top-bar .custom-html-popup-overlay {
    display: none;
}
.popup-pos-top-bar .custom-html-popup-content {
    margin: 0;
    width: 100% !important;
    max-width: 100% !important;
    transform: translateY(-100%);
    border-radius: 0;
}
.popup-pos-top-bar .custom-html-popup-inner {
    border-radius: 0;
}
.popup-pos-top-bar .custom-html-popup-close {
    top: 50%;
    transform: translateY(-50%);
    right: 15px;
}
#custom-html-popup-wrapper.is-visible.popup-pos-top-bar .custom-html-popup-content {
    transform: translateY(0);
    opacity: 1;
}

/* Bottom Bar */
.popup-pos-bottom-bar {
    align-items: flex-end;
    justify-content: center;
}
.popup-pos-bottom-bar .custom-html-popup-overlay {
    display: none;
}
.popup-pos-bottom-bar .custom-html-popup-content {
    margin: 0;
    width: 100% !important;
    max-width: 100% !important;
    transform: translateY(100%);
    border-radius: 0;
}
.popup-pos-bottom-bar .custom-html-popup-inner {
    border-radius: 0;
}
.popup-pos-bottom-bar .custom-html-popup-close {
    top: 50%;
    transform: translateY(-50%);
    right: 15px;
}
#custom-html-popup-wrapper.is-visible.popup-pos-bottom-bar .custom-html-popup-content {
    transform: translateY(0);
    opacity: 1;
}

/* === RESPONSIVE SIZES === */

/* PC (Desktop) */
@media (min-width: 1025px) {
    .custom-html-popup-content {
        width: var(--popup-w-pc);
        max-width: 100%;
    }
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 768px) {
    .custom-html-popup-content {
        width: var(--popup-w-tablet);
        max-width: 100%;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .custom-html-popup-content {
        width: var(--popup-w-mobile);
        max-width: 100%;
    }
}
