/* 聊天系统自定义样式 */

/* 聊天容器 */
.chat-container {
    height: calc(100vh - 3.25rem);
}

.chat-sidebar {
    border-right: 1px solid #dbdbdb;
    height: 100%;
    overflow-y: auto;
    background-color: #fafafa;
}

.chat-main {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f5f5f5;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.15) 1px, transparent 0);
    background-size: 20px 20px;
}

.message-item {
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease-in;
}

.message-item.own {
    text-align: right;
}

.message-bubble {
    display: inline-block;
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-bubble.own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-bubble.other {
    background-color: white;
    border: 1px solid #e1e1e1;
    color: #363636;
}

/* 输入区域 */
.chat-input {
    border-top: 1px solid #dbdbdb;
    padding: 1rem;
    background-color: white;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

/* 用户头像 */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* 在线状态指示器 */
.online-indicator {
    width: 10px;
    height: 10px;
    background-color: #48c774;
    border-radius: 50%;
    display: inline-block;
    margin-left: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(72, 199, 116, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(72, 199, 116, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(72, 199, 116, 0);
    }
}

/* 设备信息 */
.device-info {
    font-size: 0.75rem;
    color: #7a7a7a;
}

/* 聊天室列表项 */
.chat-room-item {
    border-radius: 8px;
    margin: 0.25rem;
    transition: all 0.2s ease;
}

.chat-room-item:hover {
    background-color: #f0f0f0;
    transform: translateX(4px);
}

.chat-room-item.active {
    background-color: #3273dc;
    color: white;
}

/* 用户列表项 */
.user-item {
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.user-item:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 文件预览 */
.file-preview {
    max-width: 200px;
    border-radius: 8px;
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* 消息状态 */
.message-status {
    font-size: 0.7rem;
    color: #999;
    margin-top: 0.25rem;
}

.message-status.read {
    color: #48c774;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .chat-sidebar {
        display: none;
    }
    
    .chat-sidebar.is-active {
        display: block;
        position: fixed;
        top: 3.25rem;
        left: 0;
        width: 100%;
        height: calc(100vh - 3.25rem);
        z-index: 1000;
        background-color: white;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .chat-input {
        padding: 0.75rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar,
.chat-sidebar::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 通知样式 */
.notification.is-fixed {
    position: fixed;
    top: 4rem;
    right: 1rem;
    z-index: 1000;
    min-width: 300px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* 加载状态 */
.is-loading {
    position: relative;
    pointer-events: none;
}

.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #dbdbdb;
    border-top-color: #3273dc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 标签样式增强 */
.tag.is-online {
    background-color: #48c774;
    color: white;
}

.tag.is-offline {
    background-color: #dbdbdb;
    color: #4a4a4a;
}

/* 按钮悬停效果 */
.button {
    transition: all 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 表单增强 */
.input:focus,
.textarea:focus {
    box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25);
    border-color: #3273dc;
}

/* 模态框增强 */
.modal {
    animation: fadeIn 0.3s ease;
}

.modal-card {
    animation: slideIn 0.3s ease;
}