/**
 * Joyn Ads - Frontend Styles
 */

/* 광고 컨테이너 */
.jads-ad {
    position: relative;
    display: block;
    margin: 15px 0;
    overflow: hidden;
}

/* 광고 라벨 */
.jads-ad-label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    line-height: 1.4;
    z-index: 10;
    text-transform: uppercase;
}

/* 이미지 광고 */
.jads-ad-image .jads-image {
    display: block;
    max-width: 100%;
    height: auto;
}

.jads-ad-image a {
    display: block;
    line-height: 0;
}

/* 영상 광고 */
.jads-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.jads-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* HTML 광고 */
.jads-ad-html {
    overflow: hidden;
}

/* 위치별 래퍼 */
.jads-position-header-top,
.jads-position-header-bottom {
    text-align: center;
}

.jads-position-content-top,
.jads-position-content-middle,
.jads-position-content-bottom {
    margin: 20px 0;
}

/* 플로팅 광고 */
.jads-floating {
    position: fixed;
    z-index: 9999;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.jads-floating-close {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 24px;
    padding: 0;
    z-index: 10;
}

.jads-floating-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* 팝업 광고 */
.jads-popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jads-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.jads-popup-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.jads-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 32px;
    padding: 0;
    z-index: 10;
}

/* 재생창(joyn-tv-show, joyn-tv-live) 유동 높이: 지정한 광고 사이즈 비율로 세로 높이 적용 */
.jads-ad-fluid-player,
.jads-ad-item.jads-ad-fluid-player {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.jads-ad-fluid-player .jads-ad-image,
.jads-ad-fluid-player .jads-ad-image a,
.jads-ad-item.jads-ad-fluid-player .jads-ad-image,
.jads-ad-item.jads-ad-fluid-player .jads-ad-image a {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.jads-ad-fluid-player .jads-ad-image img,
.jads-ad-item.jads-ad-fluid-player .jads-ad-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.jads-ad-fluid-player .jads-video-wrapper,
.jads-ad-item.jads-ad-fluid-player .jads-video-wrapper {
    position: relative;
    padding-bottom: 0;
    height: 100%;
}

.jads-ad-fluid-player .jads-video-wrapper iframe,
.jads-ad-item.jads-ad-fluid-player .jads-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* joyn-tv-show API 렌더용: .joyn-ad 내부가 유동 높이 채움 */
.jads-ad-fluid-player .joyn-ad,
.jads-ad-fluid-player .joyn-ad .joyn-ad-wrapper {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.jads-ad-fluid-player .joyn-ad img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* 영상 내 광고 */
.jads-broadcast-bottom,
.jads-tvshow-bottom {
    margin-top: 15px;
}

.jads-broadcast-overlay,
.jads-tvshow-overlay {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 10px;
    background: rgba(0, 0, 0, 0.7);
}

/* 멤버 광고 */
.jads-member-sidebar,
.jads-member-profile {
    margin: 15px 0;
}

/* 랜덤 광고 */
.jads-random .jads-ad {
    margin: 10px 0;
}

/* 반응형 */
@media (max-width: 768px) {
    .jads-popup-content {
        max-width: 95%;
    }
    
    .jads-floating {
        max-width: calc(100% - 40px);
    }
}
