/* sidebar.css */
/* 侧边栏样式 */
.sidebar-header {
    padding: 1.5rem;
    /*border-bottom: 1px solid #e2e8f0;*/
    background: white;
}

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

/* 头像容器 */
.avatar-container {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

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

/* 中间文本 - 完全居中 */
.header-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 1rem;
}

.header-text .font-bold {
    color: #000000;
    font-size: 1.125rem;
    line-height: 1.2;
    margin-bottom: 2px;
    text-align: center;
    width: 100%;
}

.header-text .text-xs {
    color: #6b7280;
    font-size: 0.75rem;
    text-align: center;
    width: 100%;
}

/* 右侧按钮 - 修复颜色问题 */
.header-btn {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280; /* 改为灰色，与设计一致 */
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.header-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* 移动端侧边栏关闭按钮 */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    z-index: 1002;
}

.sidebar-close-btn:hover {
    background-color: #f3f4f6;
}

.conversation-items {
    padding: 0;
    height: calc(100vh - 180px);
    overflow-y: auto;
    position: relative;
    background: white;
}

.conversation-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
    background: white;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversation-item:hover {
    background-color: #f9fafb;
}

.conversation-item.active {
    background-color: #f9fafb;
    border-left: 3px solid #3b82f6;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-title {
    font-weight: 500;
    margin-bottom: 4px;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-summary {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 11px;
    color: #9ca3af;
}

/* 操作按钮 */
.conversation-actions {
    position: relative;
    opacity: 0;
    transition: opacity 0.2s;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.action-btn.active {
    background-color: #f3f4f6;
    color: #374151;
}

/* 操作菜单 */
.action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 100;
    min-width: 80px; /* 增加最小宽度确保文本不换行 */
    padding: 4px 0;
}

.menu-item:hover {
    background-color: #f3f4f6;
}

.menu-item.delete-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 8px;
    white-space: nowrap; /* 防止文本换行 */
    text-align: left; /* 确保文本左对齐 */
}

.menu-item.delete-item:hover {
    background-color: #fef2f2;
    color: #1f2937;
}

.menu-item.share-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 8px;
    white-space: nowrap; /* 防止文本换行 */
    text-align: left; /* 确保文本左对齐 */
}

.menu-item.share-item:hover {
    background-color: #dbeafe; /* 浅蓝色背景表示分享操作 */
    color: #1d4ed8; /* 深蓝色文字 */
}

.mobile-action-menu .menu-item.share-item:hover {
    background-color: #dbeafe;
    color: #1d4ed8;
}

/* 确保菜单项内的图标和文字水平排列 */
.menu-item svg {
    flex-shrink: 0; /* 防止图标被压缩 */
    width: 16px;
    height: 16px;
}

/* 移除原来的底部固定定位样式 */
.mobile-action-menu {
    position: absolute;
    top: 80%;
    right: 1px; /* 距离右侧的间距 */
    transform: translateY(-50%);
    background: #f9fafb;
    /*border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);*/
    z-index: 100;
    min-width: 100px;
    /*padding: 4px 0;*/
}

/* 移动端菜单项样式 */
.mobile-action-menu .menu-item {
    padding: 8px 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    text-align: left;
    width: 100%;
    background: transparent;
    border: none;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mobile-action-menu .menu-item:last-child {
    border-bottom: none;
}

.mobile-action-menu .menu-item:hover {
    background-color: #f3f4f6;
}

.mobile-action-menu .menu-item.delete-item:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

/* 移除原来的移动端底部菜单样式 */
.mobile-action-menu .menu-header,
.mobile-action-menu .close-btn {
    display: none;
}

/* 长按提示 */
.conversation-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
    transition: background-color 0.3s;
}

.conversation-item.long-press::after {
    background: rgba(59, 130, 246, 0.1);
}

.loading-text, .empty-text {
    text-align: center;
    padding: 2rem 1rem;
    color: #9ca3af;
    font-size: 14px;
}

.loading-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: #6b7280;
    font-size: 13px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

.no-more-data {
    text-align: center;
    padding: 1rem;
    color: #9ca3af;
    font-size: 12px;
}

.sentinel-element {
    visibility: hidden;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.sidebar-footer button {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #374151;
    transition: all 0.2s;
}

.sidebar-footer button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* 修复PC端顶部栏新建对话按钮背景色 */
.header .header-btn {
    background: white;
    color: #6b7280;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header .header-btn:hover {
    background: #f3f4f6;
    color: #374151;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 移动端适配 */
@media (max-width: 767px) {
    .sidebar-header {
        padding: 1rem;
        padding-top: 3rem; /* 为关闭按钮留出空间 */
    }

    .sidebar-close-btn {
        display: block;
    }

    .avatar-container {
        width: 36px;
        height: 36px;
    }

    .header-btn {
        display: none;
    }

    .header-text .font-bold {
        font-size: 1rem;
    }

    .conversation-items {
        height: calc(100vh - 220px);
    }

    .conversation-header {
        padding: 0.75rem 1rem;
    }

    .conversation-item {
        padding: 0.75rem 1rem;
    }

    /* 移动端隐藏PC端操作按钮 */
    .conversation-actions {
        display: none;
    }
}