/* 聊天页面专用样式 */

/* 聊天容器 */
.chat-container {
    display: flex;
    height: calc(100vh - 200px);
    background-color: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

/* 左侧联系人侧边栏 */
.contacts-sidebar {
    width: 350px;
    background-color: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #f0f2f5;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h2 {
    font-size: 24px;
    color: #075e54;
    font-weight: 700;
}

.btn-new-chat {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #25d366;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-new-chat:hover {
    background-color: #1da851;
}

.search-box {
    padding: 15px 20px;
    background-color: #f0f2f5;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    background-color: white;
}

.search-box input:focus {
    outline: none;
    border-color: #25d366;
}

/* 联系人列表 */
.contacts-list {
    flex: 1;
    overflow-y: auto;
}

.contact {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.contact:hover {
    background-color: #f5f5f5;
}

.contact.active {
    background-color: #e8f5e9;
}

.contact-avatar {
    position: relative;
    margin-right: 15px;
}

.contact-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.contact-avatar.group {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #075e54;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.online-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ddd;
    border: 2px solid white;
}

.online-status.online {
    background-color: #25d366;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.contact-info p {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-meta {
    text-align: right;
}

.contact-meta .time {
    font-size: 12px;
    color: #999;
    display: block;
    margin-bottom: 5px;
}

.contact-meta .unread {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: #25d366;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    text-align: center;
    line-height: 20px;
}

/* 右侧聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f0f2f5;
    border-bottom: 1px solid #e0e0e0;
}

.chat-partner {
    display: flex;
    align-items: center;
}

.partner-avatar {
    position: relative;
    margin-right: 15px;
}

.partner-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.partner-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.partner-info p {
    font-size: 14px;
    color: #25d366;
}

.chat-actions {
    display: flex;
    gap: 15px;
}

.btn-action {
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.btn-action:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* 消息容器 */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #efeae2;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.05"><path d="M0,0 L100,0 L100,100 L0,100 Z" fill="%23075e54"/></svg>');
}

.message-date {
    text-align: center;
    margin: 20px 0;
}

.message-date span {
    display: inline-block;
    padding: 5px 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    font-size: 12px;
    color: #666;
}

.message {
    display: flex;
    margin-bottom: 15px;
}

.message.received {
    justify-content: flex-start;
}

.message.sent {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.received .message-content {
    background-color: white;
    border-top-left-radius: 5px;
}

.message.sent .message-content {
    background-color: #dcf8c6;
    border-top-right-radius: 5px;
}

.message-content p {
    margin: 0 0 5px 0;
    font-size: 14px;
    line-height: 1.4;
}

.message-content img {
    max-width: 200px;
    border-radius: 10px;
    margin-bottom: 5px;
}

.message-time {
    font-size: 11px;
    color: #999;
    text-align: right;
    display: block;
}

/* 消息输入区域 */
.message-input {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background-color: #f0f2f5;
    border-top: 1px solid #e0e0e0;
}

.input-actions {
    display: flex;
    gap: 10px;
    margin-right: 15px;
}

.btn-input-action {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.btn-input-action:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.message-text {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    background-color: white;
}

.message-text:focus {
    outline: none;
    border-color: #25d366;
}

.btn-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #25d366;
    color: white;
    border: none;
    margin-left: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background-color 0.3s ease;
}

.btn-send:hover {
    background-color: #1da851;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .chat-container {
        flex-direction: column;
        height: auto;
    }
    
    .contacts-sidebar {
        width: 100%;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .chat-area {
        height: 500px;
    }
}

@media (max-width: 768px) {
    .contacts-sidebar {
        height: 250px;
    }
    
    .chat-area {
        height: 400px;
    }
    
    .contact {
        padding: 10px 15px;
    }
    
    .contact-avatar img {
        width: 40px;
        height: 40px;
    }
    
    .contact-avatar.group {
        width: 40px;
        height: 40px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .chat-container {
        margin: 10px 0;
    }
    
    .contacts-sidebar {
        height: 200px;
    }
    
    .chat-area {
        height: 350px;
    }
    
    .contact-info h3 {
        font-size: 14px;
    }
    
    .contact-info p {
        font-size: 12px;
    }
    
    .message-content p {
        font-size: 13px;
    }
    
    .message-input {
        padding: 10px 15px;
    }
    
    .message-text {
        padding: 8px 15px;
    }
}