/**
 * 云信IM - 消息搜索对话框样式
 * 微信风格：独立浮层弹窗
 */

/* ==================== 遮罩层 ==================== */
.yunxin-search-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==================== 对话框主体 ==================== */
.yunxin-search-dialog {
    width: 680px;
    max-width: 90vw;
    max-height: 85vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

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

/* ==================== 头部 ==================== */
.yunxin-search-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #EDEDED;
    flex-shrink: 0;
}

.yunxin-search-title {
    font-size: 17px;
    font-weight: 600;
    color: #000;
}

.yunxin-search-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.yunxin-search-close-btn:hover {
    background: #F5F5F5;
    color: #333;
}

/* ==================== 搜索框 ==================== */
.yunxin-search-input-wrapper {
    position: relative;
    padding: 16px 20px;
    border-bottom: 1px solid #EDEDED;
    flex-shrink: 0;
}

.yunxin-search-icon {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.yunxin-search-input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 44px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #F7F7F7;
}

.yunxin-search-input:focus {
    background: #fff;
    border-color: #07C160;
}

.yunxin-search-clear-btn {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.yunxin-search-clear-btn:hover {
    color: #666;
}

/* ==================== 内容区域 ==================== */
.yunxin-search-dialog-body {
    flex: 1;
    overflow-y: auto;
    min-height: 400px;
    max-height: calc(85vh - 140px);
}

/* 滚动条样式 */
.yunxin-search-dialog-body::-webkit-scrollbar {
    width: 6px;
}

.yunxin-search-dialog-body::-webkit-scrollbar-thumb {
    background: #D0D0D0;
    border-radius: 3px;
}

.yunxin-search-dialog-body::-webkit-scrollbar-thumb:hover {
    background: #B0B0B0;
}

.yunxin-search-dialog-body::-webkit-scrollbar-track {
    background: transparent;
}

/* ==================== 搜索历史 ==================== */
.yunxin-search-history {
    padding: 16px 20px;
}

.yunxin-search-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.yunxin-search-history-title {
    font-size: 13px;
    color: #999;
}

.yunxin-search-history-clear {
    font-size: 13px;
    color: #576B95;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.yunxin-search-history-clear:hover {
    background: #F0F0F0;
}

.yunxin-search-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.yunxin-search-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.yunxin-search-history-item:hover {
    background: #F5F5F5;
}

.yunxin-search-history-text {
    flex: 1;
    font-size: 14px;
    color: #333;
}

/* ==================== 搜索结果 ==================== */
.yunxin-search-results {
    display: flex;
    flex-direction: column;
}

.yunxin-search-results-header {
    padding: 16px 20px 12px;
    font-size: 13px;
    color: #999;
    border-bottom: 1px solid #F0F0F0;
    flex-shrink: 0;
}

.yunxin-search-count {
    color: #07C160;
    font-weight: 600;
}

.yunxin-search-results-list {
    flex: 1;
    overflow-y: auto;
}

.yunxin-search-result-item {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #F5F5F5;
}

.yunxin-search-result-item:hover {
    background: #F7F7F7;
}

.yunxin-search-result-item:last-child {
    border-bottom: none;
}

.yunxin-search-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
    object-fit: cover;
}

.yunxin-search-result-content {
    flex: 1;
    min-width: 0;
}

.yunxin-search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.yunxin-search-result-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.yunxin-search-result-time {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
    margin-left: 8px;
}

.yunxin-search-result-text {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 高亮关键词 */
.yunxin-search-highlight {
    background: #FFF9C4;
    color: #E65100;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 500;
}

/* ==================== 空状态 ==================== */
.yunxin-search-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    min-height: 400px;
}

.yunxin-search-empty svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.yunxin-search-empty-text {
    font-size: 14px;
    color: #999;
}

/* ==================== 加载中 ==================== */
.yunxin-search-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    min-height: 400px;
}

.yunxin-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #F0F0F0;
    border-top-color: #07C160;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.yunxin-search-loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: #999;
}

/* ==================== 消息高亮效果 ==================== */
.yunxin-message-highlight {
    animation: messageHighlight 2s ease;
}

@keyframes messageHighlight {
    0%, 100% {
        background: transparent;
    }
    50% {
        background: #FFF9C4;
    }
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .yunxin-search-dialog {
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    
    .yunxin-search-dialog-body {
        max-height: calc(100vh - 140px);
    }
}

