/* public/css/quote.css */

/* 파일 선택 버튼 옆, 파일이 선택되지 않았을 때 안내 문구 */
.file-guide-text {
    font-size: 14px;
    color: #888;
    margin-left: 10px;
}

/* 파일 미리보기가 표시될 전체 컨테이너 */
#file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    border: 1px dashed #ccc;
    border-radius: 8px;
    min-height: 120px;
    background-color: #f9f9f9;
    align-content: flex-start; /* 아이템이 위에서부터 채워지도록 */
}

/* 컨테이너 내부에 안내 문구가 있을 때 */
#file-preview-container.empty::before {
    content: "여기에 선택한 파일이 표시됩니다.";
    font-size: 14px;
    color: #aaa;
    width: 100%;
    text-align: center;
    align-self: center; /* 수직 중앙 정렬 */
}

/* 개별 파일 미리보기 아이템 */
.preview-item {
    position: relative;
    width: 150px;
    height: 150px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* 중앙 정렬로 변경 */
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 이미지 또는 비디오 미리보기 */
.preview-item img,
.preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 파일 아이콘 (이미지/영상이 아닐 경우) */
.file-icon {
    font-size: 50px;
    color: #a0a0a0;
}

/* 파일 정보 (이름) - 마우스 올렸을 때 나타남 */
.file-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 12px;
    padding: 5px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.preview-item:hover .file-info {
    opacity: 1;
}

/* 삭제 버튼 (X) */
.delete-button {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    line-height: 22px;
    transition: background-color 0.2s;
}

.delete-button:hover {
    background-color: rgba(255, 0, 0, 0.8);
}
/* --- 파일 업로드 버튼 공통 디자인 --- */

.file-upload-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.file-upload-controls .btn {
    flex: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 15px;
    background-color: #4A5568;
    color: #FFFFFF;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    text-align: center;
}

.file-upload-controls .btn:hover {
    background-color: #2D3748;
}

.file-upload-controls.invalid .btn {
    border-color: #E53E3E;
}

.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}


/* --- 파일 미리보기 스타일 --- */
.file-preview-container {
    margin-top: 15px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.file-preview-container.empty {
    display: none;
}

.preview-item {
    position: relative;
    border-radius: 5px;
    overflow: hidden;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
}

.preview-item img, 
.preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .file-icon {
    font-size: 2.5rem;
    color: #4A5568;
}

.preview-item .file-info {
    box-sizing: border-box;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.75rem;
    padding: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-item .delete-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    padding: 0;
}

.error-message {
    color: #E53E3E;
    font-size: 0.8rem;
    margin-top: 5px;
}
/* ✅ 추가할 CSS 코드 (style 태그 안에 추가하세요) */

/* --- 파일 업로드 버튼 및 미리보기 디자인 --- */
.file-upload-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.upload-btn {
    flex: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background-color: #bec7d6;
    color: #FFFFFF;
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
}
.upload-btn:hover {
    background-color: #8897b1;
}
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
}
#file-preview-container {
    margin-top: 15px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-md);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}
#file-preview-container.empty { display: none; }
.preview-item {
    position: relative;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
}
.preview-item img, .preview-item video { width: 100%; height: 100%; object-fit: cover; }
.preview-item .file-icon { font-size: 2.5rem; color: #4A5568; }
.preview-item .file-info {
    box-sizing: border-box; position: absolute; bottom: 0; left: 0; width: 100%;
    background: rgba(0, 0, 0, 0.6); color: white; font-size: 0.75rem; padding: 4px;
    text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-item .delete-button {
    position: absolute; top: 5px; right: 5px; background-color: rgba(0, 0, 0, 0.7);
    color: white; border: none; border-radius: 50%; width: 20px; height: 20px;
    line-height: 20px; text-align: center; cursor: pointer; font-size: 1rem;
    font-weight: bold; padding: 0; display: flex; align-items: center; justify-content: center;
}


/* --- 파일 업로드 버튼 및 미리보기 공통 디자인 --- */

/* 버튼들을 감싸는 영역 */
.file-upload-controls {
    display: flex; /* 버튼을 가로로 나란히 배치 */
    gap: 10px;     /* 버튼 사이 간격 */
    margin-top: 10px;
}

/* '파일 찾기', '카메라 촬영' 버튼 공통 스타일 */
.upload-btn {
    flex: 1; /* 버튼이 동일한 너비를 갖도록 설정 (겹침 문제 해결) */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px; /* 아이콘과 텍스트 사이 간격 */
    padding: 12px 15px;
    background-color: #4A5568; /* 어두운 회색 */
    color: #FFFFFF;
    border: 1px solid transparent;
    border-radius: var(--border-radius-md, 8px); /* common.css 변수가 있으면 사용 */
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
}

.upload-btn:hover {
    background-color: #2D3748; /* 더 어두운 회색 */
}

/* 유효성 검사 실패 시 테두리 강조 */
.file-upload-controls.invalid .upload-btn {
    border-color: var(--color-danger, #dc3545) !important;
}

/* 실제 파일 업로드 input을 시각적으로만 숨김 */
.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* 파일 미리보기 전체 컨테이너 */
#file-preview-container {
    margin-top: 15px;
    padding: 1rem;
    border: 1px dashed #ccc;
    border-radius: var(--border-radius-md, 8px);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    min-height: 120px;
    background-color: #f9f9f9;
    align-content: flex-start;
}

/* 파일 없을 때 안내 문구 (JS로 제어됨) */
#file-preview-container.empty {
    padding-top: 50px;
    padding-bottom: 50px;
    display: grid;
    place-items: center;
}

/* 개별 파일 미리보기 아이템 */
.preview-item {
    position: relative;
    border-radius: var(--border-radius-sm, 4px);
    overflow: hidden;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.preview-item img, 
.preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .file-icon {
    font-size: 2.5rem;
    color: #4A5568;
}

.preview-item .file-info {
    box-sizing: border-box;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.75rem;
    padding: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-item .delete-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.delete-button:hover {
    background-color: rgba(220, 53, 69, 0.9);
}

/* 모델별 사용환경 체크리스트 유효성 검사 실패 시 테두리 */
.model-checklist.invalid {
    border: 1px solid var(--color-danger, #dc3545);
}
/* '파일 찾기' 버튼(label)의 글자색을 흰색으로 명확히 지정 */
label.upload-btn {
    color: #FFFFFF;
}
