/**
 * 팝업 스타일
 */

/* 팝업 오버레이 */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent; /* 배경 흐림 제거 */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none; /* 오버레이 클릭 방지 (팝업 컨테이너는 pointer-events: auto) */
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 팝업 컨테이너 */
.popup-container {
    position: relative;
    background-color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS 부드러운 스크롤 */
    overscroll-behavior: contain; /* 스크롤 체이닝 방지 */
    touch-action: pan-y pinch-zoom; /* 세로 터치 스크롤 및 줌 허용 */
    transform: scale(0.9);
    transition: transform 0.3s ease;
    pointer-events: auto; /* 팝업 컨테이너는 클릭 가능 */
    display: flex;
    flex-direction: column;
}

.popup-container.dragging {
    transition: none; /* 드래그 중에는 transition 비활성화 */
    cursor: move;
}

.popup-overlay.active .popup-container {
    transform: scale(1);
}

/* 팝업 헤더 */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    cursor: move; /* 드래그 가능 표시 */
    user-select: none; /* 텍스트 선택 방지 */
    flex-shrink: 0;
}

.popup-header.dragging {
    cursor: grabbing;
}

.popup-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    flex-shrink: 0;
    z-index: 10;
}

.popup-close:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* 오른쪽 상단 X 닫기 버튼 */
.popup-close-top {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.popup-close-top:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

/* 팝업 바디 */
.popup-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.popup-content {
    color: #666;
    line-height: 1.6;
}

.popup-content h1,
.popup-content h2,
.popup-content h3,
.popup-content h4,
.popup-content h5,
.popup-content h6 {
    color: #333;
    margin-top: 0;
}

.popup-content ul,
.popup-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.popup-content li {
    margin-bottom: 0.5rem;
}

.popup-content p {
    margin: 1rem 0;
}

.popup-content p:first-child {
    margin-top: 0;
}

.popup-content p:last-child {
    margin-bottom: 0;
}

/* 팝업 이미지 */
.popup-image {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* 팝업 링크 */
.popup-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

.popup-link:hover {
    opacity: 0.8;
}

/* 팝업 체크박스 (하루 동안 표시 안 함) */
.popup-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    cursor: default; /* 드래그 비활성화 */
}

.popup-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
}

.popup-checkbox-label input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

/* 디바이스별 반응형 디자인 */
/* 태블릿 세로 (768px ~ 1023px) */
@media (max-width: 1023px) {
    .popup-container {
        max-width: 90%;
    }
}

/* 모바일 중형 (480px ~ 767px) */
@media (max-width: 767px) {
    .popup-container {
        max-width: 95%;
    }
    
    .popup-header {
        padding: 1rem;
    }
    
    .popup-title {
        font-size: 1.25rem;
    }
    
    .popup-body {
        padding: 1rem;
    }
    
    .popup-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: flex-start;
    }
}

