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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.8;
    color: #333;
    background-color: #f9f7f1;
    padding-top: 70px;
    /* 为固定导航栏留出空间 */
}

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

h1,
h2,
h3,
h4 {
    color: #5a3d2b;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #5a3d2b;
}

h2 {
    font-size: 1.8rem;
    border-bottom: 2px solid #e0d8c0;
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.3rem;
    color: #7d5a29;
    margin-top: 1.5rem;
}

a {
    text-decoration: none;
    color: #5a3d2b;
    transition: color 0.3s ease;
}

a:hover {
    color: #8b5a2b;
}

button {
    cursor: pointer;
    background-color: #8b5a2b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #6d4421;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

/* 加载状态样式 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #5a3d2b;
}

.loading-spinner {
    border: 4px solid #f1ede4;
    border-top: 4px solid #8b5a2b;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.error-message {
    color: #dc3545;
    text-align: center;
    padding: 1rem;
    background-color: #f8d7da;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* 导航栏样式 */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #5a3d2b;
    display: flex;
    align-items: center;
}

.logo span {
    color: #2e8b57;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin-left: 2rem;
}

.nav-links a {
    font-weight: 500;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: #8b5a2b;
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    background: none;
    color: #5a3d2b;
    padding: 5px;
}

/* 主要内容区域 */
.main-content {
    display: flex;
    margin: 3rem 0;
    gap: 2rem;
}

/* 首页样式 */
#home-page {
    display: block;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
}

.search-box {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.search-box h3 {
    margin-bottom: 1rem;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.content-area {
    flex-grow: 1;
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #5a3d2b;
    position: relative;
    padding-bottom: 1rem;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: #2e8b57;
}

.pinyin-filter {
    margin-bottom: 2rem;
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.pinyin-filter h3 {
    margin-bottom: 1rem;
}

.pinyin-letters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pinyin-letter {
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #f1ede4;
    color: #5a3d2b;
    text-align: center;
    line-height: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pinyin-letter:hover,
.pinyin-letter.active {
    background-color: #8b5a2b;
    color: white;
}

.formula-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.formula-item {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-align: center;
}

.formula-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.formula-item a {
    display: block;
    height: 100%;
    width: 100%;
    padding: 1rem;
}

/* 详情页样式 */
#detail-page {
    margin: 2rem 0;
}

.detail-container {
    display: flex;
    gap: 2rem;
}

.detail-content {
    flex-grow: 1;
}

.formula-detail {
    background-color: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.formula-intro {
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 1.5rem 0 2rem;
    padding: 1rem;
    background-color: #f9f7f1;
    border-left: 4px solid #8b5a2b;
}

.formula-intro p {
    font-size: inherit;
    line-height: inherit;
    margin-bottom: 0.8rem;
}

/* 古籍文献部分样式 */
.literature-section {
    margin-bottom: 3rem;
}

.literature-item {
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

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

.literature-header {
    margin-bottom: 1.5rem;
}

.literature-content {
    padding-left: 1rem;
}

.literature-info-section {
    margin-bottom: 1.5rem;
}

.literature-info-section p {
    margin-bottom: 0.8rem;
}

.ingredients-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.ingredient-item {
    background-color: #f9f7f1;
    padding: 0.8rem;
    border-radius: 6px;
    text-align: center;
}

.ingredient-name {
    font-weight: bold;
    margin-bottom: 0.3rem;
    color: #5a3d2b;
}

.ingredient-amount {
    color: #666;
    font-size: 0.9rem;
}

/* 目录样式 */
.toc {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 90px;
}

.toc h3 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.toc-links {
    list-style: none;
}

.toc-links li {
    margin-bottom: 0.8rem;
}

.toc-links a {
    display: block;
    padding: 5px 0;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 15px;
}

.toc-links a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #8b5a2b;
    opacity: 0.6;
}

.toc-links a:hover {
    padding-left: 20px;
    color: #8b5a2b;
}

.toc-section {
    margin-bottom: 1.5rem;
    max-height: 500px;
    overflow: auto;
}

.toc-section-title {
    font-weight: bold;
    margin-bottom: 0.8rem;
    color: #5a3d2b;
    font-size: 1.1rem;
}

/* 联系我们区域 */
.contact-section {
    background-color: #5a3d2b;
    color: white;
    padding: 5rem 0;
    text-align: center;
    margin: 4rem 0;
}

.contact-section h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: none;
}

.contact-section p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}

.contact-btn {
    background-color: white;
    color: #5a3d2b;
    font-weight: bold;
    padding: 12px 30px;
    font-size: 1.1rem;
}

.contact-btn:hover {
    background-color: #f1ede4;
}

/* 页脚样式 */
footer {
    background-color: #3a2a1e;
    color: white;
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.footer-logo span {
    color: #8fbc8f;
}

.footer-description {
    color: #ccc;
    margin-bottom: 1rem;
}

.footer-section h3 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: #8fbc8f;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #ccc;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.contact-info {
    color: #ccc;
}

.contact-info p {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
}

.contact-info i {
    margin-right: 10px;
    color: #8fbc8f;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transition: background-color 0.3s ease;
}

.social-links a:hover {
    background-color: #8fbc8f;
}

.copyright {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 992px) {

    .main-content,
    .detail-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: -1;
    }

    .toc-container {
        order: 1;
        margin-top: 2rem;
    }

    .toc {
        position: static;
    }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%;
        flex-direction: column;
        background-color: white;
        width: 100%;
        height: calc(100vh - 70px);
        padding: 2rem;
        transition: left 0.3s ease;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    }

    .nav-links.active {
        left: 0;
    }

    .nav-links li {
        margin: 0 0 1.5rem 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .formula-list,
    .ingredients-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .page-title,
    h1 {
        font-size: 2rem;
    }

    .formula-detail {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .footer-content {
        grid-template-columns: 1fr;
    }

    .contact-section h2 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}

/* 分页 */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.pagination-info {
    color: #666;
    font-size: 0.95rem;
}

.pagination {
    display: flex;
    list-style: none;
    margin: 0 1rem;
    padding: 0;
}

.pagination-item {
    margin: 0 4px;
}

.pagination-link {
    display: inline-block;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    border-radius: 4px;
    color: #5a3d2b;
    background-color: #f9f7f1;
    transition: all 0.3s ease;
}

.pagination-link:hover {
    background-color: #e8e0ce;
    color: #8b5a2b;
}

.pagination-item.active .pagination-link {
    background-color: #8b5a2b;
    color: white;
    font-weight: bold;
}

.pagination-item.disabled .pagination-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-item.ellipsis {
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: #999;
}

.pagination-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.jump-input {
    width: 50px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.jump-btn {
    padding: 8px 16px;
    background-color: #8b5a2b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.jump-btn:hover {
    background-color: #6d4421;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .pagination-container {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .pagination-info,
    .pagination-jump {
        width: 100%;
        text-align: center;
    }

    .pagination {
        margin: 0 auto;
    }
}

@media (max-width: 576px) {
    .pagination-item:not(.active):not(:first-child):not(:last-child):not(.ellipsis) {
        display: none;
    }

    .pagination-item:nth-child(2),
    .pagination-item:nth-child(3),
    .pagination-item:nth-last-child(3),
    .pagination-item:nth-last-child(2) {
        display: block;
    }
}


/* 面包屑 */

nav[aria-label='breadcrumb'] ol {
    list-style: none;
    padding: 0;
    word-break: break-all;
}

nav[aria-label='breadcrumb'] ol li {
    display: inline;
}

/* 关于作者 */

.author-module {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.author-module h3 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    color: #5a3d2b;
}

.author-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.author-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 3px solid #f1ede4;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-info {
    text-align: center;
    width: 100%;
}

.author-name {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    color: #5a3d2b;
}

.author-title {
    color: #7d5a29;
    font-style: italic;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.author-bio {
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 1rem;
}

.author-bio p {
    margin-bottom: 0.8rem;
}

.author-works {
    text-align: left;
    width: 100%;
}

.author-works h5 {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #5a3d2b;
}

.author-works + .author-works {
    margin-top: 1rem;
}

.works-list {
    list-style-position: inside;
    font-size: 0.95rem;
    color: #555;
}

.works-list li {
    margin-bottom: 0.3rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .author-profile {
        flex-direction: column;
        text-align: center;
    }

    .author-avatar {
        margin: 0 auto 1rem;
    }

    .author-bio,
    .author-works {
        text-align: center;
    }

    .works-list {
        list-style-type: none;
        padding: 0;
    }
}

.go_about {
    display: block;
    cursor: pointer;
    background-color: #8b5a2b;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    font-size: 1rem;
    margin-top: 10px;
}

.ry_container {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 1.3rem;
    margin-bottom: 0.8rem;
}

.ry_container img {
    width: 100%;
}