/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

/* 通用flex布局类 */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

/* 文本省略 */
.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-ellipsis-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

/* 最小触摸区域 */
.touch-target {
    min-width: 44px;
    min-height: 44px;
}

/* Vue v-cloak 指令样式 - 防止模板闪烁 */
[v-cloak] {
    display: none !important;
}

#app {
    height: 100vh;
    width: 100vw;
    position: relative;
    transition: transform 0.3s ease;
    will-change: transform; /* 优化变换性能 */
}

/* 主容器 */
.chat-container {
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* 界面切换动画 */
.chat-section, .contact-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease-in-out;
    background-color: #fff;
}

.chat-section.slide-left {
    transform: translateX(-100%);
}

.contact-section {
    transform: translateX(100%);
}

.contact-section.slide-in {
    transform: translateX(0);
}

/* 通用头部样式 */
.chat-header, .contact-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    background-color: #fff;
    border-bottom: 1px solid #e4e7ed;
    position: relative;
    z-index: 10;
}

.header-left, .header-right {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
}

/* 切换按钮样式 */
.switch-btn, .back-btn {
    color: #409eff !important;
    font-size: 14px;
    padding: 8px 12px;
}

.switch-btn:hover, .back-btn:hover {
    background-color: #ecf5ff;
}

/* 联系人名称显示 */
.contact-name {
    font-size: 18px;
    font-weight: 500;
    color: #303133;
}

/* 更多操作按钮 */
.el-dropdown {
    color: #606266;
}

/* 搜索输入框 */
.search-input {
    max-width: 200px;
}

.search-input .el-input__inner {
    border-radius: 20px;
    background-color: #f5f7fa;
    border: none;
    height: 32px;
    font-size: 14px;
}



/* 响应式设计 */
@media (max-width: 480px) {
    .header-center .contact-name {
        font-size: 14px;
    }
    
    .search-input {
        max-width: 150px;
    }
}

/* ElementUI组件样式覆盖 */
.el-button--text {
    padding: 8px 5px;
}

.el-avatar {
    border: 1px solid #e4e7ed;
    background-color: #409eff;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.el-avatar img{
    width: 100%;
}

/* 新的头像容器样式 */
.avatar-container {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e4e7ed;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background-color: #409eff;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* 顶部头像样式 */
.header-avatar {
    width: 40px;
    height: 40px;
}
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 50%;
}
.el-badge__content {
    background-color: #f56c6c;
    border: none;
    font-size: 12px;

    padding: 0 6px;
}

/* 加载状态 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* 错误提示 */
.error-message {
    color: #f56c6c;
    font-size: 12px;
    margin-top: 4px;
}

/* 成功提示 */
.success-message {
    color: #67c23a;
    font-size: 12px;
    margin-top: 4px;
}

/* 历史消息加载指示器 */
.history-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    margin: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: fadeInDown 0.3s ease-out;
}

.loading-spinner {
    display: flex;
    gap: 4px;
    margin-right: 10px;
}

.spinner-dot {
    width: 8px;
    height: 8px;
    background-color: #409eff;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.spinner-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.spinner-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-text {
    color: #606266;
    font-size: 14px;
    font-weight: 500;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}