/**
 * WP Popup Manager - 프론트엔드 스타일
 * 
 * @package WP_Popup_Manager
 */

/* 팝업 오버레이 */
.wp-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.wp-popup-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

/* 팝업 컨테이너 - 4:5 비율 고정 */
.wp-popup-container {
    background: #fff !important;
    border-radius: 0 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    max-width: 90vw !important;
    max-height: 90vh !important;
    width: 400px !important;
    height: 500px !important; /* 4:5 비율 */
    position: relative !important;
    overflow: hidden !important;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    z-index: 1000000 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* PC에서 더 큰 화면에 대한 최적화 - 4:5 비율 유지 */
@media (min-width: 1200px) {
    .wp-popup-container {
        width: 480px !important;
        height: 600px !important; /* 4:5 비율 */
    }
}

@media (min-width: 1600px) {
    .wp-popup-container {
        width: 560px !important;
        height: 700px !important; /* 4:5 비율 */
    }
}

.wp-popup-overlay.show .wp-popup-container {
    transform: scale(1) !important;
}

/* 팝업 캐러셀 */
.wp-popup-carousel {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-popup-slides {
    display: flex;
    transition: transform 0.5s ease;
    width: 100%;
    height: 100%;
}

.wp-popup-slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    flex-shrink: 0;
    padding: 0;
    box-sizing: border-box;
}

.wp-popup-slide img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 0 !important;
    display: block !important;
}

/* 캐러셀 네비게이션 버튼 */
.wp-popup-prev,
.wp-popup-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.3s ease;
}

.wp-popup-prev:hover,
.wp-popup-next:hover {
    background: rgba(0, 0, 0, 0.5);
}

.wp-popup-prev {
    left: 10px;
}

.wp-popup-next {
    right: 10px;
}

/* 단일 팝업일 때 네비게이션 버튼 숨기기 */
.wp-popup-single .wp-popup-prev,
.wp-popup-single .wp-popup-next {
    display: none !important;
}

/* 하단 컨트롤 바 */
.wp-popup-controls {
    position: relative;
    background: #000 !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 오늘 하루 보지 않기 텍스트 */
.wp-popup-dismiss-today {
    background: none !important;
    border: none !important;
    color: #fff !important;
    font-size: 14px !important;
    cursor: pointer !important;
    text-decoration: underline !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: inherit !important;
}

.wp-popup-dismiss-today:hover {
    color: #ccc !important;
}

/* 닫기 버튼 */
.wp-popup-close {
    background: none !important;
    border: none !important;
    color: #fff !important;
    font-size: 20px !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold !important;
}

.wp-popup-close:hover {
    color: #ccc !important;
}

.wp-popup-close span {
    line-height: 1 !important;
}

/* 팝업 인디케이터 - 숨김 처리 */
.wp-popup-indicators {
    display: none !important;
}

/* 단일 팝업일 때 인디케이터 숨기기 */
.wp-popup-single .wp-popup-indicators {
    display: none !important;
}

/* 로딩 상태 */
.wp-popup-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 14px;
}

.wp-popup-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: wp-popup-spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes wp-popup-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 애니메이션 */
@keyframes wp-popup-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes wp-popup-slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* 반응형 디자인 - 모바일에서도 4:5 비율 유지 */
@media (max-width: 768px) {
    .wp-popup-container {
        width: 80vw !important;
        height: calc(80vw * 1.25) !important; /* 4:5 비율 유지 */
        max-height: 85vh !important;
        margin: 20px;
    }
    
    .wp-popup-carousel {
        height: calc(100% - 50px); /* 컨트롤 바 높이 제외 */
    }
    
    .wp-popup-slide {
        padding: 0;
    }
    
    .wp-popup-slide img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }
    
    .wp-popup-controls {
        height: 45px !important;
        padding: 0 15px !important;
    }
    
    .wp-popup-dismiss-today {
        font-size: 13px !important;
    }
    
    .wp-popup-close {
        font-size: 18px !important;
        width: 28px !important;
        height: 28px !important;
    }
}

@media (max-width: 480px) {
    .wp-popup-container {
        width: 85vw !important;
        height: calc(85vw * 1.25) !important; /* 4:5 비율 유지 */
        margin: 10px;
        max-height: 90vh !important;
    }
    
    .wp-popup-carousel {
        height: calc(100% - 40px); /* 컨트롤 바 높이 제외 */
    }
    
    .wp-popup-slide {
        padding: 0;
    }
    
    .wp-popup-slide img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }
    
    .wp-popup-controls {
        height: 40px !important;
        padding: 0 10px !important;
    }
    
    .wp-popup-dismiss-today {
        font-size: 12px !important;
    }
    
    .wp-popup-close {
        font-size: 16px !important;
        width: 25px !important;
        height: 25px !important;
    }
}

/* 접근성 개선 */
.wp-popup-overlay:focus {
    outline: none;
}

.wp-popup-container:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    .wp-popup-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .wp-popup-container {
        border: 2px solid #000;
    }
    
    .wp-popup-close,
    .wp-popup-dismiss-today {
        background: #000;
        color: #fff;
        border: 1px solid #fff;
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .wp-popup-container {
        background: #2c2c2c;
        color: #fff;
    }
    
    .wp-popup-slide {
        background: #1a1a1a;
    }
    
    .wp-popup-close,
    .wp-popup-dismiss-today {
        background: rgba(255, 255, 255, 0.2);
        color: #fff;
    }
    
    .wp-popup-close:hover,
    .wp-popup-dismiss-today:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

/* 인쇄 시 숨기기 */
@media print {
    .wp-popup-overlay {
        display: none !important;
    }
}

/* 애니메이션 성능 최적화 */
.wp-popup-overlay,
.wp-popup-container,
.wp-popup-slides {
    will-change: transform, opacity;
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    .wp-popup-prev,
    .wp-popup-next,
    .wp-popup-close,
    .wp-popup-dismiss-today {
        min-height: 44px;
        min-width: 44px;
    }
    
    .wp-popup-indicator {
        min-height: 20px;
        min-width: 20px;
    }
}
