/* 汉字字典页面样式 */
:root {
    --primary-color: #4e7ca8;
    --secondary-color: #a8c4e0;
    --accent-color: #2c5282;
    --light-bg: #f5f8fa;
    --dark-bg: #2c5282;
    --text-color: #333;
    --light-text: #f5f8fa;
    --border-color: #a8c4e0;
    --shadow-color: rgba(78, 124, 168, 0.2);
    --highlight-color: #f0ad4e;
}

/* 整体页面样式 */
body {
    background-color: var(--light-bg);
    color: var(--text-color);
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    line-height: 1.6;
}

/* 头部搜索区域样式 */
.search-container {
    background: linear-gradient(135deg, var(--primary-color), var(--dark-bg));
    padding: 30px 0;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.search-box {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
}

.search-box h2 {
    color: var(--primary-color);
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

.search-form {
    display: flex;
    margin-bottom: 10px;
}

.search-form input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(78, 124, 168, 0.2);
}

.search-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-form button:hover {
    background-color: var(--accent-color);
}

.search-tips {
    text-align: center;
    font-size: 14px;
    color: #666;
}

/* 主内容区域样式 */
.main-content {
    padding: 20px 0 40px;
}

.section-header {
    margin-bottom: 20px;
}

.section-header h2 {
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 5px;
    position: relative;
    padding-bottom: 10px;
}

.section-header h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--highlight-color);
}

.section-header p {
    color: #666;
    margin: 0;
}

/* 查询工具样式 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tool-item {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 3px 10px var(--shadow-color);
    transition: all 0.3s ease;
    text-align: center;
    border-top: 4px solid var(--primary-color);
}

.tool-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.tool-item h4 {
    color: var(--primary-color);
    margin: 0 0 10px 0;
    font-size: 18px;
}

.tool-item p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* 拼音导航样式 */
.pinyin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.pinyin-nav a {
    display: inline-block;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    background-color: var(--light-bg);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pinyin-nav a:hover {
    background-color: var(--primary-color);
    color: white;
}

.pinyin-group {
    margin-bottom: 30px;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 3px 10px var(--shadow-color);
}

.pinyin-group h3 {
    color: var(--primary-color);
    font-size: 22px;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.dictionary-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}

.dictionary-list a {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
    background-color: var(--light-bg);
    text-align: center;
}

.dictionary-list a:hover {
    background-color: var(--secondary-color);
    color: var(--dark-bg);
}

/* 汉字详情页样式 */
.character-detail {
    background-color: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 3px 15px var(--shadow-color);
}

.character-header {
    margin-bottom: 25px;
    text-align: center;
}

.character-title {
    font-size: 72px;
    color: var(--primary-color);
    margin-bottom: 15px;
    line-height: 1;
}

.character-pinyin {
    color: #666;
    font-size: 18px;
    margin-bottom: 10px;
}

.character-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.character-info span {
    background-color: var(--light-bg);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--primary-color);
}

.character-section {
    margin-bottom: 30px;
}

.character-section h3 {
    color: var(--primary-color);
    font-size: 20px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.character-section-content {
    line-height: 1.8;
}

.meaning-list {
    list-style-type: decimal;
    padding-left: 20px;
}

.meaning-list li {
    margin-bottom: 10px;
}

.meaning-list li:last-child {
    margin-bottom: 0;
}

/* 汉字结构分析 */
.character-structure {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.structure-item {
    flex: 1;
    min-width: 200px;
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: 8px;
}

.structure-item h4 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
}

.structure-item p {
    margin: 0;
}

/* 组词例句样式 */
.word-examples {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.word-example {
    background-color: var(--light-bg);
    padding: 10px 15px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.word-example:hover {
    background-color: var(--secondary-color);
    color: var(--dark-bg);
}

.sentence-examples {
    margin-top: 20px;
}

.sentence-item {
    margin-bottom: 15px;
    padding-left: 20px;
    position: relative;
}

.sentence-item::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--highlight-color);
    font-size: 20px;
    line-height: 1;
}

/* 笔顺动画 */
.stroke-order {
    text-align: center;
    margin: 30px 0;
}

.stroke-order-title {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.stroke-animation {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stroke-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.stroke-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stroke-button:hover {
    background-color: var(--accent-color);
}

/* 相关汉字 */
.related-characters {
    margin-top: 30px;
}

.related-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.related-list a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background-color: var(--light-bg);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 18px;
}

.related-list a:hover {
    background-color: var(--primary-color);
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .dictionary-list {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .character-structure {
        flex-direction: column;
    }
    
    .word-examples {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .character-title {
        font-size: 60px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animated {
    animation: fadeIn 0.8s ease-out forwards;
}

/* 笔画示意图 */
.stroke-diagram {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.stroke-step {
    width: 60px;
    height: 60px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background-color: #fff;
    position: relative;
}

.stroke-step::after {
    content: attr(data-step);
    position: absolute;
    bottom: -20px;
    font-size: 12px;
    color: #666;
}