/**
 * 搜索联想组件样式
 * 提供现代化、响应式的搜索建议下拉框
 */

/* 联想容器 */
.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    margin-top: 0;
    max-height: 360px;
    overflow-y: auto;
    z-index: 1000 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 显示状态 */
.search-suggestions.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 联想列表 */
.suggestions-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

/* 联想项 */
.suggestion-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    min-height: 88px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background-color: rgba(240, 248, 255, 0.6);
}

/* 联想项图片 - 采用2:3比例 */
.suggestion-pic {
    width: 48px;
    height: 72px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 10px;
    flex-shrink: 0;
    background-color: #f0f0f0;
}

/* 无图片时的占位 */
.suggestion-pic-placeholder {
    width: 48px;
    height: 72px;
    border-radius: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-right: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 16px;
}

/* 联想项文字容器 */
.suggestion-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    text-align: left;
    color: #333;
}

/* 标题文字 */
.suggestion-text .main-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
}

/* 加载状态 */
.suggestions-loading {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.suggestions-loading:before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: suggestions-spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* 空状态 */
.suggestions-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* 旋转动画 */
@keyframes suggestions-spin {
    to {
        transform: rotate(360deg);
    }
}

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

.search-suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .search-suggestions {
        max-height: 300px;
        border-radius: 6px;
        top: calc(100% + 2px);
    }

    .suggestion-item {
        padding: 6px 10px;
        min-height: 70px;
    }

    .suggestion-pic,
    .suggestion-pic-placeholder {
        width: 40px;
        height: 60px;
        margin-right: 8px;
    }

    .suggestion-pic-placeholder {
        font-size: 14px;
    }

    .suggestion-text .main-title {
        font-size: 13px;
    }
}

/* 暗色模式支持 - 已禁用，强制使用亮色主题 */
/* @media (prefers-color-scheme: dark) {
    .search-suggestions {
        background: #2d2d2d;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }

    .suggestion-item:hover,
    .suggestion-item.active {
        background-color: #3d3d3d;
    }

    .suggestion-text {
        color: #e0e0e0;
    }

    .suggestion-pic-placeholder {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .suggestions-loading,
    .suggestions-empty {
        color: #888;
    }
} */

/* 搜索框容器需要相对定位 */
.search-wrapper {
    position: relative;
    z-index: 100;
}

/* 针对首页搜索框的特殊样式 */
.homeBox .search-wrapper {
    position: relative;
    z-index: 100;
}

.homeBox .search {
    position: relative;
    z-index: 100;
}

.homeBox .search-suggestions {
    max-width: 100%;
    z-index: 1000 !important;
}

/* 针对列表页搜索框的特殊样式 */
.searchList {
    position: relative;
    z-index: 100;
}

.searchList .search-wrapper {
    position: relative;
    z-index: 100;
}

.searchList .search {
    position: relative;
    z-index: 100;
}

.searchList .search-suggestions {
    max-width: 100%;
    z-index: 1000 !important;
}

/* 针对header搜索框的特殊样式 */
.headerBox {
    overflow: visible !important;
    z-index: 100;
}

.headerBox .box {
    overflow: visible !important;
    z-index: 100;
}

.headerBox .search {
    position: relative;
    overflow: visible !important;
    z-index: 100;
}

.headerBox .search-suggestions {
    max-width: 400px;
    right: 0;
    left: auto;
    z-index: 1000 !important;
}

/* 电脑端header搜索框联想框适配 */
@media (min-width: 769px) {
    .headerBox .search-suggestions {
        width: 400px;
    }
}

