* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #00d4ff, #00ff00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    font-size: 1.1em;
    color: #b0b0b0;
}

.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

.file-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.file-list h2 {
    margin-bottom: 15px;
    font-size: 1.3em;
    color: #00d4ff;
}

.file-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.file-item:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    transform: translateX(5px);
}

.file-item.active {
    background: rgba(0, 255, 0, 0.1);
    border-color: #00ff00;
}

.file-item-name {
    font-size: 0.9em;
    word-break: break-all;
    color: #ffffff;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #b0b0b0;
}

.player-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-container {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#videoPlayer {
    width: 100%;
    max-height: 500px;
    display: block;
}

.progress-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
    position: relative;
}

.progress-bar-wrapper {
    position: relative;
    width: 100%;
    height: 60px;
    background: #0f0f1e;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    touch-action: pan-y; /* 세로 스크롤만 허용, 가로 터치 드래그 허용 */
    -webkit-tap-highlight-color: transparent; /* 터치 하이라이트 제거 */
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
}

.progress-selected {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(0, 255, 0, 0.3);
    pointer-events: none;
    transition: all 0.1s ease;
}

.marker {
    position: absolute;
    top: 0;
    width: 4px;
    height: 100%;
    background: #00d4ff;
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
    touch-action: none; /* 터치 스크롤 방지 */
    -webkit-touch-callout: none; /* iOS 롱프레스 메뉴 방지 */
    user-select: none; /* 텍스트 선택 방지 */
}

.marker-handle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 100%;
    background: #00d4ff;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    /* 모바일에서 터치 영역 확대 */
    min-width: 44px; /* 최소 터치 영역 (iOS 권장) */
    min-height: 44px;
    padding: 16px; /* 터치 영역 확대를 위한 패딩 */
    margin: -16px;
}

.marker-time {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75em;
    background: rgba(0, 212, 255, 0.9);
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    font-weight: bold;
}

.marker-time.start-time {
    top: -25px;
}

.marker-time.end-time {
    bottom: -25px;
}

.current-position-line {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #ffffff;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.controls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #00ff00, #00cc00);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 0, 0.3);
}

.btn-primary.active {
    background: linear-gradient(45deg, #ff4444, #cc0000);
}

.btn-primary.active:hover {
    background: linear-gradient(45deg, #ff6666, #ff0000);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 1em;
    color: #ffffff;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #00d4ff;
}

.memo-input {
    flex: 1;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 0.9em;
}

.memo-input::placeholder {
    color: #b0b0b0;
}

.memo-input:focus {
    outline: none;
    border-color: #00d4ff;
    background: rgba(255, 255, 255, 0.15);
}

.time-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.time-marker {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%);
}

.saved-ranges-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
    margin-top: 20px;
}

.saved-ranges-section h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #00d4ff;
}

.saved-ranges-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.saved-range-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.saved-range-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00d4ff;
}

.saved-range-info {
    flex: 1;
}

.saved-range-file {
    font-weight: bold;
    color: #00d4ff;
    margin-bottom: 5px;
}

.saved-range-time {
    color: #ffffff;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.saved-range-memo {
    color: #b0b0b0;
    font-size: 0.85em;
    font-style: italic;
}

.saved-range-actions {
    display: flex;
    gap: 10px;
}

.btn-apply,
.btn-delete {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-apply {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    color: #ffffff;
}

.btn-apply:hover {
    background: linear-gradient(45deg, #00ff00, #00cc00);
    transform: translateY(-2px);
}

.btn-delete {
    background: rgba(255, 68, 68, 0.8);
    color: #ffffff;
}

.btn-delete:hover {
    background: rgba(255, 68, 68, 1);
    transform: translateY(-2px);
}

.empty,
.error {
    text-align: center;
    padding: 20px;
    color: #b0b0b0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.btn-pagination {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-pagination:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: #00d4ff;
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: #ffffff;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

/* 스크롤바 스타일링 */
.file-list::-webkit-scrollbar {
    width: 8px;
}

.file-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.file-list::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.5);
    border-radius: 4px;
}

.file-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.8);
}

.saved-ranges-list::-webkit-scrollbar {
    width: 8px;
}

.saved-ranges-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.saved-ranges-list::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.5);
    border-radius: 4px;
}

.saved-ranges-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.8);
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .file-list {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .controls {
        flex-direction: column;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
        min-height: 44px; /* 모바일 터치 영역 확보 */
    }
    
    .progress-bar-wrapper {
        height: 80px; /* 모바일에서 더 큰 터치 영역 */
    }
    
    .marker-handle {
        min-width: 50px; /* 모바일에서 더 큰 터치 영역 */
        min-height: 50px;
        padding: 20px;
        margin: -20px;
    }
    
    .marker-time {
        font-size: 0.7em; /* 모바일에서 약간 작게 */
        padding: 3px 8px;
    }
    
    .marker-time.start-time {
        top: -30px; /* 모바일에서 더 위로 */
    }
    
    .marker-time.end-time {
        bottom: -30px; /* 모바일에서 더 아래로 */
    }
    
    .video-container {
        max-height: 400px;
    }
    
    #videoPlayer {
        max-height: 400px;
    }
    
    .saved-ranges-section {
        padding: 15px;
    }
    
    .saved-range-item {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    .saved-range-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .btn-apply,
    .btn-delete {
        flex: 1;
        min-height: 44px;
    }
}

/* 모바일 터치 최적화 */
@media (hover: none) and (pointer: coarse) {
    /* 터치 디바이스 전용 스타일 */
    .marker-handle {
        width: 20px; /* 터치에서 더 넓게 */
        min-width: 50px;
    }
    
    .progress-bar-wrapper {
        height: 80px;
    }
    
    .btn {
        min-height: 48px;
        font-size: 1.1em;
    }
    
    .file-item {
        min-height: 48px;
        padding: 15px;
    }
}


