/* 모바일 영상 플레이어 최적화 CSS */
/* 모바일 터치 기기에서만 적용 - 기본 플레이어 기능을 보장하면서 터치 친화적으로 개선 */

/* 전역 볼륨 컨트롤 제거 - 터치 기기 감지 실패 대비책 */
.mobile-video-optimized .plyr__control[data-plyr="mute"],
.mobile-video-optimized .plyr__control[data-plyr="volume"],
.mobile-video-optimized .plyr__control[data-plyr="settings"],
.mobile-video-optimized .plyr__volume,
.mobile-video-optimized .plyr__menu,
.mobile-video-optimized .plyr__settings {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    pointer-events: none !important;
}

/* 모든 터치 기기에서 볼륨 컨트롤 완전 제거 - 화면 크기 무관 */
@media (hover: none) and (pointer: coarse), 
       (hover: none), 
       (pointer: coarse),
       screen and (-webkit-touch-enabled: 1),
       screen and (max-device-width: 1024px),
       screen and (orientation: portrait),
       only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    
    /* 볼륨 관련 모든 컨트롤 강제 제거 */
    .plyr__control[data-plyr="mute"],
    .plyr__control[data-plyr="settings"],
    .plyr__control[data-plyr="volume"],
    .plyr__volume,
    .plyr__control--volume,
    button[data-plyr="mute"],
    button[data-plyr="volume"],
    .plyr__controls .plyr__control[data-plyr="mute"],
    .plyr__controls .plyr__control[data-plyr="volume"],
    .plyr__controls .plyr__volume,
    .plyr__menu__container,
    .plyr__settings {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        pointer-events: none !important;
        z-index: -1 !important;
    }
}

/* 모바일 터치 기기에서만 적용 - 태블릿 포함 */
@media screen and (max-width: 1024px) and (hover: none) and (pointer: coarse) {
    /* 기본 터치 최적화 */
    .viewer, .plyr {
        -webkit-user-select: none;
        -moz-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        touch-action: manipulation;
    }
    
    /* StarPlyr 기본 중앙 플레이 버튼 완전히 숨김 */
    .plyr__control--overlaid:not(.mobile-center-button) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        z-index: -1 !important;
    }
    
    /* 커스텀 중앙 버튼만 표시 */
    .mobile-center-button {
        width: 80px !important;
        height: 80px !important;
        border-radius: 50% !important;
        transition: opacity 0.3s ease, transform 0.3s ease !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: flex !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 999 !important;
        background-color: rgba(220, 53, 69, 0.8) !important;
        border: none !important;
        cursor: pointer !important;
    }
    
    /* 재생 중일 때도 중앙 버튼 유지 (일시정지 버튼으로 변경) */
    .plyr--playing .plyr__control--overlaid {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: flex !important;
    }
    
    /* 컨트롤이 숨겨진 상태에서는 중앙 버튼도 숨김 */
    .plyr--hide-controls .plyr__control--overlaid,
    .plyr--hide-controls .mobile-center-button {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.3s ease, visibility 0.3s ease !important;
    }
    
    /* 중앙 버튼 호버 효과 */
    .plyr__control--overlaid:hover {
        opacity: 0.9 !important;
        transform: translate(-50%, -50%) scale(1.05) !important;
        background-color: rgba(220, 53, 69, 0.9) !important;
    }
    
    /* 컨트롤 바 터치 친화적 크기 - 한 줄 레이아웃 */
    .plyr__controls {
        padding: 12px 15px;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    
    /* 시크바 - 가장 많은 공간 차지 */
    .plyr__progress {
        display: flex;
        align-items: center;
        flex: 1;
        margin: 0 8px;
        min-width: 0;
    }
    
    /* 시간 표시 */
    .plyr__time {
        font-size: 14px;
        color: #fff;
        white-space: nowrap;
        margin: 0 4px;
        flex-shrink: 0;
    }
    
    /* 컨트롤 버튼들 */
    .plyr__control {
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
        margin: 0 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    /* 기본 시크바 스타일은 반응형 섹션에서 처리 */
    
    /* 필요한 컨트롤만 표시 - 순서 조정 */
    .plyr__control[data-plyr="play"] {
        display: flex;
        order: 0; /* 맨 앞으로 */
    }
    
    .plyr__control[data-plyr="fullscreen"] {
        display: flex;
        order: 4; /* 맨 뒤로 */
    }
    
    /* 불필요한 컨트롤 숨기기 - 강제 적용 */
    .plyr__control[data-plyr="mute"],
    .plyr__control[data-plyr="settings"],
    .plyr__control[data-plyr="volume"],
    .plyr__volume,
    .plyr__control--volume,
    button[data-plyr="mute"],
    button[data-plyr="volume"],
    .plyr__controls .plyr__control[data-plyr="mute"],
    .plyr__controls .plyr__control[data-plyr="volume"],
    .plyr__controls .plyr__volume {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        pointer-events: none !important;
        z-index: -1 !important;
    }
    
    /* 시간 표시 순서 */
    .plyr__time:first-of-type {
        order: 2; /* 시크바 다음 */
    }
    
    .plyr__time:last-of-type {
        order: 3; /* 시간 뒤 */
    }
    
    /* 시크바 순서 */
    .plyr__progress {
        order: 1; /* 플레이 버튼 다음 */
    }
    
    /* 드래그 방지 */
    .plyr video {
        pointer-events: none;
        -webkit-user-drag: none;
        -moz-user-drag: none;
        user-drag: none;
    }
    
    /* 터치 제스처 영역 */
    .plyr__video-wrapper {
        touch-action: manipulation;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 볼륨 관련 CSS는 볼륨 컨트롤을 숨겼으므로 제거 */
    
    /* 반응형 시크바 트랙 크기 */
    .plyr__progress input[type="range"] {
        height: 6px;
        width: 100%;
        /* margin: 0; */
        vertical-align: middle;
    }
    
    /* 반응형 시크바 핸들 크기 */
    .plyr__progress input[type="range"]::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
        -webkit-appearance: none;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    
    .plyr__progress input[type="range"]::-moz-range-thumb {
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        border: none;
    }
}

/* 세로 모드에서 플레이 버튼 더 크게 */
@media screen and (max-width: 1024px) and (orientation: portrait) and (hover: none) and (pointer: coarse) {
    /* 기본 버튼 숨김 */
    .plyr__control--overlaid:not(.mobile-center-button) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* 커스텀 버튼만 표시 */
    .mobile-center-button {
        width: 90px;
        height: 90px;
    }
    
    .plyr__controls {
        padding: 18px 15px;
        min-height: 70px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    
    .plyr__control {
        min-width: 48px;
        min-height: 48px;
        padding: 14px;
        margin: 0 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .plyr__time {
        font-size: 16px;
        color: #fff;
        white-space: nowrap;
        margin: 0 6px;
        flex-shrink: 0;
    }
    
    .plyr__progress {
        flex: 1;
        margin: 0 10px;
        min-width: 0;
    }
    
    .plyr__progress input[type="range"] {
        height: 8px;
    }
    
    .plyr__progress input[type="range"]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
    
    .plyr__progress input[type="range"]::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }
}

/* 가로 모드에서 컨트롤 적당히 조정 */
@media screen and (max-width: 1024px) and (orientation: landscape) and (hover: none) and (pointer: coarse) {
    /* 기본 버튼 숨김 */
    .plyr__control--overlaid:not(.mobile-center-button) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* 커스텀 버튼만 표시 */
    .mobile-center-button {
        width: 70px;
        height: 70px;
    }
    
    .plyr__controls {
        padding: 10px 12px;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    
    .plyr__control {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
        margin: 0 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .plyr__time {
        font-size: 13px;
        color: #fff;
        white-space: nowrap;
        margin: 0 4px;
        flex-shrink: 0;
    }
    
    .plyr__progress {
        flex: 1;
        margin: 0 8px;
        min-width: 0;
    }
    
    .plyr__progress input[type="range"] {
        height: 5px;
    }
    
    .plyr__progress input[type="range"]::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }
    
    .plyr__progress input[type="range"]::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }
}

/* 매우 작은 화면 (320px 이하) 최적화 */
@media screen and (max-width: 320px) and (hover: none) and (pointer: coarse) {
    .plyr__controls {
        padding: 8px 10px;
        min-height: 45px;
        gap: 4px;
    }
    
    .plyr__control {
        min-width: 36px;
        min-height: 36px;
        padding: 6px;
        margin: 0 1px;
    }
    
    .plyr__time {
        font-size: 12px;
        margin: 0 2px;
    }
    
    .plyr__progress {
        margin: 0 6px;
    }
    
    .plyr__progress input[type="range"] {
        height: 4px;
    }
    
    .plyr__progress input[type="range"]::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }
    
    .plyr__progress input[type="range"]::-moz-range-thumb {
        width: 14px;
        height: 14px;
    }
}

/* 중간 크기 화면 (321px - 480px) 최적화 */
@media screen and (min-width: 321px) and (max-width: 480px) and (hover: none) and (pointer: coarse) {
    .plyr__controls {
        padding: 10px 12px;
        min-height: 55px;
        gap: 6px;
    }
    
    .plyr__control {
        min-width: 42px;
        min-height: 42px;
        padding: 8px;
        margin: 0 2px;
    }
    
    .plyr__time {
        font-size: 14px;
        margin: 0 4px;
    }
    
    .plyr__progress {
        margin: 0 8px;
    }
    
    .plyr__progress input[type="range"] {
        height: 6px;
    }
    
    .plyr__progress input[type="range"]::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }
    
    .plyr__progress input[type="range"]::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }
}

/* 큰 화면 (481px 이상) 최적화 */
@media screen and (min-width: 481px) and (max-width: 1024px) and (hover: none) and (pointer: coarse) {
    .plyr__controls {
        padding: 12px 15px;
        min-height: 60px;
        gap: 8px;
    }
    
    .plyr__control {
        min-width: 46px;
        min-height: 46px;
        padding: 10px;
        margin: 0 3px;
    }
    
    .plyr__time {
        font-size: 15px;
        margin: 0 5px;
    }
    
    .plyr__progress {
        margin: 0 10px;
    }
    
    .plyr__progress input[type="range"] {
        height: 7px;
    }
    
    .plyr__progress input[type="range"]::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }
    
    .plyr__progress input[type="range"]::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }
}

    /* 매우 큰 화면 태블릿 (1025px 이상) 최적화 - iPad Pro 13인치 포함 */
@media screen and (min-width: 1025px) and (hover: none) and (pointer: coarse) {
    /* 기본 터치 최적화 */
    .viewer, .plyr {
        -webkit-user-select: none;
        -moz-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        touch-action: manipulation;
    }
    
    /* StarPlyr 기본 중앙 플레이 버튼 완전히 숨김 */
    .plyr__control--overlaid:not(.mobile-center-button) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        z-index: -1 !important;
    }
    
    /* 커스텀 중앙 버튼만 표시 - 큰 화면 태블릿 */
    .mobile-center-button {
        width: 100px !important;
        height: 100px !important;
        border-radius: 50% !important;
        transition: opacity 0.3s ease, transform 0.3s ease !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: flex !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 999 !important;
        background-color: rgba(220, 53, 69, 0.8) !important;
        border: none !important;
        cursor: pointer !important;
    }
    
    /* 재생 중일 때도 중앙 버튼 유지 (일시정지 버튼으로 변경) */
    .plyr--playing .plyr__control--overlaid {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: flex !important;
    }
    
    /* 컨트롤이 숨겨진 상태에서는 중앙 버튼도 숨김 */
    .plyr--hide-controls .plyr__control--overlaid,
    .plyr--hide-controls .mobile-center-button {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.3s ease, visibility 0.3s ease !important;
    }
    
    /* 중앙 버튼 호버 효과 */
    .plyr__control--overlaid:hover {
        opacity: 0.9 !important;
        transform: translate(-50%, -50%) scale(1.05) !important;
        background-color: rgba(220, 53, 69, 0.9) !important;
    }
    
    /* 컨트롤 바 터치 친화적 크기 - 한 줄 레이아웃 */
    .plyr__controls {
        padding: 15px 20px;
        min-height: 70px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
    }
    
    /* 시크바 - 가장 많은 공간 차지 */
    .plyr__progress {
        display: flex;
        align-items: center;
        flex: 1;
        margin: 0 12px;
        min-width: 0;
        order: 1; /* 플레이 버튼 다음 */
    }
    
    /* 시간 표시 */
    .plyr__time {
        font-size: 18px;
        color: #fff;
        white-space: nowrap;
        margin: 0 8px;
        flex-shrink: 0;
    }
    
    .plyr__time:first-of-type {
        order: 2; /* 시크바 다음 */
    }
    
    .plyr__time:last-of-type {
        order: 3; /* 시간 뒤 */
    }
    
    /* 컨트롤 버튼들 */
    .plyr__control {
        padding: 15px;
        min-width: 54px;
        min-height: 54px;
        margin: 0 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .plyr__control[data-plyr="play"] {
        display: flex;
        order: 0; /* 맨 앞으로 */
    }
    
    .plyr__control[data-plyr="fullscreen"] {
        display: flex;
        order: 4; /* 맨 뒤로 */
    }
    
         /* 불필요한 컨트롤 숨기기 - 강제 적용 */
     .plyr__control[data-plyr="mute"],
     .plyr__control[data-plyr="settings"],
     .plyr__control[data-plyr="volume"],
     .plyr__volume,
     .plyr__control--volume,
     button[data-plyr="mute"],
     button[data-plyr="volume"],
     .plyr__controls .plyr__control[data-plyr="mute"],
     .plyr__controls .plyr__control[data-plyr="volume"],
     .plyr__controls .plyr__volume {
         display: none !important;
         visibility: hidden !important;
         opacity: 0 !important;
         width: 0 !important;
         height: 0 !important;
         margin: 0 !important;
         padding: 0 !important;
         position: absolute !important;
         left: -9999px !important;
         top: -9999px !important;
         pointer-events: none !important;
         z-index: -1 !important;
     }
    
    /* 드래그 방지 */
    .plyr video {
        pointer-events: none;
        -webkit-user-drag: none;
        -moz-user-drag: none;
        user-drag: none;
    }
    
    /* 반응형 시크바 트랙 크기 */
    .plyr__progress input[type="range"] {
        height: 8px;
        width: 100%;
        /* margin: 0; */
        vertical-align: middle;
    }
    
    /* 반응형 시크바 핸들 크기 */
    .plyr__progress input[type="range"]::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
        -webkit-appearance: none;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    
    .plyr__progress input[type="range"]::-moz-range-thumb {
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        border: none;
    }
} 