/* 聊天相关样式 */

/* 未读消息徽章 */
.unread-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff5252;
    color: white;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

.unread-badge.pulse {
    animation: pulse 2s infinite;
}

.unread-badge.fade-out {
    opacity: 0;
    transform: scale(0);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* 新消息高亮 */
.friend-item.new-message {
    animation: highlight 3s ease;
}

@keyframes highlight {
    0% {
        background: rgba(76, 175, 80, 0.5);
    }
    100% {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* 状态变更动画 */
.friend-item.status-change .friend-status {
    animation: status-pulse 2s ease;
}

@keyframes status-pulse {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 0.8;
        transform: scale(1);
    }
}

/* 自己标识 */
.self-indicator {
    color: #4CAF50;
    font-size: 12px;
    margin-left: 5px;
}

/* 聊天窗口 */
.chat-window {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    padding: 8px;
    cursor: pointer;
    margin-right: 10px;
}

.chat-title {
    flex: 1;
    font-size: 18px;
    color: white;
    font-weight: 500;
}

.chat-status {
    font-size: 13px;
    padding: 3px 8px;
    border-radius: 12px;
}

.chat-status.online {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.chat-status.offline {
    background: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.chat-message {
    margin-bottom: 15px;
    max-width: 80%;
    transition: all 0.3s ease;
}

.chat-message.incoming {
    align-self: flex-start;
}

.chat-message.outgoing {
    align-self: flex-end;
}

.message-content {
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
}

.incoming .message-content {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-bottom-left-radius: 4px;
}

.outgoing .message-content {
    background: #4CAF50;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-text {
    margin-bottom: 5px;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

.chat-input-container {
    display: flex;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    outline: none;
}

.send-btn, .attach-btn {
    background: none;
    border: none;
    color: #4CAF50;
    font-size: 20px;
    margin-left: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.send-btn:hover, .attach-btn:hover {
    background: rgba(76, 175, 80, 0.1);
}

/* 文件消息 */
.file-message {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4CAF50;
    font-size: 20px;
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    color: white;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.file-download {
    width: 36px;
    height: 36px;
    background: rgba(76, 175, 80, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4CAF50;
    text-decoration: none;
    transition: all 0.3s ease;
}

.file-download:hover {
    background: rgba(76, 175, 80, 0.3);
    transform: scale(1.1);
}

/* 文件传输进度条 */
.file-transfer-progress {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.transfer-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.file-name {
    color: white;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.file-size {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress {
    height: 100%;
    background: #4CAF50;
    width: 0;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-align: right;
}

.file-transfer-progress.complete {
    background: rgba(76, 175, 80, 0.2);
}

.file-transfer-progress.complete .progress {
    background: #4CAF50;
}

/* 输入状态指示器 */
.typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 1px;
    background-color: #9E9E9E;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.typing-indicator span:nth-of-type(1) {
    animation: typing 1s infinite;
}

.typing-indicator span:nth-of-type(2) {
    animation: typing 1s 0.33s infinite;
}

.typing-indicator span:nth-of-type(3) {
    animation: typing 1s 0.66s infinite;
}

@keyframes typing {
    0% {
        transform: translateY(0px);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-5px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0px);
        opacity: 0.4;
    }
}
