/* 팝업 컨테이너 */
.pop-up-container {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* 팝업 아이템 - 기본 스타일 */
.pop-up-item {
    position: fixed;
    display: flex;
    flex-direction: column;
    /*align-items: center;*/
    /*justify-content: center;*/
    pointer-events: auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 10000;
    animation: popUpOpen 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    background-color: white;

    width: min(var(--popup-width, 500px), calc(100vw - 40px));
    /*56px은 푸터크기*/
    height: min(
            calc(var(--popup-height, 600px) + 56px),
            calc(100vh - 40px)
    );
    transform: translate(-50%, -50%);
}


.pop-up-body {
    display: flex;
    flex: 1;
    min-height: 0;      /* 추가 */
    overflow: hidden;   /* 추가 */

}
.pop-up-body > a {
    display: flex;
    flex: 1;
    min-height: 0;      /* 추가 */
    overflow: hidden;   /* 추가 */
}
.pop-up-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    flex: 1;
}

.pop-up-footer {
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: var(--theme);
    color: #fff;
    width: 100%;
}

.pop-up-today-hide {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.pop-up-today-hide i {
    font-size: 15px;
}

.pop-up-close {
    transition: all 0.2s ease;
}

.pop-up-close:hover {
    transform: scale(1.05);
}

.pop-up-close i {
    font-size: 18px;
}

@keyframes popUpOpen {
    from {
        opacity: 0;
        filter: blur(4px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes popUpClose {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        filter: blur(4px);
    }
}

/* ========================= 데스크탑 레이아웃 (1200px+) ========================= */
/* 3개 가로로 배치: 왼쪽 1 / 중앙 2 / 오른쪽 3 */
@media (min-width: 1201px) {
    .pop-up-item {
        top: 50%;
    }

    /*.pop-up-item[data-slot="0"] {*/
    /*    left: calc(50% - 540px);*/
    /*}*/

    /*.pop-up-item[data-slot="1"] {*/
    /*    left: 50%;*/
    /*}*/

    /*.pop-up-item[data-slot="2"] {*/
    /*    left: calc(50% + 540px);*/
    /*}*/
}

/* ========================= 태블릿 레이아웃 (768-1200px) ========================= */
/* 좌우 2개 가로, 3번째는 아래에 겹침 */
@media (min-width: 768px) and (max-width: 1200px) {
    /*.pop-up-item {*/
    /*    top: 50%;*/
    /*}*/

    /*.pop-up-item[data-slot="0"] {*/
    /*    left: calc(50% - 270px);*/
    /*}*/

    /*.pop-up-item[data-slot="1"] {*/
    /*    left: calc(50% + 270px);*/
    /*}*/
}

/* ========================= 모바일 레이아웃 (767px 이하) ========================= */
/* 모두 중앙에 겹침, 400x500 고정 */
/*@media (max-width: 767px) {*/
/*    .pop-up-item {*/
/*        width: max(92vw, 400px) !important;*/
/*        height: auto !important;*/
/*        aspect-ratio: 4 / 5;*/
/*        left: 50%;*/
/*        top: 50%;*/
/*    }*/
/*}*/
/* 태블릿/모바일에서 공통으로 쓸 수 있는 버튼 제어 정도만 남김 */
@media (max-width: 767px) {
    .pop-up-item[data-slot="1"] .pop-up-close,
    .pop-up-item[data-slot="2"] .pop-up-close,
    .pop-up-item[data-slot="1"] .pop-up-today-hide,
    .pop-up-item[data-slot="2"] .pop-up-today-hide {
        display: none;
    }
}
/* ========================= 매우 작은 모바일 (450px 이하) ========================= */
/*@media (max-width: 450px) {*/
/*    .pop-up-item {*/
/*        width: 100vw !important;*/
/*        max-width: 400px !important;*/
/*        height: auto !important;*/
/*        max-height: 90vh !important;*/
/*        aspect-ratio: 4 / 5;*/
/*        margin-left: -50vw;*/
/*    }*/
/*}*/

/* ========================= 모바일 가로 모드 ========================= */
@media (max-width: 767px) and (orientation: landscape) {
    .pop-up-item {
        width: 320px !important;
        height: 400px !important;
        margin-left: -160px;
        margin-top: -200px;
    }

    /* 2, 3번째 팝업 버튼 다시 표시 */
    .pop-up-item[data-index="1"] .pop-up-close,
    .pop-up-item[data-index="2"] .pop-up-close {
        display: flex;
    }

    .pop-up-item[data-index="1"] .pop-up-today-hide,
    .pop-up-item[data-index="2"] .pop-up-today-hide {
        display: block;
    }
}



/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .pop-up-close {
        background: rgba(40, 40, 40, 0.95);
        color: #e0e0e0;
    }

    .pop-up-close:hover {
        background: rgba(60, 60, 60, 1);
    }
}

/* 모션 감소 설정 존중 */
@media (prefers-reduced-motion: reduce) {
    .pop-up-item,
    .pop-up-close,
    .pop-up-today-hide {
        animation: none;
        transition: none;
    }
}
