/* enhanced-video-player.css */
/* UT영어 통합 비디오 플레이어 스타일 */
/* 테마 색상: #4CD964 (UT 그린) */

/* ============================================
   1. 모달 기본 스타일
   ============================================ */

.ut-video-player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.ut-video-player-modal.active {
    display: flex !important;
}

.ut-video-player-wrapper {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* 닫기 버튼 */
.ut-video-close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ut-video-close-button:hover {
    background: rgba(76, 217, 100, 0.8);
    transform: scale(1.1);
}

/* ============================================
   2. 비디오 컨테이너
   ============================================ */

.ut-video-player-container {
    position: relative;
    width: 100%;
    background-color: #000;
    aspect-ratio: 16 / 9;
}

.ut-video-element {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #000;
}

/* ============================================
   3. 로딩 스피너
   ============================================ */

.ut-loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 50;
}

.ut-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #4CD964;
    border-radius: 50%;
    animation: ut-spin 0.8s linear infinite;
}

@keyframes ut-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   4. 에러 오버레이
   ============================================ */

.ut-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 50;
}

.ut-error-content {
    text-align: center;
    color: white;
}

.ut-error-icon {
    margin-bottom: 20px;
}

.ut-error-message {
    font-size: 16px;
    margin-bottom: 20px;
    color: #fff;
}

.ut-error-retry {
    padding: 10px 24px;
    background-color: #4CD964;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.ut-error-retry:hover {
    background-color: #3db854;
}

/* ============================================
   5. 센터 재생 버튼
   ============================================ */

.ut-center-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 40;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ut-center-play-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.ut-center-play-button svg {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* ============================================
   6. 비디오 컨트롤
   ============================================ */

.ut-video-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.ut-video-controls * {
    pointer-events: auto;
}


/* 상단 제목 영역 - 위쪽에 그림자와 함께 배치 */
.ut-controls-top {
    width: 100%;
    padding: 20px 20px 60px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    pointer-events: auto;
    flex-shrink: 0;
}

.ut-video-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    margin: 0;
    line-height: 1.4;
}

/* 하단 컨트롤 */
.ut-controls-bottom {
    width: 100%;
    padding: 60px 24px 20px 20px;
    /* 오른쪽 패딩 증가 */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    pointer-events: auto;
    overflow: visible;
    flex-shrink: 0;
}

/* ============================================
   7. 진행 바
   ============================================ */

.ut-progress-bar-container {
    position: relative;
    width: 100%;
    height: 5px;
    margin-bottom: 12px;
    cursor: pointer;
}

.ut-progress-bar {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: visible;
}

.ut-progress-buffered {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    width: 0;
    transition: width 0.3s ease;
}

.ut-progress-played {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #4CD964;
    border-radius: 3px;
    width: 0;
}

.ut-progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background-color: #4CD964;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    left: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ut-progress-bar-container:hover .ut-progress-handle {
    opacity: 1;
}

.ut-progress-bar-container:hover .ut-progress-bar {
    height: 8px;
    transform: translateY(-1px);
    transition: height 0.2s ease, transform 0.2s ease;
}

/* 진행 바 미리보기 툴팁 */
.ut-progress-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    transform: translateX(-50%);
    margin-bottom: 10px;
    padding: 4px 8px;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    display: none;
    pointer-events: none;
    z-index: 10;
}

.ut-progress-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* ============================================
   8. 컨트롤 버튼들
   ============================================ */

.ut-controls-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ut-control-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
    line-height: 0;
    /* Align SVGs perfectly */
}

.ut-control-button:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.ut-control-button:active {
    transform: scale(0.95);
}

.ut-play-pause-btn {
    width: 40px;
    height: 40px;
    background-color: rgba(76, 217, 100, 0.2);
}

.ut-play-pause-btn:hover {
    background-color: rgba(76, 217, 100, 0.3);
}

.ut-spacer {
    flex: 1;
}

/* ============================================
   9. 시간 표시
   ============================================ */

.ut-time-display {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    min-width: 110px;
    flex-shrink: 0;
}

.ut-time-separator {
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   10. 재생 속도
   ============================================ */

.ut-playback-rate-container {
    position: relative;
}

.ut-playback-rate-btn {
    min-width: 50px;
    font-size: 14px;
    font-weight: 600;
}

.ut-rate-text {
    color: white;
}

/* 배속 메뉴 - 기본 숨김 상태 */
.ut-playback-rate-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    margin-bottom: 10px;
    background-color: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    overflow: hidden;
    /* 기본 상태: 숨김 */
    display: none;
    opacity: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 150;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* 배속 메뉴 활성화 시 표시 */
.ut-playback-rate-menu.active {
    display: block !important;
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

.ut-playback-rate-menu button {
    display: block;
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.ut-playback-rate-menu button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.ut-playback-rate-menu button.active {
    background-color: rgba(76, 217, 100, 0.3);
    color: #4CD964;
    font-weight: 600;
}

/* ============================================
   11. 볼륨
   ============================================ */

.ut-volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ut-volume-slider-container {
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
}

.ut-volume-container:hover .ut-volume-slider-container {
    width: 80px;
}

.ut-volume-slider {
    position: relative;
    width: 80px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
}

.ut-volume-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #4CD964;
    border-radius: 2px;
    width: 70%;
}

/* ============================================
   12. 반응형 디자인
   ============================================ */

@media screen and (max-width: 1024px) {
    .ut-video-player-wrapper {
        width: 95%;
        border-radius: 8px;
    }

    .ut-video-close-button {
        width: 40px;
        height: 40px;
        top: 15px;
        right: 15px;
    }

    .ut-controls-bottom {
        padding: 15px;
    }

    .ut-control-button {
        padding: 6px;
    }

    .ut-time-display {
        font-size: 13px;
        min-width: 100px;
    }
}

@media screen and (max-width: 768px) {
    .ut-video-player-wrapper {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .ut-video-close-button {
        width: 36px;
        height: 36px;
        top: 10px;
        right: 10px;
        font-size: 24px;
    }

    .ut-controls-top {
        padding: 12px 15px;
    }

    .ut-video-title {
        font-size: 14px;
    }

    .ut-controls-bottom {
        padding: 10px 12px;
    }

    .ut-controls-buttons {
        gap: 6px;
    }

    .ut-control-button {
        padding: 6px;
    }

    .ut-play-pause-btn {
        width: 36px;
        height: 36px;
    }

    .ut-control-button svg {
        width: 20px;
        height: 20px;
    }

    .ut-time-display {
        font-size: 12px;
        min-width: 90px;
        gap: 4px;
    }

    .ut-video-title {
        font-size: 15px;
    }

    /* 모바일에서 볼륨 슬라이더 항상 숨김 */
    .ut-volume-slider-container {
        display: none !important;
    }

    /* 재생 속도 버튼 크기 조정 */
    .ut-playback-rate-btn {
        min-width: 44px;
        font-size: 13px;
    }

    /* 배속 메뉴 크기 축소 */
    .ut-playback-rate-menu button {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* 진행 바 - 모바일에서 더 얇게 */
    .ut-progress-bar-container {
        height: 16px;
        margin-bottom: 8px;
    }

    .ut-progress-bar {
        height: 3px;
        top: 50%;
        transform: translateY(-50%);
    }

    .ut-progress-bar-container:hover .ut-progress-bar {
        height: 3px;
        transform: translateY(-50%);
    }
}

@media screen and (max-width: 480px) {
    .ut-video-close-button {
        width: 32px;
        height: 32px;
        top: 8px;
        right: 8px;
        font-size: 20px;
    }

    .ut-controls-top {
        padding: 10px 12px;
    }

    .ut-video-title {
        font-size: 13px;
    }

    .ut-controls-bottom {
        padding: 8px 10px;
    }

    .ut-controls-buttons {
        gap: 4px;
    }

    .ut-play-pause-btn {
        width: 32px;
        height: 32px;
    }

    .ut-control-button svg {
        width: 18px;
        height: 18px;
    }

    .ut-time-display {
        font-size: 11px;
        min-width: 80px;
    }

    .ut-video-title {
        font-size: 14px;
    }

    .ut-playback-rate-btn {
        min-width: 40px;
        font-size: 12px;
    }

    /* 배속 메뉴 더 작게 */
    .ut-playback-rate-menu button {
        padding: 6px 12px;
        font-size: 12px;
    }

    .ut-center-play-button svg {
        width: 60px;
        height: 60px;
    }
}

/* ============================================
   13. 전체화면 모드
   ============================================ */

.ut-video-player-wrapper:fullscreen {
    max-width: 100%;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.ut-video-player-wrapper:-webkit-full-screen {
    max-width: 100%;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.ut-video-player-wrapper:-moz-full-screen {
    max-width: 100%;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.ut-video-player-wrapper:fullscreen .ut-video-player-container {
    height: 100%;
}

.ut-video-player-wrapper:-webkit-full-screen .ut-video-player-container {
    height: 100%;
}

.ut-video-player-wrapper:-moz-full-screen .ut-video-player-container {
    height: 100%;
}

/* ============================================
   14. 애니메이션 및 트랜지션
   ============================================ */

@keyframes ut-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ut-video-player-modal.active .ut-video-player-wrapper {
    animation: ut-fadeIn 0.3s ease-out;
}

/* ============================================
   15. 접근성
   ============================================ */

.ut-control-button:focus,
.ut-progress-bar:focus,
.ut-volume-slider:focus {
    outline: 2px solid #4CD964;
    outline-offset: 2px;
}

/* 스크린 리더 전용 텍스트 */
.ut-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   16. 다크 모드 대응 (선택적)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .ut-error-message {
        color: #fff;
    }
}

/* ============================================
   17. 프린트 숨김
   ============================================ */

@media print {
    .ut-video-player-modal {
        display: none !important;
    }
}