/* 파일 업로더 스타일 */
.file-input{
	position:absolute;
	left:-9999px;
	width:1px;
	height:1px;
	opacity:0;
}
.file-uploader-component {
	position: relative;
}
.upload-area {
	padding: 16px;
	border-radius: 5px;
	border:1px solid #e5e5e5;
	font-size: 14px;
	color: #767678;
	line-height: 20px;
	letter-spacing: 0;
	transition: background-color 0.3s, border-color 0.3s, color 0.3s;
	position: relative;
}
.upload-area.drag-over {
	border: 1px dashed #00bcd4;;
	background-color: #f0fbfc;
	color: #00bcd4;
}

/* 아이콘과 텍스트를 한 줄에 표시 */
.upload-content {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	margin-top: 0 !important;
}
.upload-text {
	margin-right: 4px;
}

/* 파일 선택 버튼 */
.file-select-btn {
	display: inline-block;
	color: #444;
	background: none;
	border: none;
	text-decoration: underline;
	padding: 0;
	margin: 0;
	cursor: pointer;
	font-size: 15px;
	white-space: nowrap;
}
.icon-upload {
	display: inline-block;
	width:30px;
	height:30px;
	border-radius:3px;
	color: #fff;
	vertical-align: middle;
	background-color: #444444;
	cursor: pointer;
	background-image:url(../images/icon_file_upload.png);
	background-repeat: no-repeat;
	background-position:50% 50%;transition: all 0.3s;
	margin-right: 10px;
}

/* 파일 항목(가로/세로 반응형) */
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;    
}

.file-item:not(:last-child) {
    margin-bottom: 14px;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 10px;
}
/* 파일 업로드 날짜 수직 정렬 수정 */
.file-upload-date {
    white-space: nowrap;
    color: #767678;
    font-size: 13px;
    margin-left: 8px;
    display: flex;
    align-items: center;
    align-self: center;
}

/* 전체 파일 정보 영역의 정렬 개선 */
.file-info {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}
.file-name {
    min-width: 0;
    flex: 1 1 0%;
    margin-right: 10px;
    display: flex;
    align-items: center;
}
.file-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 0%;
    display: block;
}

.file-name-text:hover{
	cursor: pointer;
	color: #1e90ff;
}

/* 아이콘 정렬도 조정 */
.file-icon {
    margin-right: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
}

/* 삭제 버튼 정렬도 함께 조정 */
.remove-btn {
    cursor: pointer;
    color: #A8A8A8;
    margin-right: 10px;
    font-size: 16px;
    display: flex;
    align-items: center;
    height: 24px;
    transition: color 0.18s;
}

.remove-btn:hover,
.remove-btn:focus {
    color: #dc3545;
    text-shadow: 0 0 3px rgba(220, 53, 69, 0.18);
    outline: none;
}

.file-icon, .remove-btn{
	margin-top: -2.5px
}
.file-size {
    font-size: 13px;
    color: #A8A8A8;
    width: 60px;
    text-align: right;
    white-space: nowrap;
}
.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
}

.progress-bar {
	height: 100%;
	width: 0%;
	background: #03C75A;
	transition: width 0.2s ease-in-out;
}
/* 퍼센트 표시 영역 */
.progress-percent {
    width: 36px;
    text-align: right;
    font-size: 13px;
    flex-shrink: 0;
}

/* 업로드 상태 아이콘 */
.upload-status {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 프로그레스 바 박스 */
.progress-bar-box {
    width: 120px;
    height: 6px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    flex-grow: 0;
}
.progress-elements {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 192px;
    justify-content: flex-end;
}
.file-download {
    text-align: right;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* 업로드 모드 성공/실패 체크는 한줄! */
.file-uploader-component:not(.read-only-uploader) .progress-elements {
    flex-wrap: nowrap;
    min-width: 0;
}
.file-uploader-component:not(.read-only-uploader) .upload-status {
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    height: 16px;
    width: 16px;
}
.file-uploader-component:not(.read-only-uploader) .progress-percent {
    margin-right: 0;
}
.file-uploader-component:not(.read-only-uploader) .upload-status.status-success::before,
.file-uploader-component:not(.read-only-uploader) .upload-status.status-error::before {
    display: inline-block;
    font-size: 14px;
    margin-left: 2px;
    margin-top: 0;
    vertical-align: middle;
}
.file-uploader-component:not(.read-only-uploader) .upload-status.status-success::before {
    content: "✔";
    color: #03C75A;
    font-weight: bold;
}
.file-uploader-component:not(.read-only-uploader) .upload-status.status-error::before {
    content: "✖";
    color: #f44336;
    font-weight: bold;
}

/* read-only 성공/실패 체크(줄바꿈) 등은 아래처럼 건드리지 않음 */
.upload-status.status-success::before {
	content: "✔";
	color: #03C75A;
	font-weight: bold;
	display: inline-block;
	font-size: 14px;
}
.upload-status.status-error::before {
	content: "✖";
	color: #f44336;
	font-weight: bold;
	display: inline-block;
	font-size: 14px;
}

.upload-error-msg {
	color: #f44336;
	font-size: 13px;
	margin-top: 2px;
	margin-left: 24px;
}

/* 파일 안내 문구 스타일 */
.file-guide {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	color: #666;
	line-height: 1.4;
}
.file-list:not(:empty) + .file-guide {
	margin-top: 30px;
}

.file-guide-item {
	display: inline-flex;
	align-items: center;
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 8px;
	padding: 2px 8px;
	font-size: 12px;
	color: #495057;
}

.file-guide-item.extensions {
	background: #fef6fb;
	border-color: #fbcfe8;
	color: #be185d;
}

.file-guide-item.count {
	background: #f0f9ff;
	border-color: #bae6fd;
	color: #0369a1;
}

.file-guide-item.size {
	background: #f0fdf4;
	border-color: #bbf7d0;
	color: #15803d;
}

.file-download:empty::after {
	content: "";
	display: inline-block;
	width: 85px; 
	height: 32px;
	visibility: hidden;
}

/* 읽기 전용 모드 스타일 */
.file-uploader-component.read-only-uploader .upload-area {
    cursor: default;
    border: none;
    padding: 0;
}

.file-uploader-component.read-only-uploader .progress-elements{
	display: none;
}

.file-uploader-component.read-only-uploader .file-list .file-item:first-child{
	margin-top: 0;
}

.upload-area i[class^="bi bi-"]:not(.bi-download), .upload-area i[class^="fa-"] {
    font-size: 18px;
    vertical-align: middle;
}
.icon-hwp {
    width: 17px;
    height: 17px;
    display: inline-block;
    vertical-align: middle;
    background: url('../images/icon_hwp.png') no-repeat center/contain;
    position: relative;
    top: 2px;
}

/* 중간 크기 화면 (태블릿) */
@media screen and (max-width: 992px) {
    .upload-area {
        padding: 20px 24px;
    }
    /* 읽기 전용 모드 특화 */
    .file-uploader-component.read-only-uploader .file-download .btn {
        padding: 4px 8px;
        font-size: 13px;
    }
}

/* 작은 화면 (태블릿, 모바일) */
@media (max-width: 768px) {
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 0;
    }
    .file-meta {
        width: calc(100% - 32px);
        flex-wrap: wrap;
        row-gap: 8px;
        margin-top: 8px;
    }
    .file-name {
        max-width: calc(100% - 100px);
    }
    .file-uploader-component.read-only-uploader .file-upload-date {
        font-size: 12px;
    }
    .file-uploader-component.read-only-uploader .file-download {
        margin-left: auto;
    }
    .file-uploader-component:not(.read-only-uploader) .progress-elements {
        order: -1;
        width: 100%;
        margin-bottom: 6px;
        flex-wrap: nowrap;
        gap: 6px;
    }
    .file-guide {
        flex-direction: column;
        gap: 4px;
    }
    .file-guide-item {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .file-item:not(:last-child){
    	margin-bottom: 0;
    }
}

/* 매우 작은 화면 (모바일) */
@media screen and (max-width: 576px) {
    .upload-area {
        padding: 16px;
    }
    .file-info {
        flex-wrap: wrap;
        gap: 4px;
    }
    .file-name {
        width: 100%;
        max-width: 100%;
        margin-right: 0;
    }
    .file-upload-date {
        margin-left: 24px;
    }
    .file-uploader-component.read-only-uploader .file-meta {
        justify-content: space-between;
    }
    .file-uploader-component.read-only-uploader .file-size {
        width: auto;
    }
    .file-uploader-component.read-only-uploader .file-download .btn {
        padding: 3px 6px;
        font-size: 12px;
    }

    /* 업로드(삭제가능) 모드 프로그레스바 한줄 & 인라인 유지 */
    .file-uploader-component:not(.read-only-uploader) .progress-elements {
        width: 100%;
        gap: 3px;
        flex-wrap: nowrap;
    }
}

/* 초소형 화면에서 다운로드 버튼 내 아이콘 중앙 정렬 수정, 한줄 유지, 가로스크롤X */
@media screen and (max-width: 430px) {
    .file-uploader-component.read-only-uploader .file-download .download-btn span {
        display: none;
    }
    .file-uploader-component.read-only-uploader .file-download .download-btn {
        width: 32px;
        height: 32px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }
    .file-uploader-component.read-only-uploader .file-download .download-btn i {
        margin: 0 !important;
        padding: 0;
        position: static;
        transform: none;
        line-height: 1;
    }
    .file-uploader-component.read-only-uploader .file-download .download-btn::after,
    .file-uploader-component.read-only-uploader .file-download .download-btn::before {
        display: none;
    }

    /* 업로드(삭제가능) 모드 프로그레스바 한줄 & 인라인 유지 */
    .file-uploader-component:not(.read-only-uploader) .progress-elements {
        width: 100%;
        gap: 2px;
        flex-wrap: nowrap;
    }
}

/* 최소 360px에서도 스크롤 없이 한줄 유지 */
@media screen and (max-width: 380px) {
    .file-uploader-component:not(.read-only-uploader) .progress-elements {
        gap: 1px;
        width: 100%;
        flex-wrap: nowrap;
    }
}
@media screen and (max-width: 360px) {
    .file-uploader-component:not(.read-only-uploader) .progress-elements {
        gap: 0;
        width: 100%;
        flex-wrap: nowrap;
    }
}
