/**
 * 私聊插件样式
 * 
 * 点击头像弹出菜单发起私聊
 */

/* 头像可点击样式 */
.msg .head {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.msg .head:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 头像点击菜单 */
.pc-avatar-menu {
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: all 0.15s ease;
}

.pc-avatar-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.pc-avatar-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    border-radius: 8px;
}

.pc-avatar-menu-item:hover {
    background: #f5f5f5;
}

.pc-avatar-menu-item:active {
    background: #e8e8e8;
}

/* 私聊面板 */
.private-chat-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: #f5f5f5;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.private-chat-panel.active {
    right: 0;
}

/* 面板头部 */
.pc-header {
    background: #07c160;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.pc-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.pc-header-actions {
    display: flex;
    gap: 10px;
}

.pc-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.pc-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 标签页 */
.pc-tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.pc-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    position: relative;
    transition: color 0.2s;
}

.pc-tab.active {
    color: #07c160;
    font-weight: 500;
}

.pc-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: #07c160;
    border-radius: 2px;
}

.pc-tab .tab-badge {
    background: #ff4757;
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
}

/* 内容区域 */
.pc-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pc-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.pc-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* 用户列表 */
.pc-user-list {
    padding: 10px;
}

.pc-user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pc-user-item:hover {
    background: #f0f0f0;
    transform: translateX(4px);
}

.pc-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.pc-user-info {
    flex: 1;
    min-width: 0;
}

.pc-user-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-user-status {
    font-size: 12px;
    color: #07c160;
    margin-top: 2px;
}

.pc-user-action {
    background: #07c160;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.pc-user-action:hover {
    background: #06ad56;
}

/* 会话列表 */
.pc-conversation-list {
    padding: 10px;
}

.pc-conversation-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pc-conversation-item:hover {
    background: #f0f0f0;
}

.pc-conversation-item.has-unread {
    background: #fff8e6;
}

.pc-conv-avatar {
    position: relative;
    margin-right: 12px;
}

.pc-conv-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.pc-conv-unread {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4757;
    color: white;
    font-size: 11px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.pc-conv-info {
    flex: 1;
    min-width: 0;
}

.pc-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.pc-conv-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.pc-conv-time {
    font-size: 12px;
    color: #999;
}

.pc-conv-preview {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 聊天窗口 */
.pc-chat-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-chat-view.active {
    display: flex;
}

.pc-chat-header {
    background: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.pc-chat-back {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-right: 10px;
    padding: 4px 8px;
    color: #666;
}

.pc-chat-back:hover {
    color: #333;
}

.pc-chat-user {
    display: flex;
    align-items: center;
    flex: 1;
}

.pc-chat-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 10px;
}

.pc-chat-user-name {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

/* 消息列表 */
.pc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f5;
}

.pc-message {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
}

.pc-message.sent {
    flex-direction: row-reverse;
}

.pc-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pc-message.received .pc-message-avatar {
    margin-right: 10px;
}

.pc-message.sent .pc-message-avatar {
    margin-left: 10px;
}

.pc-message-content {
    max-width: 70%;
}

.pc-message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.pc-message.received .pc-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.pc-message.sent .pc-message-bubble {
    background: #07c160;
    color: white;
    border-bottom-right-radius: 4px;
}

.pc-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

.pc-message.sent .pc-message-time {
    text-align: right;
}

/* 输入区域 */
.pc-chat-input {
    background: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.pc-chat-input input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.pc-chat-input input:focus {
    border-color: #07c160;
}

.pc-chat-input button {
    background: #07c160;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.pc-chat-input button:hover {
    background: #06ad56;
}

.pc-chat-input button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 空状态 */
.pc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

.pc-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.pc-empty-text {
    font-size: 14px;
    text-align: center;
}

/* 加载状态 */
.pc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #999;
}

.pc-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e5e5;
    border-top-color: #07c160;
    border-radius: 50%;
    animation: pc-spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes pc-spin {
    to { transform: rotate(360deg); }
}

/* 遮罩层 */
.pc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1099;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.pc-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .private-chat-panel {
        width: 100vw;
        right: -100vw;
    }
    
    /* 确保消息水平排列 */
    .pc-message {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        margin-bottom: 12px;
    }
    
    .pc-message.sent {
        flex-direction: row-reverse !important;
    }
    
    .pc-message-avatar {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }
    
    .pc-message-content {
        max-width: 75%;
        display: block;
    }
    
    .pc-message-bubble {
        max-width: 100%;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .pc-message-time {
        font-size: 10px;
    }
    
    .pc-avatar-menu {
        min-width: 110px;
    }
    
    .pc-avatar-menu-item {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .pc-header {
        padding: 12px 16px;
    }
    
    .pc-chat-header {
        padding: 10px 12px;
    }
    
    .pc-chat-input {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .pc-chat-input input {
        padding: 8px 14px;
        font-size: 14px;
    }
    
    .pc-chat-input button {
        padding: 8px 16px;
        font-size: 13px;
    }
}
