/**
 * Joyn TV Live 플레이어 페이지 스타일
 * 라이브 전용 재생창 (재생목록 없음, 댓글창만)
 *
 * @package    Joyn_Broadcast
 * @since      1.0.0
 */

.joyn-tv-live-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: #000;
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
}

/* WordPress 테마의 기본 스타일 오버라이드 */
body .joyn-tv-live-container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
}

.joyn-tv-live-tabs-wrapper {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #1a1a1a;
    border-bottom: 2px solid #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
    margin: 0;
    padding: 0;
    left: 0;
    right: 0;
}

/* 헤더가 고정되어 있을 경우를 대비 */
body.admin-bar .joyn-tv-live-tabs-wrapper {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .joyn-tv-live-tabs-wrapper {
        top: 46px;
    }
}

.joyn-tv-live-tabs {
    display: flex;
    background: #1a1a1a;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #666 #1a1a1a;
    margin: 0;
    padding: 0;
    min-height: 59px;
    box-sizing: border-box;
}

.joyn-tv-live-tabs::-webkit-scrollbar {
    height: 4px;
}

.joyn-tv-live-tabs::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 2px;
}

.joyn-tv-live-tabs::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.joyn-tv-live-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #999;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: max-content;
    flex-shrink: 0;
    min-height: 59px;
    box-sizing: border-box;
}

.joyn-tv-live-tab i {
    font-size: 18px;
    display: none;
}

.joyn-tv-live-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.joyn-tv-live-tab--active {
    color: #fff;
    border-bottom-color: var(--category-color, #667eea);
    background: rgba(255, 255, 255, 0.05);
    font-weight: 500;
}

.joyn-tv-live-tab--active i {
    color: var(--category-color, #667eea);
}

.joyn-tv-live-player-wrapper {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    background: #000;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* 아이패드 및 태블릿에서 좌우 여백 제거 */
@media (max-width: 1024px) {
    .joyn-tv-live-player-wrapper {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

.joyn-tv-live-video-title {
    order: 2;
}

.joyn-tv-live-upcoming-thumbnails {
    order: 3;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 12px 20px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    display: none; /* JavaScript로 표시/숨김 제어 */
}

.joyn-tv-live-upcoming-thumbnails-inner {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.joyn-tv-live-upcoming-thumbnail-item {
    position: relative;
    width: 120px;
    height: 68px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    cursor: default; /* 클릭 불가 */
    pointer-events: none; /* 모든 인터랙션 비활성화 */
    opacity: 0.7; /* 약간 투명하게 */
}

.joyn-tv-live-upcoming-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.joyn-tv-live-comments-wrapper {
    order: 4;
}

.joyn-tv-live-player-box {
    position: relative;
    width: 100%;
    background: #000;
}

.joyn-tv-live-player-wrapper-inner {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 비율 (기본값) */
    height: 0;
    overflow: hidden;
    background: #000;
    transition: padding-bottom 0.3s ease;
}

/* 숏츠 영상: 9:16 비율 (세로) - 세로 크기 30% 줄임 */
.joyn-tv-live-player-wrapper-inner.joyn-tv-live-shorts-mode,
.joyn-tv-live-player-wrapper-inner[data-shorts-mode="true"] {
    padding-bottom: 140% !important; /* 세로 크기 30% 줄임 (200% * 0.7 = 140%) */
    max-width: 400px !important; /* 숏츠 영상 최대 너비 제한 (세로가 더 길어지도록) */
    margin: 0 auto !important; /* 가운데 정렬 */
    width: 100% !important;
}

/* 숏츠 모드일 때 플레이어 박스도 조정 */
.joyn-tv-live-player-box.shorts-mode {
    max-width: 400px !important;
    margin: 0 auto !important;
}

/* 숏츠 재생 시 재생창 z-index 높이기 */
.joyn-tv-live-player-box.shorts-mode {
    position: relative;
    z-index: 1001 !important; /* 푸터보다 위에 표시 */
}

/* 숏츠 재생 시 푸터가 재생창 밑으로 가도록 */
body.joyn-shorts-mode-active .site-footer,
body.joyn-shorts-mode-active footer,
body.joyn-shorts-mode-active .ast-footer,
body.joyn-shorts-mode-active .footer-widget-area {
    position: relative;
    z-index: 1 !important;
}

.joyn-tv-live-player {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #000 !important;
    z-index: 1;
}

.joyn-tv-live-player iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1;
}

.joyn-tv-live-player > div {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
}

.joyn-tv-live-video-title {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 16px 20px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    position: relative;
}

.joyn-tv-live-video-title-text {
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* 일반 화면에서는 여러 줄로 표시 */
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    flex: 1;
    min-width: 0;
}

.joyn-tv-live-title-toggle {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: transform 0.2s ease;
}

.joyn-tv-live-title-toggle:hover {
    opacity: 0.8;
}

.joyn-tv-live-title-toggle i {
    font-size: 18px;
    color: #ffffff;
}

/* 영상 제목 텍스트 강제 흰색 적용 */
.joyn-tv-live-video-title,
.joyn-tv-live-video-title *,
.joyn-tv-live-video-title span {
    color: #ffffff !important;
}

.joyn-tv-live-comments-wrapper {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    background: #1a1a1a;
    border-top: 1px solid #333;
}

.joyn-tv-live-comments-header {
    padding: 20px;
    border-bottom: 1px solid #333;
}

.joyn-tv-live-comments-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.joyn-tv-live-comments-content {
    padding: 20px;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
    color: #fff;
}

.joyn-tv-live-player-loading {
    padding: 60px 20px;
    text-align: center;
    color: #999;
    font-size: 16px;
}

/* 모바일 반응형 */
/* 태블릿 크기 (아이패드 등, 1024px 이하) */
@media (max-width: 1024px) {
    /* 태블릿에서 재생창 크기 확대 - 좌우 여백 없이 꽉 차게 */
    .joyn-tv-live-player-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .joyn-tv-live-player-box {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .joyn-tv-live-player-wrapper-inner {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        padding-bottom: 56.25% !important; /* 16:9 비율 유지 */
    }
    
    .joyn-tv-live-player {
        width: 100% !important;
        height: 100% !important;
    }
    
    .joyn-tv-live-video-title {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .joyn-tv-live-upcoming-thumbnails {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .joyn-tv-live-comments-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
}

@media (max-width: 768px) {
    /* 모바일에서 body, html 여백 완전 제거 */
    body,
    html {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .joyn-tv-live-container {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative;
        left: 0;
        right: 0;
    }
    
    .joyn-tv-live-tabs-wrapper {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 1000;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        left: 0 !important;
        right: 0 !important;
    }
    
    .joyn-tv-live-tabs {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #666 #1a1a1a;
        min-height: 42px;
        box-sizing: border-box;
    }
    
    .joyn-tv-live-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .joyn-tv-live-tab {
        padding: 12px 14px;
        font-size: 13px;
        min-width: max-content;
        flex-shrink: 0;
        min-height: 42px;
        box-sizing: border-box;
    }
    
    .joyn-tv-live-tab i {
        display: none;
    }
    
    .joyn-tv-live-tab span {
        white-space: nowrap;
    }
    
    .joyn-tv-live-player-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0;
        padding-top: 0;
        scroll-margin-top: 90px;
        z-index: 1;
    }
    
    /* 모바일에서 재생창 박스 전체 너비 사용 (_category와 동일) */
    .joyn-tv-live-player-box {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* 모바일에서 플레이어 wrapper-inner 전체 너비 사용 (_category와 동일) */
    .joyn-tv-live-player-wrapper-inner {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding-bottom: 56.25% !important; /* 16:9 비율 유지 */
    }
    
    .joyn-tv-live-comments-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .joyn-tv-live-comments-header {
        padding: 15px;
    }
    
    .joyn-tv-live-comments-header h3 {
        font-size: 16px;
    }
    
    .joyn-tv-live-comments-content {
        padding: 15px;
        min-height: 200px;
        max-height: 400px;
    }
    
    .joyn-tv-live-video-title {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 12px 15px;
        display: flex;
        align-items: flex-start;
        gap: 6px;
    }
    
    .joyn-tv-live-video-title-text {
        font-size: 12px;
        color: #ffffff !important;
        display: block;
        flex: 1;
        min-width: 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
        /* 기본 상태: 한 줄로 제한 */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.4;
    }
    
    /* 펼쳐진 상태: 여러 줄로 표시 */
    .joyn-tv-live-video-title.expanded .joyn-tv-live-video-title-text {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    
    .joyn-tv-live-title-toggle {
        padding: 2px;
        margin-top: 0;
        flex-shrink: 0;
    }
    
    .joyn-tv-live-title-toggle i {
        font-size: 16px;
    }
    
    /* 모바일에서도 제목 흰색 강제 적용 */
    .joyn-tv-live-video-title,
    .joyn-tv-live-video-title *,
    .joyn-tv-live-video-title span {
        color: #ffffff !important;
    }
    
    /* 모바일에서 다음 영상 썸네일 */
    .joyn-tv-live-upcoming-thumbnails {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 10px 15px;
    }
    
    .joyn-tv-live-upcoming-thumbnails-inner {
        gap: 8px;
    }
    
    .joyn-tv-live-upcoming-thumbnail-item {
        width: 90px;
        height: 51px;
    }
    
    /* 모바일에서 숏츠 영상 비율 조정 (_category와 동일) */
    .joyn-tv-live-player-wrapper-inner.joyn-tv-live-shorts-mode,
    .joyn-tv-live-player-wrapper-inner[data-shorts-mode="true"] {
        max-width: 100% !important; /* 모바일에서는 전체 너비 사용 */
        width: 100% !important;
        padding-bottom: 140% !important; /* 세로 크기 30% 줄임 (200% * 0.7 = 140%) */
    }
    
    /* 모바일에서 숏츠 모드일 때 박스도 전체 너비 (_category와 동일) */
    .joyn-tv-live-player-box.shorts-mode {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* 모바일에서 푸터 숨김 */
    .site-footer,
    footer,
    .ast-footer,
    .footer-widget-area,
    .site-footer-wrap,
    .footer-widgets,
    .footer-bottom {
        display: none !important;
    }
}

/* WordPress 테마의 기본 padding/margin 제거 */
.site-content,
.content-area,
.main-content,
.entry-content,
.post-content {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

.container,
.wrap,
.site-main {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 모바일에서 모든 컨테이너 여백 완전 제거 */
@media (max-width: 768px) {
    /* WordPress 테마 컨테이너 여백 완전 제거 */
    .site-content,
    .content-area,
    .main-content,
    .entry-content,
    .post-content,
    .container,
    .wrap,
    .site-main,
    .ast-container,
    .ast-separate-container,
    .site-content .ast-container,
    .site-content .wrap,
    #content,
    #main,
    #primary,
    #secondary,
    .content,
    .main,
    .page-content,
    .entry-content {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* _live 컨테이너 직접 여백 제거 */
    .joyn-tv-live-container,
    .joyn-tv-live-container * {
        box-sizing: border-box !important;
    }
    
    /* 모든 하위 요소 여백 제거 */
    .joyn-tv-live-player-wrapper,
    .joyn-tv-live-player-box,
    .joyn-tv-live-player-wrapper-inner,
    .joyn-tv-live-player,
    .joyn-tv-live-video-title,
    .joyn-tv-live-comments-wrapper,
    .joyn-tv-live-upcoming-thumbnails {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* 내부 패딩은 유지 (텍스트 가독성) */
    .joyn-tv-live-video-title {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .joyn-tv-live-comments-wrapper,
    .joyn-tv-live-comments-header,
    .joyn-tv-live-comments-content {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .joyn-tv-live-upcoming-thumbnails {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* 아이패드 및 태블릿에서 전체 너비 사용 (카테고리 재생창과 동일) */
@media (max-width: 1024px) {
    .joyn-tv-live-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    body .joyn-tv-live-container {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    /* 테마 컨테이너도 전체 너비로 */
    .site-content,
    .content-area,
    .main-content,
    .entry-content,
    .post-content,
    .container,
    .wrap,
    .site-main {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}
