/* 플레이어 컨테이너 스타일 */
.youtube-player-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 비율 */
    background-color: #000;
    overflow: hidden;
}

.youtube-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* 로딩 스타일 */
.youtube-video-container.loading .player-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10;
}

.youtube-video-container:not(.loading) .player-loading {
    display: none !important;
}

/* 커스텀 진행바 스타일 */
.video-progress-info {
    margin: 10px 15px;
}

.video-progress { 
    position: relative;
    height: 20px; 
    background-color: #e9ecef; 
    border-radius: 10px; 
    margin-bottom: 8px; 
    cursor: pointer;
    overflow: hidden;
}

.video-progress-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #dee2e6;
}

.segment-range {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.progress-bar { 
    position: absolute; 
    top: 0;
    height: 100%; 
    background-color: #28a745; 
    border-radius: 10px;
    width: 0%;
    transition: width 0.1s ease;
}

.progress-marker { 
    position: absolute; 
    top: 50%; 
    width: 16px; 
    height: 16px; 
    background-color: #155724; 
    border-radius: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.main-progress-handle {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    background-color: #007bff;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    left: 0%;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

.main-progress-handle:active {
    cursor: grabbing;
}

.progress-time-info {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

.segment-range-text {
    color: #28a745;
    font-weight: 500;
}

/* 현재 시간 스타일 */
#currentTime {
    color: #dc3545 !important;
    font-weight: bold;
    font-size: 16px;
}

#totalTime {
    font-size: 16px;
    font-weight: bold;
}

/* 시간 이동 버튼들 */
.time-control-buttons {
    margin-top: 8px;
    padding: 5px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.time-control-buttons .btn {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.time-control-buttons .btn i {
    margin-right: 2px;
}

#playPauseBtnCustom {
    min-width: 40px;
    padding: 4px 12px;
}

/* 컨트롤 스타일 */
.video-controls {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 10px;
}

/* 볼륨 조절 관련 스타일 */
.volume-control-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.volume-slider:hover::-webkit-slider-thumb {
    background: #0056b3;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

.volume-slider:hover::-moz-range-thumb {
    background: #0056b3;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

.volume-percentage {
    font-size: 11px;
    color: #666;
    min-width: 30px;
    text-align: center;
    font-weight: 500;
}

/* 음소거 버튼 스타일 */
#mainMuteToggleBtn.btn-warning {
    color: white !important;
}

#mainMuteToggleBtn.btn-warning:hover {
    color: white !important;
}

/* 모든 구간 표시 스타일 */
#allSegmentsDisplay .segment-block {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: #9ccc65;
    border: 1px solid #7cb342;
    border-radius: 2px;
    z-index: 3;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #2e7d32;
    font-weight: bold;
    text-shadow: 0 1px 1px rgba(255,255,255,0.5);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0 2px;
    min-width: 20px;
}

#allSegmentsDisplay .segment-block:hover {
    opacity: 0.9;
    background-color: #8bc34a;
    cursor: pointer;
}

#allSegmentsDisplay .segment-block.small {
    font-size: 0;
}

#allSegmentsDisplay .segment-block.small::after {
    content: '●';
    font-size: 8px;
    color: #2e7d32;
}

/* 구간 목록 컨테이너 */
.segment-list-container {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.segment-list-container::-webkit-scrollbar {
    width: 8px;
}

.segment-list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.segment-list-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.segment-list-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.segment-item {
    cursor: pointer;
    transition: background-color 0.2s;
}

.segment-item:hover {
    background-color: #f0f0f0;
}

.segment-item.active {
    background-color: #e8f4f8;
    border-color: #8bc4ea;
}

.segment-checkbox {
    transform: scale(1.2);
}

.segment-item.checked {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

/* 구간연속 버튼 스타일 */
#sequentialPlayBtn {
    background: linear-gradient(45deg, #4caf50, #8bc34a);
    border: none;
    color: white;
    font-weight: bold;
}

#sequentialPlayBtn:hover {
    background: linear-gradient(45deg, #45a049, #7cb342);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#sequentialPlayBtn:disabled {
    background: #ccc;
    color: #666;
    transform: none;
    box-shadow: none;
}

#sequentialPlayBtn.btn-warning {
    background: linear-gradient(45deg, #ff9800, #f57c00);
}

#sequentialPlayBtn.btn-warning:hover {
    background: linear-gradient(45deg, #e68900, #e65100);
}

/* 연속재생 중 표시 */
.sequential-playing {
    animation: pulse 1.5s infinite;
    border-color: #ff9800 !important;
    background-color: #fff3e0 !important;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* 반복횟수 관련 스타일 */
.repeat-count-container {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.repeat-count-btn {
    font-size: 11px;
    padding: 2px 6px;
    min-width: 40px;
    border-radius: 12px;
}

.repeat-count-btn.has-repeat {
    background-color: #ff6b6b;
    border-color: #ff5252;
    color: white;
}

.repeat-count-btn.has-repeat:hover {
    background-color: #ff5252;
    border-color: #f44336;
    color: white;
}

.repeat-count-dropdown {
    position: absolute;
    top: 100%;
    right: -50px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 240px;
    white-space: nowrap;
    display: none;
}

.repeat-count-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 62px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid white;
}

.repeat-count-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-top: 5px;
}

.repeat-count-option {
    padding: 4px 8px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    background: white;
    transition: all 0.2s;
    white-space: nowrap;
}

.repeat-count-option:hover {
    background: #f0f0f0;
    border-color: #007bff;
}

.repeat-count-option.selected {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

.repeat-count-header {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    text-align: center;
}

.repeat-count-reset {
    margin-top: 8px;
    padding: 4px 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    width: 100%;
}

.repeat-count-reset:hover {
    background: #5a6268;
}

/* 구간목록 모달 스타일 */
.modal-segment-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.modal-segment-list::-webkit-scrollbar {
    width: 8px;
}

.modal-segment-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-segment-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.modal-segment-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 구간 상세 버튼 스타일 */
.segment-detail-btn {
    font-size: 11px;
    padding: 2px 6px;
    margin-left: 8px;
}

/* 구간 상세 내용 레이어 */
.segment-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
}

.segment-detail-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 700px;
    max-height: 70%;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
}

.segment-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.segment-detail-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.segment-detail-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.segment-detail-close:hover {
    color: #333;
}

.segment-detail-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #555;
}

/* 편집 모달 관련 스타일 */
.segment-form-group {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.segment-form-group.new-segment {
    background-color: #e0f7fa !important;
    border: 2px dashed #4dd0e1 !important;
    border-radius: 8px;
}

.segment-form-group.new-segment .segment-title {
    color: #00695c;
    font-weight: bold;
}

.modal-video-preview {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.modal-progress-container {
    margin: 15px 0;
}

.modal-progress-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    text-align: center;
}

.modal-video-progress {
    position: relative;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
}

.modal-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #007bff;
    border-radius: 4px;
    width: 0%;
}

.modal-progress-handle {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    background-color: #007bff;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    left: 0%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.modal-controls {
    text-align: center;
    margin: 10px 0;
}

.modal-controls .btn {
    margin: 0 2px;
}

/* 음소거 버튼 스타일 (모달용) */
#modalMuteToggleBtn.btn-warning {
    color: white !important;
}

#modalMuteToggleBtn.btn-warning:hover {
    color: white !important;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .repeat-count-dropdown {
        right: -30px;
        min-width: 220px;
    }
    
    .repeat-count-dropdown::before {
        right: 42px;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    .volume-percentage {
        font-size: 10px;
        min-width: 25px;
    }
    
    .time-control-buttons .btn {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .segment-list-container {
        max-height: 200px;
    }
    
    .modal-segment-list {
        max-height: 350px;
    }
    
    .segment-detail-modal {
        max-width: 80%;
        max-height: 80%;
        padding: 15px;
        margin: 10px;
        width: calc(100vw - 20px);
        min-width: 280px;
    }
    
    .segment-detail-title {
        font-size: 15px;
    }
    
    .segment-detail-content {
        font-size: 14px;
        line-height: 1.5;
    }
}

@media (max-width: 576px) {
    .volume-slider-container {
        min-width: 80px;
    }
    
    .volume-slider {
        width: 50px;
    }
}

@media (max-width: 480px) {
    .modal-segment-list {
        max-height: 300px;
    }
    
    .segment-detail-modal {
        max-width: 80%;
        max-height: 85%;
        padding: 12px;
        margin: 5px;
        width: calc(100vw - 10px);
        border-radius: 6px;
    }
    
    .segment-detail-title {
        font-size: 15px;
    }
    
    .segment-detail-content {
        font-size: 14px;
    }
    
    .segment-detail-close {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}

@media (min-width: 1200px) {
    .segment-detail-modal {
        max-width: 800px;
        width: 60%;
    }
}

/* 전체화면 및 반복 컨트롤 */
.progress-time-info {
    font-size: 12px !important;
    color: #6c757d !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
}

.time-info-left {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.fullscreen-repeat-controls {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
}

/* 전체 반복 설정 */
.full-repeat-container {
    position: relative;
    display: inline-block;
}

#fullRepeatBtn {
    min-width: 80px;
    font-size: 14px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.repeat-text {
    font-size: 14px;
    font-weight: 500;
}

/* 전체화면 버튼들 */
#portraitFullscreenBtn, #landscapeFullscreenBtn {
    min-width: 44px;
    font-size: 14px;
    padding: 4px 8px;
    transition: all 0.2s ease;
}

.full-repeat-options {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    white-space: nowrap;
    margin-top: 5px;
}

.full-repeat-options.d-none {
    display: none !important;
}

.full-repeat-options::after {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid white;
}

.full-repeat-header {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    text-align: center;
    font-weight: bold;
}

.full-repeat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.full-repeat-option {
    padding: 6px 8px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    background: white;
    transition: all 0.2s;
}

.full-repeat-option:hover {
    background: #f0f0f0;
    border-color: #007bff;
}

.full-repeat-option.selected {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

.full-repeat-reset {
    width: 100%;
    padding: 6px 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.full-repeat-reset:hover {
    background: #5a6268;
}

#portraitFullscreenBtn:hover {
    background-color: #007bff;
    border-color: #0056b3;
    color: white;
    transform: translateY(-1px);
}

#landscapeFullscreenBtn:hover {
    background-color: #28a745;
    border-color: #1e7e34;
    color: white;
    transform: translateY(-1px);
}

/* 반복 활성 상태 */
#fullRepeatBtn.active {
    background-color: #dc3545;
    border-color: #c82333;
    color: white;
}

#fullRepeatBtn.active:hover {
    background-color: #c82333;
    border-color: #bd2130;
}