<?php
/**
 * 搜索页面模板示例
 *
 * @package Chinese-Character-Dictionary
 */

get_header(); ?>

<div class="search-page-wrapper">
    <div class="search-page-container">
        <div class="search-page-header">
            <h1>汉字搜索</h1>
            <p>输入汉字、词语或成语进行搜索</p>
        </div>
        
        <div class="search-section">
            <?php echo do_shortcode('[character_search_form]'); ?>
        </div>
        
        <div class="results-section">
            <?php if (get_search_query()) : ?>
                <?php echo do_shortcode('[character_search_results]'); ?>
            <?php else : ?>
                <div class="search-tips">
                    <h3>使用说明</h3>
                    <ul>
                        <li>在上方搜索框中输入汉字、词语或成语进行搜索</li>
                        <li>可以使用拼音检索查找特定读音的汉字</li>
                        <li>可以使用部首检索查找具有特定部首的汉字</li>
                    </ul>
                </div>
            <?php endif; ?>
        </div>
        
        <!-- 推荐内容区域 -->
        <div class="recommendations-section">
            <h2>热门推荐</h2>
            <div class="recommendations-grid">
                <?php echo do_shortcode('[character_recommendations count="8"]'); ?>
            </div>
        </div>
    </div>
</div>

<style>
.search-page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.search-page-header h1 {
    font-size: 2em;
    color: #333;
    margin-bottom: 10px;
}

.chinese-character-search-wrapper {
    margin: 30px 0;
}

.chinese-character-search-form .search-input-group {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
}

.chinese-character-search-form input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
}

.search-submit-button {
    padding: 12px 20px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
}

.search-submit-button:hover {
    background-color: #005a87;
}

.search-options {
    text-align: center;
    margin-top: 15px;
}

.search-option-links a {
    margin: 0 10px;
    color: #0073aa;
    text-decoration: none;
}

.search-option-links a:hover {
    text-decoration: underline;
}

.chinese-character-search-results h3 {
    margin-bottom: 20px;
    color: #333;
}

.search-result-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

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

.search-result-item h4 a {
    color: #0073aa;
    text-decoration: none;
}

.search-result-item h4 a:hover {
    text-decoration: underline;
}

.search-result-meta {
    margin-top: 5px;
}

.result-type {
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    color: #666;
}

.search-tips ul {
    padding-left: 20px;
}

.search-tips li {
    margin-bottom: 10px;
}

.recommendations-section {
    margin-top: 40px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.recommendations-section h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.recommendation-item {
    text-align: center;
    padding: 15px;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.recommendation-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.recommendation-character {
    font-size: 1.8em;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 8px;
}

.recommendation-pinyin {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.recommendation-meaning {
    color: #888;
    font-size: 0.8em;
}
</style>

<?php get_footer(); ?>