/* 基础样式和变量 */
:root {
    /* 中国风水墨画配色方案 */
    --primary-color: #333333;
    --secondary-color: #8A6D3B;
    --accent-color: #A31F34;
    --background-color: #F8F4E9;
    --text-color: #333333;
    --border-color: #D3C5A8;
    --light-bg: #E8DFCB;
    --dark-brown: #6B572E;

    font-family: "Noto Serif SC", "SimSun", serif;
    line-height: 1.8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--background-color);
    /* 使用多重背景：纯色 + 纹理图片 */
    background-image:
            linear-gradient(rgba(248, 244, 233, 0.9), rgba(248, 244, 233, 0.9)),
            url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="%23F8F4E9"/><path d="M0,0 L100,100 M100,0 L0,100" stroke="%23D3C5A8" stroke-width="0.5" stroke-opacity="0.1"/></svg>');
    background-size: auto, 200px 200px;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-color);
    min-height: 100vh;
    position: relative;
}

/* 添加宣纸纹理覆盖层 */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
            radial-gradient(circle at 25% 25%, rgba(211, 197, 168, 0.1) 2px, transparent 2px),
            radial-gradient(circle at 75% 75%, rgba(211, 197, 168, 0.1) 2px, transparent 2px);
    background-size: 50px 50px, 50px 50px;
    background-position: 0 0, 25px 25px;
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 水墨装饰元素 */
.ink-decoration {
    position: fixed;
    width: 160px;
    height: 160px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
    filter: grayscale(100%) brightness(0.8);
}

.ink-decoration.top-left {
    top: 0;
    left: 0;
    background:
            radial-gradient(circle at 30% 30%, rgba(163, 31, 52, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 70% 70%, rgba(138, 109, 59, 0.1) 0%, transparent 50%);
}

.ink-decoration.bottom-right {
    bottom: 0;
    right: 0;
    background:
            radial-gradient(circle at 70% 30%, rgba(138, 109, 59, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 30% 70%, rgba(163, 31, 52, 0.1) 0%, transparent 50%);
}

/* 头部样式 */
.header {
    position: relative;
    z-index: 10;
    padding: 40px 0;
    background: linear-gradient(to bottom, rgba(232, 223, 203, 0.8), transparent);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 20px rgba(138, 109, 59, 0.1);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    text-align: center;
}

.site-title {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.site-title::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

.site-title .accent {
    color: var(--accent-color);
    position: relative;
}

.site-description {
    color: var(--secondary-color);
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.6;
}

/* 搜索栏样式 */
.search-container {
    width: 100%;
    max-width: 600px;
}

.search-bar {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 20px 12px 50px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border-color);
    border-radius: 30px;
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(138, 109, 59, 0.1);
}

.search-input:focus {
    outline: none;
    box-shadow: 0 4px 20px rgba(138, 109, 59, 0.2);
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.95);
}

.search-input::placeholder {
    color: var(--secondary-color);
    opacity: 0.7;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    font-size: 1.1rem;
}

/* 筛选面板样式 */
.filter-section {
    margin-bottom: 32px;
}

.filter-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 25px rgba(138, 109, 59, 0.15);
    position: relative;
    backdrop-filter: blur(10px);
}

.filter-panel::before {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid rgba(138, 109, 59, 0.3);
    border-radius: 18px;
    pointer-events: none;
    z-index: -1;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.filter-header h2 {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    position: relative;
}

.filter-header h2::after {
    content: "";
    position: absolute;
    bottom: -18px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent-color);
}

.clear-filters-btn {
    background: rgba(232, 223, 203, 0.8);
    border: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
}

.clear-filters-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(163, 31, 52, 0.3);
}

/* 筛选组样式 */
.filter-group {
    margin-bottom: 24px;
}

.filter-group h3 {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.filter-group h3::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--secondary-color);
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid transparent;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
}

.filter-btn:not(.active) {
    background: var(--light-bg);
    color: var(--dark-brown);
    border-color: transparent;
}

.filter-btn:not(.active):hover {
    background: var(--border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(138, 109, 59, 0.2);
}

.filter-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(163, 31, 52, 0.4);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.more-btn {
    background: var(--secondary-color) !important;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 4px;
    border-color: var(--secondary-color) !important;
}

.more-btn:hover {
    background: var(--dark-brown) !important;
    border-color: var(--dark-brown) !important;
}

/* 结果统计样式 */
.results-section {
    margin-bottom: 24px;
    text-align: center;
}

.results-info {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.results-info .count {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    background: var(--light-bg);
    color: var(--dark-brown);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 诗词网格样式 */
.poems-section {
    position: relative;
    min-height: 400px;
}

.loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--light-bg);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* New layout styles */
.poem-detail-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.poem-detail-main {
    flex: 1;
    min-width: 0;
}

.poem-detail-side {
    width: 100%;
}

@media (min-width: 1024px) {
    .poem-detail-layout {
        flex-direction: row;
    }

    .poem-detail-side {
        width: 400px;
        flex-shrink: 0;
    }
}
.poems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

/* 诗词卡片样式 */
.poem-card {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 6px 20px rgba(138, 109, 59, 0.15);
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
    text-decoration: none;
    color: inherit;
    display: block;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.poem-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.poem-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px rgba(138, 109, 59, 0.25);
    border-color: var(--secondary-color);
}

.poem-card:hover::before {
    transform: scaleX(1);
}

.poem-card:hover .poem-title {
    color: var(--accent-color);
    transform: translateX(5px);
}

.poem-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
    transition: all 0.3s ease;
    line-height: 1.4;
}

.poem-author {
    color: var(--secondary-color);
    font-style: italic;
    margin-bottom: 16px;
    font-size: 1rem;
}

.poem-preview {
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 16px;
    line-height: 1.6;
    min-height: 80px;
}

.poem-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

/* 添加容器样式，使标签和统计信息在同一排显示 */
.poem-tags-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.poem-tag {
    background: var(--light-bg);
    color: var(--dark-brown);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    border: 1px solid rgba(138, 109, 59, 0.2);
    transition: all 0.3s ease;
}

.poem-tag.more {
    background: rgba(138, 109, 59, 0.1);
}


/* 添加查看数和喜欢数样式 */
.poem-stats {
    display: flex;
    gap: 15px;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.poem-stats .fas {
    margin-right: 5px;
}

.poem-views, .poem-likes {
    display: flex;
    align-items: center;
}

/* 诗词详情页面新增样式 */
.poem-detail-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.poem-actions {
    text-align: center;
    margin: 20px 0;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 0 10px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
}

.btn:hover {
    background: #0056b3;
}

.btn.print {
    background: #28a745;
}

.btn.print:hover {
    background: #1e7e34;
}

.btn.download {
    background: #ffc107;
    color: #212529;
}

.btn.download:hover {
    background: #e0a800;
}

.poem-appreciation {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #007bff;
}

.poem-appreciation h3 {
    margin-top: 0;
    color: #007bff;
}

.poem-pinyin {
    font-size: 14px;
    color: #6c757d;
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.pinyin-lines {
    margin-top: 10px;
}

.hide-pinyin .pinyin-line {
    display: none;
}

.poem-line-container {
    margin-bottom: 1em; /* 减小诗词之间的间距 */
}

.pinyin-line {
    font-size: 1rem;
    color: var(--secondary-color);
    line-height: 1.5;
    margin-bottom: 0.25em;
}

.poem-line {
    font-size: 1.4rem;
    font-weight: 500;
}

.poem-line-container {
    margin-bottom: 1em; /* 减小诗词之间的间距 */
}

.pinyin-line {
    font-size: 1rem;
    color: var(--secondary-color);
    line-height: 1.5;
    margin-bottom: 0.25em;
}

.poem-line {
    font-size: 1.4rem;
    font-weight: 500;
}

.poem-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.poem-detail-tag {
    background: var(--light-bg);
    color: var(--dark-brown);
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 分页控件样式 */
.pagination-container {
    margin: 32px 0;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Noto Serif SC", "SimSun", serif;
    font-size: 1rem;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background: var(--light-bg);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(138, 109, 59, 0.2);
}

.pagination-btn:active {
    transform: translateY(0);
}

.pagination-current {
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: var(--secondary-color);
    font-weight: bold;
}

/* 页脚样式 */
.footer {
    position: relative;
    z-index: 10;
    margin-top: 60px;
    padding: 32px 0;
    background: linear-gradient(to top, rgba(232, 223, 203, 0.9), transparent);
    text-align: center;
    color: var(--secondary-color);
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--border-color);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 5px;
    border: 2px solid var(--light-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-brown);
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* 筛选组展开状态 */
.filter-options.expanded {
    flex-wrap: wrap;
}


/* Pinyin toggle switch styles */
.pinyin-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
    color: var(--secondary-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--light-bg);
    transition: .4s;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 0 2px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--secondary-color);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}


.poem-detail-content {
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 16px;
    line-height: 1.6;
    min-height: 80px;
 
    font-size: 1.4rem;
    font-weight: 500;
}

.poem-line-container {
    margin-bottom: 1em; /* 减小诗词之间的间距 */
}

.pinyin-line {
    font-size: 1rem;
    color: var(--secondary-color);
    line-height: 1.5;
    margin-bottom: 0.25em;
}

.poem-line {
    font-size: 1.4rem;
    font-weight: 500;
}

.poem-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.poem-detail-tag {
    background: var(--light-bg);
    color: var(--dark-brown);
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 分页控件样式 */
.pagination-container {
    margin: 32px 0;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Noto Serif SC", "SimSun", serif;
    font-size: 1rem;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background: var(--light-bg);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(138, 109, 59, 0.2);
}

.pagination-btn:active {
    transform: translateY(0);
}

.pagination-current {
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: var(--secondary-color);
    font-weight: bold;
}

/* 页脚样式 */
.footer {
    position: relative;
    z-index: 10;
    margin-top: 60px;
    padding: 32px 0;
    background: linear-gradient(to top, rgba(232, 223, 203, 0.9), transparent);
    text-align: center;
    color: var(--secondary-color);
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--border-color);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 5px;
    border: 2px solid var(--light-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-brown);
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* 筛选组展开状态 */
.filter-options.expanded {
    flex-wrap: wrap;
}