/* ===============================================================
   40D诗词园 - 主样式表
   优化：提取所有内联 CSS 到这里，浏览器可缓存
   =============================================================== */

/* ── Reset & Base ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{background:#f8f5f0;font-family:"Microsoft YaHei","PingFang SC",sans-serif;color:#333;line-height:1.6;display:flex;flex-direction:column;min-height:100vh}
.main-content{flex:1}
a{color:#8b4513;text-decoration:none}
a:hover{color:#6b3410}
img{max-width:100%}

/* ── Layout ── */
.container{max-width:1140px;margin:0 auto;padding:0 15px}
.row{display:flex;flex-wrap:wrap;margin:0 -10px}
[class*="col-"]{padding:0 10px;box-sizing:border-box}
.col-4{width:33.333%}.col-6{width:50%}.col-12{width:100%}
.col-c7{width:14.285%}.col-c2{width:50%}
@media(min-width:768px){.col-md-2{width:16.666%}.col-md-3{width:25%}.col-md-6{width:50%}.col-md-9{width:75%}}
@media(min-width:992px){.col-lg-4{width:33.333%}}

/* ── Utility ── */
.text-center{text-align:center}.text-start{text-align:left}.text-muted{color:#999}
.d-block{display:block}.d-none{display:none}.small{font-size:.85em}
.mx-1{margin-left:.25rem;margin-right:.25rem}
.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:1rem}.mt-4{margin-top:1.5rem}.mt-5{margin-top:3rem}
.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:1rem}.mb-4{margin-bottom:1.5rem}.mb-5{margin-bottom:3rem}
.py-3{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:3rem;padding-bottom:3rem}
.p-3{padding:1rem}.p-4{padding:1.5rem}
.w-100{width:100%}

/* ── Navbar ── */
.navbar{background:#2c1810;color:#fff;padding:0.6rem 0}
.navbar>.container{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}
.navbar-brand{font-weight:bold;font-size:1.4rem;letter-spacing:2px;color:#fff!important;white-space:nowrap}
.navbar-links{display:flex;align-items:center;gap:0.5rem;flex-wrap:wrap}
.navbar-links a{color:#ccc!important;padding:0.4rem 0.6rem;font-size:0.95rem;border-radius:4px;transition:color 0.2s}
.navbar-links a:hover{color:#fff!important}
@media(max-width:767px){.navbar-links{width:100%;margin-top:0.5rem;justify-content:center}}

/* ── Cards ── */
.card{background:#fff;border:1px solid #e8d5c4;border-radius:8px;overflow:hidden}
.card-body{padding:1.25rem}
.list-group{border:1px solid #e8d5c4;border-radius:8px;overflow:hidden}
.list-group-item{display:block;padding:0.75rem 1rem;background:#fff;border-bottom:1px solid #e8d5c4;color:#8b4513;transition:background 0.2s}
.list-group-item:last-child{border-bottom:none}
.list-group-item:hover{background:#fdf6ee}
.list-group-item.active{background:#8b4513!important;color:#fff!important;border-color:#8b4513!important}

/* ── Poem Card ── */
.poem-card{background:#fff;border:1px solid #e8d5c4;border-radius:8px;padding:1.25rem;margin-bottom:1rem;display:block;color:inherit!important;transition:all 0.2s}
.poem-card:hover{box-shadow:0 4px 20px rgba(0,0,0,.1);border-color:#c9a87c}
.poem-title{font-size:1.15rem;font-weight:bold;color:#8b4513;margin-bottom:0.5rem}
.poem-lines{font-size:.95rem;color:#555;line-height:1.8;margin-bottom:.5rem}
.poem-meta{font-size:.85rem;color:#999}

/* ── Hero ── */
.hero-section{background:linear-gradient(135deg,#2c1810 0%,#4a2c17 50%,#6b3a2a 100%);color:#fff;padding:3rem 0;margin-bottom:2rem;text-align:center}
.hero-section h1{font-size:2.5rem;letter-spacing:4px;margin-bottom:.5rem}
.hero-section .lead{opacity:.8;margin-bottom:1rem}
.search-box{max-width:500px;margin:1.5rem auto 0}
.input-group{display:flex}
.input-group .form-control{flex:1;padding:0.6rem 1rem;border:1px solid #e8d5c4;border-radius:6px 0 0 6px;font-size:1rem;outline:none}
.input-group .form-control:focus{border-color:#c9a87c}
.input-group button{padding:0.6rem 1.2rem;border:none;background:#8b4513;color:#fff;border-radius:0 6px 6px 0;cursor:pointer;font-size:1rem}
.input-group button:hover{background:#6b3410}
.form-control{display:block;width:100%;padding:0.6rem 0.8rem;border:1px solid #e8d5c4;border-radius:6px;font-size:1rem;margin-bottom:0.8rem;outline:none}
.form-control:focus{border-color:#c9a87c}
.form-label{display:block;margin-bottom:0.3rem;color:#666;font-size:0.9rem}

/* ── Stats ── */
.stat-card{background:#fff;border-radius:8px;padding:1rem;text-align:center;border:1px solid #e8d5c4;margin-bottom:1rem}
.stat-card .number{font-size:1.5rem;font-weight:bold;color:#8b4513}
.stat-card .label{font-size:.85rem;color:#999}

/* ── Tags ── */
.category-tag{display:inline-block;background:#f0e6d8;color:#8b4513!important;padding:0.2rem 0.6rem;border-radius:4px;font-size:.85rem;margin:0.15rem}
.category-tag:hover{background:#e0cfb8}

/* ── Buttons ── */
.btn{display:inline-block;padding:0.6rem 1.5rem;border:1px solid #8b4513;border-radius:6px;cursor:pointer;font-size:1rem;transition:all 0.2s;text-align:center}
.btn-chinese{background:#8b4513;color:#fff;border-color:#8b4513}
.btn-chinese:hover{background:#6b3410}
.btn-outline-chinese{background:transparent;color:#8b4513}
.btn-outline-chinese:hover{background:#8b4513;color:#fff}
.btn-outline-danger{background:transparent;color:#dc3545;border-color:#dc3545}
.btn-outline-danger:hover{background:#dc3545;color:#fff}
.btn-danger{background:#dc3545;color:#fff;border-color:#dc3545}
.btn-danger:hover{background:#bb2d3b}

/* ── Alert ── */
.alert{padding:0.75rem 1rem;border-radius:6px;margin-bottom:1rem}
.alert-danger{background:#f8d7da;color:#842029;border:1px solid #f5c2c7}

/* ── Breadcrumb ── */
.breadcrumb{display:flex;flex-wrap:wrap;padding:0.5rem 0;list-style:none;font-size:.9rem}
.breadcrumb-item+.breadcrumb-item::before{content:"/";padding:0 .5rem;color:#999}
.breadcrumb-item.active{color:#666}

/* ── Pagination ── */
.pagination{display:flex;flex-wrap:wrap;justify-content:center;gap:0.3rem;list-style:none;padding:0}
.page-item .page-link{display:block;padding:0.4rem 0.8rem;border:1px solid #e8d5c4;border-radius:4px;color:#8b4513;font-size:.9rem}
.page-item .page-link:hover{background:#f0e6d8}
.page-item.active .page-link{background:#8b4513;color:#fff;border-color:#8b4513}

/* ── Poem Detail ── */
.poem-detail-card{background:#fff;border:1px solid #e8d5c4;border-radius:10px;padding:2.5rem;max-width:700px;margin:2rem auto}
.poem-detail-title{font-size:1.6rem;color:#8b4513;text-align:center;margin-bottom:.3rem}
.poem-detail-author{text-align:center;color:#999;margin-bottom:1.5rem}
.poem-detail-author a{color:#8b4513}
.poem-detail-content{font-size:1.25rem;line-height:2.2;text-align:center;color:#333}
.poem-detail-content p{margin-bottom:.4rem}

/* ── AI Analysis Section ── */
.ai-analysis-section{max-width:700px;margin:2rem auto}
.ai-analysis-section h2{color:#8b4513;margin-bottom:1rem}
.ai-analysis-section h3{color:#8b4513;font-size:0.9rem;margin:1rem 0 0.3rem}
.ai-analysis-section .analysis-block p{line-height:1.8;color:#333;font-size:0.95rem}
.ai-disclaimer{font-size:0.82rem;color:#999;margin-top:1rem}

/* ── Related Poems ── */
.related-poems{max-width:700px;margin:2rem auto}
.related-poems h2{color:#8b4513;margin-bottom:1rem}
.related-poems h3{font-size:0.9rem;color:#666;margin-bottom:0.5rem}
.related-group{margin-bottom:1.5rem}

/* ── Social Share ── */
.social-share{max-width:700px;margin:1.5rem auto;text-align:center}
.social-share h3{color:#8b4513;margin-bottom:0.5rem}
.share-btn{display:inline-block;padding:0.4rem 1rem;margin:0.2rem;border-radius:6px;border:1px solid #e8d5c4;background:#fff;color:#8b4513;cursor:pointer;font-size:0.9rem;transition:all 0.2s}
.share-btn:hover{background:#f0e6d8;border-color:#c9a87c}

/* ── Dynasty Page ── */
.dynasty-intro{max-width:700px;margin:1rem auto 2rem;padding:1.5rem;background:#fff;border:1px solid #e8d5c4;border-radius:8px;line-height:1.8}
.dynasty-intro h2{color:#8b4513;margin-bottom:0.5rem}
.dynasty-tag{display:inline-block;background:#2c1810;color:#fff!important;padding:0.4rem 1rem;border-radius:6px;font-size:0.95rem;margin:0.3rem}
.dynasty-tag:hover{background:#4a2c17}

/* ── Footer ── */
.footer{background:#2c1810;color:#aaa;padding:2rem 0;margin-top:3rem}

/* ── Dropdown ── */
.dropdown{position:relative;display:inline-block}
.dropdown-toggle{cursor:pointer}
.dropdown-menu{display:none;position:absolute;right:0;top:100%;min-width:150px;background:#fff;border:1px solid #e8d5c4;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.1);z-index:1000;padding:.5rem 0}
.dropdown-menu a{display:block;padding:.5rem 1rem;color:#333!important;font-size:.9rem}
.dropdown-menu a:hover{background:#fdf6ee}
.dropdown-menu hr{margin:.25rem 0;border:none;border-top:1px solid #e8d5c4}
.dropdown:focus-within .dropdown-menu,.dropdown:hover .dropdown-menu{display:block}
.nav-link{padding:.4rem .6rem;color:#ccc!important;font-size:.95rem;border-radius:4px;display:inline-block}
.nav-link:hover{color:#fff!important}
.lang-switch{font-size:.85rem}

/* ── Animations ── */
@keyframes pulse{0%,100%{opacity:.5}50%{opacity:1}}
.loading{animation:pulse 1.5s ease-in-out infinite;color:#aaa}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes ai-glow{0%,100%{box-shadow:0 0 8px rgba(139,69,19,.15)}50%{box-shadow:0 0 20px rgba(139,69,19,.35)}}

/* ── Tag Cloud ── */
.tag-cloud{margin:1rem 0;line-height:2.2}
.tag-cloud a{display:inline-block;margin:0 0.3rem;color:#8b4513;transition:color 0.2s}
.tag-cloud a:hover{color:#6b3410}

/* ── Print Styles ── */
@media print {
  .navbar,.footer,.breadcrumb,.social-share{display:none}
  body{background:#fff}
  .poem-detail-card{border:none;box-shadow:none}
}
