/*
 Theme Name:   Woodmart Child High Performance
 Description:  A high-performance child theme for Woodmart.
 Author:       Developer
 Template:     woodmart
 Version:      1.2.0
 Text Domain:  woodmart
*/

/* ============================================
   异步搜索结果样式
   ============================================ */

.wdchild-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--wd-form-bg, #fff);
    border: 1px solid var(--wd-form-brd-color, rgba(0,0,0,0.1));
    max-height: 450px;
    overflow-y: auto;
    box-shadow: var(--wd-box-shadow, 0 10px 25px rgba(0,0,0,0.1));
    display: none;
    border-radius: 0 0 var(--wd-brd-radius) var(--wd-brd-radius);
    margin-top: 2px;
}

.wdchild-search-results.active {
    display: block;
}

.ajax-search-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.search-result-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--wd-brd-radius);
    background-color: var(--wd-form-bg, #fff);
    color: var(--wd-text-color);
    text-decoration: none;
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px);
    animation: wdAjaxSearchFadeUp 0.32s ease forwards;
    will-change: transform, opacity;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    background-color: var(--wd-bg-gray, rgba(0, 0, 0, 0.04));
    color: var(--wd-primary-color);
}

@keyframes wdAjaxSearchFadeUp {
    to { opacity: 1; transform: translateY(0); }
}

.search-result-thumb {
    position: relative;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: calc(var(--wd-brd-radius) * 0.5);
    overflow: hidden;
    background-color: var(--wd-bg-gray, #f5f5f5);
}

.search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.search-result-thumb.is-loaded img {
    opacity: 1;
}

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

.search-result-title {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--wd-title-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 13px;
    color: var(--wd-primary-color);
    font-weight: 500;
}

.search-result-sku {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 2px;
}

/* 空状态 */
.search-empty-state {
    padding: 20px;
    text-align: center;
    color: var(--wd-text-muted, #777);
    font-size: 14px;
}

/* 加载中骨架 */
.search-loading {
    padding: 15px;
    text-align: center;
}

.search-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--wd-bg-gray, #e5e5e5);
    border-top-color: var(--wd-primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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