/**
 * 云信IM - 文件消息样式
 * 遵循微信设计最佳实践
 */

/* 文件消息容器 */
.yunxin-message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 4px;
    max-width: 320px;
    min-width: 260px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s;
}

.yunxin-message-file:hover {
    background: #F7F7F7;
}

/* 发送的文件消息（绿色背景） */
.yunxin-message-sent .yunxin-message-file {
    background: #95EC69;
    border-color: #95EC69;
}

.yunxin-message-sent .yunxin-message-file:hover {
    background: #8BE05E;
}

/* 文件图标 */
.yunxin-message-file-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 30px;
}

/* 文件信息 */
.yunxin-message-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 文件名 */
.yunxin-message-file-name {
    font-size: 14px;
    font-weight: 500;
    color: #000000;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yunxin-message-sent .yunxin-message-file-name {
    color: #000000;
}

/* 文件大小 */
.yunxin-message-file-size {
    font-size: 12px;
    color: #999999;
}

.yunxin-message-sent .yunxin-message-file-size {
    color: rgba(0, 0, 0, 0.6);
}

/* 下载状态区域 */
.yunxin-message-file-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

/* 下载按钮/图标 */
.yunxin-message-file-download {
    width: 32px;
    height: 32px;
    border: none;
    background: #07C160;
    color: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.yunxin-message-file-download:hover {
    background: #06AD56;
    transform: scale(1.1);
}

.yunxin-message-sent .yunxin-message-file-download {
    background: rgba(0, 0, 0, 0.2);
}

.yunxin-message-sent .yunxin-message-file-download:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 已下载标识 */
.yunxin-message-file-downloaded {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: #07C160;
}

.yunxin-message-file-downloaded-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.yunxin-message-sent .yunxin-message-file-downloaded {
    color: rgba(0, 0, 0, 0.6);
}

/* 下载进度 */
.yunxin-message-file-progress {
    position: relative;
    width: 32px;
    height: 32px;
}

.yunxin-message-file-progress-circle {
    transform: rotate(-90deg);
}

.yunxin-message-file-progress-bg {
    fill: none;
    stroke: #E5E5E5;
    stroke-width: 3;
}

.yunxin-message-file-progress-bar {
    fill: none;
    stroke: #07C160;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s;
}

.yunxin-message-file-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: #666666;
}

/* 下载失败 */
.yunxin-message-file-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #FA5151;
    font-size: 11px;
}

.yunxin-message-file-error-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

/* 文件类型颜色 */
.yunxin-file-icon-doc { background-color: #2B579A; }
.yunxin-file-icon-xls { background-color: #217346; }
.yunxin-file-icon-ppt { background-color: #D24726; }
.yunxin-file-icon-pdf { background-color: #F40F02; }
.yunxin-file-icon-txt { background-color: #666666; }
.yunxin-file-icon-zip { background-color: #FFA500; }
.yunxin-file-icon-img { background-color: #4CAF50; }
.yunxin-file-icon-video { background-color: #E91E63; }
.yunxin-file-icon-audio { background-color: #9C27B0; }
.yunxin-file-icon-default { background-color: #999999; }

/* 移动端适配 */
@media (max-width: 768px) {
    .yunxin-message-file {
        max-width: 280px;
        min-width: 220px;
        padding: 10px;
    }

    .yunxin-message-file-icon {
        width: 50px;
        height: 50px;
        font-size: 25px;
    }

    .yunxin-message-file-name {
        font-size: 13px;
    }

    .yunxin-message-file-size {
        font-size: 11px;
    }
}

