/**
 * 云信IM - 输入区域媒体预览样式
 * 微信PC版风格：在输入框上方显示待发送内容
 */

/* 预览容器 */
.yunxin-input-media-preview {
    display: none;
    padding: 12px;
    background: #F7F7F7;
    border-bottom: 1px solid #E5E5E5;
    max-height: 300px;
    overflow-y: auto;
}

.yunxin-input-media-preview.active {
    display: block;
}

/* 图片预览区域 */
.yunxin-preview-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.yunxin-preview-images:last-child {
    margin-bottom: 0;
}

/* 单个图片项 */
.yunxin-preview-image-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    cursor: pointer;
    transition: all 0.2s;
}

.yunxin-preview-image-item:hover {
    border-color: #07C160;
    transform: scale(1.05);
}

.yunxin-preview-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 图片删除按钮 */
.yunxin-preview-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0;
}

.yunxin-preview-image-item:hover .yunxin-preview-image-remove {
    opacity: 1;
}

.yunxin-preview-image-remove:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* 文件预览区域 */
.yunxin-preview-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 单个文件项 */
.yunxin-preview-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 4px;
    max-width: 200px;
    transition: all 0.2s;
}

.yunxin-preview-file-item:hover {
    border-color: #07C160;
    background: #F0FFF4;
}

/* 文件图标 */
.yunxin-preview-file-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yunxin-preview-file-icon svg {
    width: 24px;
    height: 24px;
}

/* 文件信息 */
.yunxin-preview-file-info {
    flex: 1;
    min-width: 0;
}

.yunxin-preview-file-name {
    font-size: 13px;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.yunxin-preview-file-size {
    font-size: 11px;
    color: #999999;
    margin-top: 2px;
}

/* 文件删除按钮 */
.yunxin-preview-file-remove {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background: none;
    border: none;
    color: #999999;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    padding: 0;
}

.yunxin-preview-file-remove:hover {
    background: #F5F5F5;
    color: #333333;
}

/* 滚动条美化 */
.yunxin-input-media-preview::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.yunxin-input-media-preview::-webkit-scrollbar-thumb {
    background: #CCCCCC;
    border-radius: 3px;
}

.yunxin-input-media-preview::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

.yunxin-input-media-preview::-webkit-scrollbar-track {
    background: transparent;
}

/* 空状态提示（可选） */
.yunxin-preview-empty {
    text-align: center;
    padding: 20px;
    color: #999999;
    font-size: 13px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .yunxin-input-media-preview {
        padding: 10px;
        max-height: 200px;
    }

    .yunxin-preview-image-item {
        width: 70px;
        height: 70px;
    }

    .yunxin-preview-file-item {
        max-width: 150px;
        padding: 6px 10px;
    }

    .yunxin-preview-file-name {
        font-size: 12px;
    }

    .yunxin-preview-file-size {
        font-size: 10px;
    }
}

/* 加载状态 */
.yunxin-preview-image-item.loading {
    background: #F5F5F5;
}

.yunxin-preview-image-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #E5E5E5;
    border-top-color: #07C160;
    border-radius: 50%;
    animation: yunxin-preview-spin 0.6s linear infinite;
}

@keyframes yunxin-preview-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

