/* ==========================================
   WooCommerce 产品搜索框 - 前端样式
   ========================================== */

/* ---------- 搜索容器 ---------- */
.eco-search-container {
    position: relative;
    display: block;
}

/* ---------- 搜索框包装器 ---------- */
.eco-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

/* ---------- 搜索输入框 ---------- */
.eco-search-input {
    width: 100%;
    height: 44px;
    padding: 0 40px 0 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f5f5f5;
    color: #333;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.eco-search-input:focus {
    background-color: #fff;
    border-color: #333;
}

.eco-search-input::placeholder {
    color: #999;
}

/* ---------- 搜索按钮/图标（通用） ---------- */
.eco-search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s ease, background-color 0.3s ease;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 按钮在后方（默认） */
.eco-search-wrapper.btn-position-after .eco-search-icon {
    right: 12px;
}

/* 按钮在前方 */
.eco-search-wrapper.btn-position-before .eco-search-icon {
    left: 12px;
}

/* ---------- 面板内加载图标 ---------- */
.eco-search-panel-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0;
    margin: 0 auto;
}

.eco-search-panel-spinner-icon {
    font-size: 28px;
    color: #999;
    animation: ecoSearchPanelSpin 0.8s linear infinite;
}

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

/* ---------- 下拉面板 ---------- */
.eco-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 9999;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    max-height: 500px;
    overflow-y: auto;
    animation: ecoSearchDropdownIn 0.2s ease;
}

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

.eco-search-dropdown-inner {
    padding: 12px;
}

/* ---------- 搜索结果网格 ---------- */
.eco-search-results-grid {
    display: grid;
    row-gap: 12px;
    column-gap: 12px;
}

/* ---------- 搜索结果中的 Loop Item ---------- */
.eco-search-results-grid .e-loop-item {
    overflow: hidden;
}

/* ---------- 未搜索到提示 ---------- */
.eco-search-no-results-text {
    color: #999;
    font-size: 14px;
    padding: 12px 0 8px;
    text-align: center;
}

/* ---------- 推荐产品区域 ---------- */
.eco-search-recommend-section {
    padding-top: 4px;
}

.eco-search-recommend-title {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 0 8px;
}

.eco-search-recommend-grid {
    display: grid;
    row-gap: 12px;
    column-gap: 12px;
}

/* ---------- 推荐产品中的 Loop Item ---------- */
.eco-search-recommend-grid .e-loop-item {
    overflow: hidden;
}

/* ---------- Shop 按钮 ---------- */
.eco-search-shop-btn-wrapper {
    display: flex;
    justify-content: stretch;
    margin-top: 12px;
}

.eco-search-shop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 24px;
    background-color: #111;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    text-align: center;
}

.eco-search-shop-btn:hover {
    background-color: #333;
    color: #fff;
    text-decoration: none;
}

.eco-search-shop-btn:active {
    background-color: #000;
    color: #fff;
    text-decoration: none;
}

/* ==========================================
   简单产品列表（无模板降级方案）
   ========================================== */
.eco-search-simple-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.eco-search-simple-item:last-child {
    border-bottom: none;
}

.eco-search-simple-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
    transition: background-color 0.2s ease;
    padding: 4px;
    border-radius: 4px;
}

.eco-search-simple-link:hover {
    background-color: #f9f9f9;
}

.eco-search-simple-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    margin-right: 12px;
    border-radius: 4px;
    overflow: hidden;
}

.eco-search-simple-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.eco-search-simple-info {
    flex: 1;
    min-width: 0;
}

.eco-search-simple-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eco-search-simple-price {
    font-size: 13px;
    color: #666;
}
