/**
 * PC端图片即时上传样式
 */

/* 横向布局容器 */
.image-upload-inline {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    flex-wrap: wrap;
}

/* 上传按钮 */
.upload-btn-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-btn-inline:hover {
    border-color: #1890ff;
    background: #e6f7ff;
}

.upload-btn-inline i {
    font-size: 24px;
    color: #1890ff;
    margin-bottom: 8px;
}

.upload-btn-inline span {
    font-size: 12px;
    color: #666;
}

.hidden-input {
    display: none;
}

/* 图片预览容器 */
#image-previews {
    display: none; /* 默认隐藏，有图片时显示 */
    gap: 5px; /* 图片间距5px */
    flex-wrap: wrap;
}

#image-previews.has-images {
    display: flex; /* 有图片时显示为flex横向布局 */
}

/* 图片项 */
.image-item {
    position: relative;
    width: 100px; /* 固定宽度100px */
    height: 100px; /* 固定高度100px */
    flex-shrink: 0; /* 不缩小 */
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
}

.image-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* 上传中状态 */
.image-item.uploading {
    cursor: wait;
    background: white;
    border: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 旋转加载动画 */
.upload-spinner {
    font-size: 32px;
    color: #1890ff;
}

.upload-spinner i {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 删除上传进度文本 */
.upload-progress,
.progress-text {
    display: none;
}

/* 图片占位符 */
.image-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 15px;
    color: #999;
}

.image-placeholder i {
    font-size: 36px;
    margin-bottom: 10px;
}

.file-name {
    font-size: 11px;
    text-align: center;
    word-break: break-all;
    line-height: 1.4;
}

/* 预览图片 */
.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-item:hover img {
    transform: scale(1.05);
}

/* 图片操作按钮 */
.image-actions {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    gap: 5px;
    z-index: 20;
    opacity: 1; /* 始终可见 */
}

.image-actions button {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* 兼容编辑页原有的删除按钮（span.remove-image），统一成圆形红色按钮样式 */
.image-item .remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ff4d4f;
    color: #fff;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.image-item .remove-image:hover {
    background: #ff7875;
}

.btn-remove {
    background: #ff4d4f; /* 红色删除按钮 */
    color: white;
}

.btn-remove:hover {
    background: #ff7875;
    transform: scale(1.1);
}

.btn-preview {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: none; /* 默认隐藏预览按钮，如有需要可开启 */
}

.image-actions button:active {
    transform: scale(0.95);
}

/* 图片信息（隐藏） */
.image-info {
    display: none; /* 完全隐藏文件大小信息 */
}

/* 错误状态 */
.image-item.error {
    background: #ffebee;
    border: 2px solid #ef5350;
    cursor: default;
}

.image-item.error:hover {
    transform: none;
}

.upload-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 15px;
    text-align: center;
    color: #c62828;
}

.upload-error i {
    font-size: 36px;
    margin-bottom: 10px;
}

.error-message {
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.btn-close {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(198, 40, 40, 0.1);
    color: #c62828;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close:hover {
    background: rgba(198, 40, 40, 0.2);
}

/* 图片预览遮罩层 */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.preview-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.preview-container img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.btn-close-preview {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    border: 2px solid white;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.btn-close-preview:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* 图片上传提示文案 */
.image-hint {
    font-size: 13px;
    color: #999;
    line-height: 1.6;
    margin-top: 8px;
}

/* 提示中的数字高亮（橙色） */
.image-hint .highlight-number {
    color: #ff9800;
    font-weight: 600;
}

/* 警告文字 */
.image-hint .warning {
    color: #ff5722;
    font-size: 12px;
}
