/* ===== search.css - 搜索页面样式 ===== */

/* 主容器 */
.search-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 60vh;
}

/* ===== 移动端优先原则 ===== */

/* 搜索框区域 */
.search-header {
    margin-bottom: 30px;
}

.search-box-large {
    max-width: 100%;
    margin: 0 auto;
}

.search-form {
    display: flex;
    gap: 0;
    border: 2px solid var(--border);
    border-radius: 50px;
    overflow: hidden;
    transition: all 0.3s;
    background: white;
}

.search-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input {
    flex: 1;
    padding: 14px 18px;
    border: none;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    background: white;
}

.search-input::placeholder {
    color: #aaa;
    font-size: 0.9rem;
}

.search-btn {
    background: var(--primary);
    border: none;
    padding: 0 20px;
    cursor: pointer;
    transition: background 0.3s;
    color: white;
    font-size: 1rem;
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* 搜索结果统计 */
.search-stats {
    text-align: center;
    margin-bottom: 30px;
}

.search-stats h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-word;
}

.search-stats .keyword {
    color: var(--primary);
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.result-count {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 搜索结果网格 - 移动端单列 */
.search-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.search-result-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    flex-direction: row;
    align-items: center;
}

.search-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.result-link {
    text-decoration: none;
    display: flex;
    width: 100%;
    flex-direction: row;
}

.result-image {
    width: 100px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    transition: transform 0.3s;
}

.search-result-item:hover .result-image img {
    transform: scale(1.05);
}

.result-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    z-index: 1;
}

.result-info {
    flex: 1;
    padding: 12px;
    min-width: 0; /* 防止溢出 */
}

.result-info h3 {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.result-info h3 .highlight {
    background: #fff3cd;
    color: #856404;
    padding: 0 2px;
    border-radius: 3px;
}

.result-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.7rem;
    color: var(--text-light);
}

.result-specs span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.result-specs i {
    color: var(--primary);
    width: 12px;
    font-size: 0.7rem;
}

.result-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.result-price .price-label {
    font-size: 0.7rem;
    color: var(--text-lighter);
}

.result-price .price {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

/* 无搜索结果 / 空搜索 */
.no-results,
.empty-search {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-light);
    border-radius: 16px;
}

.no-results i,
.empty-search i {
    font-size: 3rem;
    color: var(--text-lighter);
    margin-bottom: 16px;
}

.no-results h2,
.empty-search h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.no-results p,
.empty-search p {
    color: var(--text-light);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.suggestions {
    margin-bottom: 24px;
    text-align: left;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.suggestions h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.suggestions ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.suggestions li {
    background: white;
    padding: 5px 12px;
    border-radius: 30px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-light);
}

/* 热门搜索 */
.hot-keywords {
    margin-bottom: 32px;
}

.hot-keywords h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text);
}

.keywords-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.keyword-tag {
    background: white;
    padding: 6px 16px;
    border-radius: 30px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    transition: all 0.3s;
    font-size: 0.85rem;
    white-space: nowrap;
}

.keyword-tag:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 分类推荐 */
.featured-categories {
    margin-top: 24px;
}

.featured-categories h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.category-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 40px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s;
    font-size: 0.85rem;
}

.category-link i {
    color: var(--primary);
    font-size: 0.9rem;
}

.category-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.category-link:hover i {
    color: white;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.page-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 30px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s;
    font-size: 0.85rem;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-numbers {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-num {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s;
    font-size: 0.85rem;
    padding: 0 8px;
}

.page-num:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-num.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-dots {
    color: var(--text-lighter);
    padding: 0 4px;
    display: flex;
    align-items: center;
}

/* ===== 平板优化 ===== */
@media (min-width: 480px) {
    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .search-result-item {
        flex-direction: column;
    }

    .result-link {
        flex-direction: column;
    }

    .result-image {
        width: 100%;
        aspect-ratio: 1 / 1;
    }

    .result-image img {
        padding: 20px;
    }

    .result-info h3 {
        font-size: 0.95rem;
    }

    .result-specs {
        font-size: 0.75rem;
    }

    .search-input {
        padding: 16px 24px;
        font-size: 1rem;
    }

    .search-btn {
        padding: 0 28px;
        font-size: 1.1rem;
    }

    .search-stats h1 {
        font-size: 1.6rem;
    }
}

@media (min-width: 768px) {
    .search-container {
        padding: 40px 20px;
    }

    .search-stats h1 {
        font-size: 1.8rem;
    }

    .search-results-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media (min-width: 1024px) {
    .search-results-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }

    .search-box-large {
        max-width: 700px;
    }

    .search-input {
        padding: 16px 28px;
        font-size: 1.1rem;
    }
}

/* ===== 超小屏幕优化 ===== */
@media (max-width: 380px) {
    .result-specs {
        gap: 6px;
    }

    .result-specs span {
        font-size: 0.65rem;
    }

    .keyword-tag {
        padding: 5px 12px;
        font-size: 0.75rem;
    }

    .category-link {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .page-num {
        min-width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .page-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* ===== 无搜索结果模块 - 全屏背景，内容居中 ===== */
.no-results,
.empty-search {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: var(--bg-light);
    padding: 60px 20px;
    text-align: center;
}

/* 内部内容容器 - 与头部宽度一致 */
.no-results .no-results-inner,
.empty-search .empty-search-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* 标题样式 - 居中 */
.no-results h3,
.empty-search h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text);
    text-align: center;
}

/* 图标 */
.no-results i,
.empty-search i {
    font-size: 3.5rem;
    color: var(--text-lighter);
    margin-bottom: 20px;
    display: inline-block;
}

/* 主标题 */
.no-results h2,
.empty-search h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text);
}

/* 描述文字 */
.no-results p,
.empty-search p {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* 建议列表 */
.suggestions {
    margin-bottom: 30px;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.suggestions ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.suggestions li {
    background: white;
    padding: 6px 16px;
    border-radius: 30px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-light);
}

/* 按钮 */
.no-results .btn-primary,
.empty-search .btn-primary {
    display: inline-block;
    margin-top: 10px;
}