:root {
    --primary: white;
    --bg-color: #5dcaf1;
    --bg-envelope-color: #f5edd1;
    --envelope-tab: #ecdeb8;
    --envelope-cover: #e6cfa7;
    --shadow-color: #707070;
    --heart-color: #c2465d;
}

body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background-image: url("https://onepos-media.s3.ap-southeast-1.amazonaws.com/tinigift/backdrop.jpg");
    background-repeat: no-repeat;
    background-size: cover;
}

.container {

    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

}

.container>.envelope-wrapper {
    background: var(--bg-envelope-color);
    box-shadow: 0 0 40px var(--shadow-color);
    width: 350px;
    height: 250px;
    max-width: 100%;
    max-height: 100%;


    position: relative;

}

.envelope-wrapper>.envelope {
    position: relative;
    width: 350px;
    height: 250px;
    max-width: 100%;
    max-height: 100%;
}

.envelope-wrapper>.envelope::before {
    content: "";
    position: absolute;
    top: 0;
    z-index: 2;
    border-top: 130px solid var(--envelope-tab);
    border-right: 175px solid transparent;
    border-left: 175px solid transparent;
    transform-origin: top;
    transition: all 0.5s ease-in-out 0.7s;
}

.envelope-wrapper>.envelope::after {
    content: "";
    position: absolute;
    z-index: 2;
    width: 0px;
    height: 0px;
    border-top: 130px solid transparent;
    border-right: 175px solid var(--envelope-cover);
    border-bottom: 120px solid var(--envelope-cover);
    border-left: 175px solid var(--envelope-cover);
}


.sincerely {
    text-align: center;
}

.envelope>.letter {
    position: absolute;
    right: 20%;
    border-radius: 5px;
    bottom: 0;
    width: 54%;
    height: 80%;
    background: var(--primary);
    text-align: center;
    transition: all 1s ease-in-out;
    box-shadow: 0 0 5px var(--shadow-color);
    padding: 20px 10px;
}

.envelope>.letter>.text {
    font-family: "Mali", cursive;
    font-style: normal;
    color: var(--txt-color);
    text-align: justify;
    font-size: 8px;
    padding-right: 2px;
}

.text strong {
    font-size: 8px;
}

.heart {
    position: absolute;
    background-image: url("https://onepos-media.s3.ap-southeast-1.amazonaws.com/tinigift/logo.png");
    width: 65px;
    height: 65px;
    background-size: cover;
    border-radius: 50%;
    z-index: 4;
    transition: transform 0.5s ease-in-out 1s;
    cursor: pointer;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -80%);
}

.heart:before,
.heart:after,

.flap>.envelope:before {
    transform: rotateX(180deg);
    z-index: 0;
}

.flap>.envelope>.letter {
    bottom: 120px;
    transform: scale(1.5);
    transition-delay: 1s;
}

.flap>.heart {
    transform: translate(-50%, -150%) rotate(5deg);
    transition-delay: 2s;
}



#openPopup {


    position: absolute;
    /* Đặt nút lên trên phong bì */
    top: 50%;
    /* Căn giữa theo chiều dọc */
    left: 50%;
    /* Căn giữa theo chiều ngang */
    transform: translate(-50%, 100%);
    /* Đảm bảo nút nằm chính giữa */
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    z-index: 9999;


    opacity: 0;
    /* Bắt đầu với opacity 0 để ẩn nút */
    transition: opacity 0.5s ease-in-out;
    /* Thêm hiệu ứng chuyển đổi */

}

#openPopup.show {
    opacity: 1;
    transition-delay: 2s;
    pointer-events: auto;

}

#openPopup.hide {
    opacity: 0;
    transition-delay: 0.5s;
    pointer-events: none;
}

#openPopup:hover {
    background-color: #0056b3;
}


.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.popup-content {

    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;

}

.popup-content img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}


.barcode {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -20%);
    text-align: center;
}

.barcode img {
    max-width: 50vw;
    max-height: 14vw;
}

.barcode p {
    color: rgb(0, 0, 0);
    font-size: 0.85em;
    margin-top: -3px;
}