/* Popup Common */
.popup-overlay,
.popup-overlay *,
.popup-toggle,
.popup-toggle * {
    box-sizing: border-box;
}

/* Popup Overlay/Dim */
.popup-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;

    display: grid !important;
    place-items: center;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Modal Content Container */
.popup-modal {
    background: #fff;

    /* JS에서 --popup-width 값만 넣고, 실제 반응형 제한은 CSS가 처리 */
    width: var(--popup-width, 500px);
    max-width: calc(100vw - 32px);

    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);

    margin: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;

    display: flex;
    flex-direction: column;
}

/* 높이가 지정된 팝업일 때 */
.popup-modal.has-fixed-height {
    height: var(--popup-height);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
}

/* Header & Footer */
.popup-header {
    flex: 0 0 auto;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;

    font-weight: bold;
    background: yellowgreen;
}

.popup-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popup-footer {
    flex: 0 0 auto;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    background: #f9f9f9;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;

    font-size: 14px;
}

/* Slider/Carousel Structure */
.popup-slider-container {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.popup-slider-track {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    transition: transform 0.4s ease-in-out;
}

.popup-slide {
    flex: 0 0 100%;
    min-width: 100%;
    max-width: 100%;
    min-height: 0;

    box-sizing: border-box;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
}

/* 팝업 내용 안 이미지/동영상 반응형 */
.popup-slide img,
.popup-slide video,
.popup-slide iframe,
.popup-slide embed,
.popup-slide object {
    max-width: 100%;
}

.popup-slide img,
.popup-slide video {
    height: auto;
}

/* 팝업 내용 안 테이블 대응 */
.popup-slide table {
    max-width: 100%;
    width: 100%;
    border-collapse: collapse;
}

.popup-slide * {
    max-width: 100%;
}

/* Controls */
.popup-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px 10px;
    color: #555;
    transition: color 0.2s;
    line-height: 1;
}

.popup-nav-btn:hover {
    color: #000;
}

.popup-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin: 0;
}

.popup-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.2s;
}

.popup-dot.active {
    background: #333;
}

/* Checkbox Label */
.popup-dont-show-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.popup-close-btn {
    background: #333;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

/* Popup Zone Toggle */
.popup-toggle {
    position: fixed;
    right: 14px;
    bottom: 90px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;

    background: linear-gradient(135deg, #ef6b3b, #d95b2d);
    color: #fff;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(217, 91, 45, 0.35);
    font-weight: 700;
    font-size: 15px;
    z-index: 9999;
    transition: all .25s ease;
    animation: floaty 2.5s ease-in-out infinite;
    border: 0;
    cursor: pointer;
}

.popup-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(217, 91, 45, 0.45);
}

@keyframes floaty {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* Tablet */
@media (max-width: 768px) {
    .popup-overlay {
        padding: 14px;
    }

    .popup-modal {
        max-width: calc(100vw - 28px);
        max-height: calc(100vh - 28px);
        max-height: calc(100dvh - 28px);
        border-radius: 8px;
    }

    .popup-slide {
        padding: 16px;
    }

    .popup-footer {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .popup-overlay {
        padding: 10px;
        place-items: center;
    }

    .popup-modal {
        width: 100% !important;
        max-width: none;
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 6px;
    }

    .popup-modal.has-fixed-height {
        height: auto;
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
    }

    .popup-header {
        padding: 9px 12px;
        font-size: 14px;
    }

    .popup-slide {
        padding: 14px;
        font-size: 14px;
    }

    .popup-footer {
    	flex-direction: row;
        padding: 10px 12px;
        align-items: stretch;
        gap: 8px;
        font-size: 13px;
    }

    .popup-footer > div {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 6px !important;
    }

    .popup-dont-show-label {
        white-space: normal;
    }

    .popup-close-btn {
        padding: 7px 12px;
    }

    .popup-toggle {
        left: 12px;
        right: 12px;
        bottom: 16px;
        width: auto;
        padding: 13px 16px;
        font-size: 14px;
    }
}