/**
 * 会话列表样式 - Premium Design
 * 高级设计系统，灵感来自 Linear/Vercel 风格
 */

/* 全局字体平滑 */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 会话组 */
.session-group {
    margin-bottom: 0.375rem;
}

.session-group-title {
    padding: 0.5rem 1rem;
    font-size: 0.6875rem; /* 11px */
    font-weight: 700;
    color: rgba(156, 163, 175, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    user-select: none;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.session-group-items {
    display: flex;
    flex-direction: column;
    gap: 0.375rem; /* 6px间距 */
}

/* 会话项容器 - 高级浮起效果 */
.session-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    margin: 0 0.75rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 1.125rem; /* 18px 更圆润 */
    position: relative;
    background: transparent;
    border: 1px solid transparent;
    opacity: 0;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 优雅的滑入动画 */
@keyframes slideUp {
    0% { 
        opacity: 0; 
        transform: translateY(8px) scale(0.98); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* 悬停状态 - 轻微背景 */
.session-item:hover {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transform: translateY(-1px);
}

/* 激活状态 - 强浮起效果 */
.session-item.active {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03), 0 10px 25px rgba(0, 0, 0, 0.04);
    transform: scale(1.01);
    border-color: rgba(0, 0, 0, 0.05);
    z-index: 10;
}

/* 激活状态顶部高光 */
.session-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 1.125rem 1.125rem 0 0;
    pointer-events: none;
}

/* 置顶状态 */
.session-item.pinned {
    background: rgba(255, 255, 255, 0.3);
}

/* 头像区域 - iOS风格Squircle */
.session-avatar {
    width: 3.25rem; /* 52px */
    height: 3.25rem;
    border-radius: 22%; /* Squircle近似 */
    background: #f5f5f5;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.session-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.session-icon {
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 激活状态头像 */
.session-item.active .session-avatar {
    background: linear-gradient(135deg, #eff6ff, #e0e7ff);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.8), 0 2px 4px rgba(59, 130, 246, 0.1);
}

/* 内容区域 */
.session-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.125rem 0;
}

/* 头部：标题 + 时间 */
.session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.125rem;
}

.session-title {
    font-size: 0.9375rem; /* 15px */
    font-weight: 600;
    color: #171717;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
    letter-spacing: -0.01em; /* 紧密排版 */
    flex: 1;
}

.session-item:not(.active) .session-title {
    color: #262626;
    font-weight: 500;
}

.session-time {
    font-size: 0.6875rem; /* 11px */
    font-weight: 500;
    color: #a3a3a3;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* 底部：副标题 + 徽标 */
.session-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 1.125rem;
}

.session-subtitle {
    font-size: 0.8125rem; /* 13px */
    font-weight: 400;
    color: #737373;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
    flex: 1;
}

.session-item.active .session-subtitle {
    color: #525252;
}

/* 未读徽标 - 高级样式 */
.session-badge {
    background: #ef4444;
    color: white;
    font-size: 0.625rem; /* 10px */
    font-weight: 700;
    padding: 0 0.25rem;
    min-width: 1.125rem;
    height: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(239, 68, 68, 0.3), 0 0 0 2px #ffffff;
    flex-shrink: 0;
}

/* 置顶标签 - Pill风格 */
.session-pin-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    color: #a3a3a3;
    background: #f5f5f5;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
}

/* 操作按钮区域 - Glassmorphism */
.session-actions {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%) translateX(0.5rem);
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
    z-index: 20;
}

/* 背景遮罩（防止文字干扰） */
.session-actions::before {
    content: '';
    position: absolute;
    right: -0.75rem;
    top: -1rem;
    bottom: -1rem;
    width: 140%;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.95) 70%, transparent);
    border-radius: 0 1.125rem 1.125rem 0;
    pointer-events: none;
    z-index: -1;
}

.session-item:hover .session-actions {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

.action-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: rgba(245, 245, 245, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(229, 231, 235, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
    color: #737373;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.action-btn.pin-btn:hover {
    color: #2563eb;
    border-color: #93c5fd;
    background: #eff6ff;
}

.action-btn.delete-btn:hover {
    color: #ef4444;
    border-color: #fca5a5;
    background: #fef2f2;
}

/* 搜索框美化 - Mac Spotlight风格 */
.customer-search-container {
    padding: 0 1rem 1rem 1rem;
    position: relative;
}

.customer-search-box {
    position: relative;
}

.customer-search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    color: #262626;
}

.customer-search-input::placeholder {
    color: #a3a3a3;
}

.customer-search-input:focus {
    outline: none;
    border-color: #2563eb;
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.6;
}

/* 滚动条美化 - 悬停时显示 */
.customer-list::-webkit-scrollbar {
    width: 5px;
}

.customer-list::-webkit-scrollbar-track {
    background: transparent;
}

.customer-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0);
    border-radius: 10px;
    transition: background 0.3s;
}

.customer-list:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

.customer-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* 搜索高亮 - 淡金色 */
.highlight-premium {
    background: rgba(255, 215, 0, 0.25);
    color: #171717;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 600;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    background: #f5f5f5;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: #d4d4d4;
    font-size: 2rem;
}

.empty-state-title {
    color: #171717;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.empty-state-subtitle {
    color: #a3a3a3;
    font-size: 0.875rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .session-item {
        margin: 0 0.5rem;
        padding: 0.625rem 0.75rem;
        border-radius: 1rem;
    }
    
    .session-avatar {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .session-actions {
        display: none !important;
    }
}
