/* themes/default/css/style.css - V6.2 首页修复版 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@300;500;700&family=Ma+Shan+Zheng&family=Long+Cang&display=swap');
@import url('https://npm.elemecdn.com/lxgw-wenkai-screen-webfont/style.css');

:root {
    --c-primary: #2B6E75;     
    --c-secondary: #589A9E;   
    --c-bg: #F0F7F7;          
    --c-card: #FFFFFF;        
    --c-gold: #D4AF37;        
    --c-ink: #1F2D30;
    --c-text: #1F2D30;        
    --c-text-light: #7A8C8F;  
    --radius: 12px;
    --top-height: 46px;
    --cb-bg: #E0E5E5;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    background: var(--c-bg); color: var(--c-text);
    font-family: -apple-system, "LXGW WenKai Screen", "Noto Serif SC", serif; line-height: 1.7;
    background-color: #F0F7F7;
    min-height: 100vh; display: flex; flex-direction: column;
    overflow-x: hidden; width: 100vw; padding-top: 0;
}
a { text-decoration: none; color: inherit; transition: 0.3s; }
.container { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 15px; flex: 1; overflow: hidden; position: relative; z-index: 1; }

/* 字体工具类 */
.font-song { font-family: "Noto Serif SC", serif !important; }
.font-kai { font-family: "LXGW WenKai Screen", serif !important; }
.font-cao { font-family: "Long Cang", cursive !important; }
.font-ma { font-family: "Ma Shan Zheng", cursive !important; }

/* 顶部工具栏 */
.top-bar { position: relative; width: 100%; height: var(--top-height); background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-secondary) 100%); color: rgba(255,255,255,0.9); z-index: 100; box-shadow: 0 2px 8px rgba(43, 110, 117, 0.15); font-size: 0.9rem; }
.top-bar-inner { width: 100%; max-width: 1000px; margin: 0 auto; height: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0 15px; }
.top-left, .top-right { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
.top-center { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: 0.85; font-size: 0.85rem; font-family: "LXGW WenKai Screen", serif; letter-spacing: 1px; padding: 0 15px; font-weight: bold; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.top-link { display: flex; align-items: center; gap: 5px; cursor: pointer; opacity: 0.9; transition: 0.2s; color: #fff; }
.top-link:hover { opacity: 1; text-shadow: 0 0 5px rgba(255,255,255,0.5); }
.top-link i { font-size: 1.2rem; }

/* 品牌栏 */
.navbar { position: relative; height: auto; padding: 30px 0 20px; display: flex; justify-content: center; align-items: center; }
.brand-box { text-align: center; display: flex; flex-direction: column; align-items: center; }
.brand-title { font-family: 'Ma Shan Zheng', cursive; font-size: 2.2rem; background: linear-gradient(to bottom, var(--c-primary), var(--c-secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.2; }
.brand-subtitle { font-size: 0.8rem; color: var(--c-text-light); margin-top: 6px; opacity: 0.8; letter-spacing: 3px; font-family: "LXGW WenKai Screen", serif; }

/* UI 组件 */
.btn-pill { font-size: 0.85rem; padding: 5px 14px; background: rgba(255,255,255,0.8); border: 1px solid rgba(43, 110, 117, 0.15); border-radius: 20px; color: var(--c-text-light); display: inline-flex; align-items: center; gap: 4px; transition: all 0.2s; height: 32px; line-height: 1; cursor: pointer; white-space: nowrap; }
.btn-pill:active, .btn-pill.active, .btn-pill:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); box-shadow: 0 2px 8px rgba(43,110,117,0.2); }
.text-btn { background: transparent; border: none; color: var(--c-text-light); font-size: 0.9rem; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.text-btn:hover, .text-btn.active { color: var(--c-primary); }
.text-btn i { font-size: 1.3rem; }

/* 搜索栏 */
.search-wrap { margin-bottom: 20px; width: 100%; }
.search-group { 
    display: flex; align-items: center; width: 100%; background: #fff; 
    border: 1px solid rgba(120, 168, 148, 0.4); border-radius: 30px; 
    padding: 2px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); overflow: hidden;
}
.search-select { 
    border: none; background: transparent; font-size: 0.9rem; color: var(--c-primary); 
    font-weight: bold; padding: 8px 0 8px 12px; border-right: 1px solid #eee; 
    outline: none; cursor: pointer; min-width: 70px; text-align: center; text-align-last: center; appearance: none; 
}
.search-input { 
    flex: 1; border: none !important; background: transparent !important; 
    padding: 8px 12px; font-family: "Noto Serif SC"; font-size: 1rem; 
    color: var(--c-text); outline: none; box-shadow: none !important; text-align: left; min-width: 0; 
}
.search-btn {
    background: var(--c-primary); border: none; color: #fff;
    width: 36px; height: 36px; border-radius: 50%; 
    margin-right: 2px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.search-btn:active { transform: scale(0.9); }

.search-result-bar { background: var(--c-primary); color: #fff; padding: 10px 15px; border-radius: 12px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 4px 12px rgba(61, 110, 95, 0.2); font-size: 0.95rem; width: 100%; box-sizing: border-box; }
.result-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.result-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; display: block; max-width: 100%; }
.result-close { flex-shrink: 0; opacity: 0.8; padding: 5px; cursor: pointer; }

/* 聚合板块 */
.unified-section { background: rgba(255,255,255,0.85); padding: 15px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; border: 1px solid rgba(255,255,255,0.9); width: 100%; }
.index-group { margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px dashed rgba(0,0,0,0.05); }
.index-group:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.group-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.group-title { font-size: 0.95rem; color: var(--c-primary); font-weight: bold; }
.group-toggle { font-size: 0.8rem; color: var(--c-text-light); cursor: pointer; }
.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; transition: max-height 0.3s ease-out; overflow: hidden; }
.cat-grid.collapsed { max-height: 34px; position: relative; }
.cat-grid.collapsed::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 34px; background: linear-gradient(to right, transparent 70%, rgba(255,255,255,0.9) 90%, #fff 100%); pointer-events: none; }

/* 每日推荐卡片 (轮播) */
.carousel-container { position: relative; height: 240px; border-radius: var(--radius); margin-bottom: 25px; box-shadow: 0 10px 25px rgba(61, 110, 95, 0.15); overflow: hidden; width: 100%; }
.daily-card { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background: linear-gradient(150deg, var(--c-primary) 0%, var(--c-secondary) 100%); 
    padding: 20px 25px; color: #fff; opacity: 0; transition: opacity 0.6s ease; 
    pointer-events: none; z-index: 1; box-sizing: border-box; 
}
.daily-card:not(.active) { position: relative; opacity: 1; pointer-events: auto; }
.daily-card.active { opacity: 1; pointer-events: auto; z-index: 2; position: absolute; }

.daily-card::before { content: ''; position: absolute; bottom: -30px; right: -30px; width: 150px; height: 150px; background: rgba(255,255,255,0.1); border-radius: 50%; pointer-events: none; }
.daily-tag { position: absolute; top: 20px; right: 20px; background: rgba(255,255,255,0.2); font-size: 0.75rem; padding: 2px 8px; border-radius: 10px; }

/* [修复] 标题单行截断 */
.daily-title { 
    font-size: 1.4rem; font-weight: bold; margin-bottom: 5px; padding-right: 50px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* [修复] 正文4行截断 */
.daily-content { 
    font-size: 1rem; line-height: 1.8; opacity: 0.9; margin-top: 15px; 
    border-left: 3px solid var(--c-gold); padding-left: 12px; 
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; 
}

.daily-footer { position: absolute; bottom: 20px; right: 25px; z-index: 5; }
.daily-footer a { color: #fff; border-bottom: 1px solid rgba(255,255,255,0.5); font-size: 0.85rem; }
.carousel-dots { position: absolute; bottom: 15px; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.dot { width: 6px; height: 6px; background: rgba(255,255,255,0.4); border-radius: 50%; pointer-events: auto; cursor: pointer; }
.dot.active { background: #fff; width: 12px; border-radius: 3px; }

/* 4. 诗词列表 */
.poem-list { display: grid; gap: 15px; width: 100%; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.poem-card { background: #fff; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); transition: 0.2s; width: 100%; box-sizing: border-box; position: relative; overflow: hidden; z-index: 1; }
.poem-card::before { content: ''; position: absolute; bottom: 0; right: 0; width: 70%; height: 100px; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 100' preserveAspectRatio='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,100 L0,100 Q50,100 100,80 T200,40 L300,10 L300,100 Z' fill='%233D6E5F' fill-opacity='0.06'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: bottom right; background-size: cover; pointer-events: none; z-index: -1; }
.poem-card:active { transform: scale(0.99); }
.card-title { 
    font-size: 1.2rem; font-weight: bold; color: var(--c-primary); margin-bottom: 5px; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    padding-right: 10px; 
}
.card-meta-below { font-size: 0.85rem; color: var(--c-text-light); margin-bottom: 10px; }
.card-preview { font-size: 1rem; color: #555; line-height: 1.6; text-align: justify; }

/* 通用截断类 */
.line-clamp-1 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.line-clamp-4 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }

/* 5. 分页 & Footer */
.pagination { display: flex; justify-content: center; gap: 20px; margin: 30px 0; }
.footer { text-align: center; padding: 40px 20px; color: #99A6A3; font-size: 0.8rem; margin-top: auto; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; justify-content: center; align-items: flex-end; opacity: 0; visibility: hidden; transition: 0.3s; backdrop-filter: blur(4px); }
.modal-overlay.show { opacity: 1; visibility: visible; }
.ai-fab { position: fixed; bottom: 30px; right: 20px; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #2B6E75 0%, #1F2D30 100%); box-shadow: 0 4px 15px rgba(43,110,117,0.3); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 28px; cursor: pointer; z-index: 90; transition: transform 0.2s; }

/* 手机端适配 */
@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .top-center { display: block; font-size: 0.8rem; } 
    .top-bar-inner { padding: 0 10px; }
    .poem-list { grid-template-columns: 1fr 1fr; gap: 10px; }
    .poem-card { padding: 15px; }
    .card-title { font-size: 1.05rem; }
    .card-meta-below { font-size: 0.75rem; margin-bottom: 6px; }
    /* 列表卡片正文也使用 clamp */
    .card-preview { font-size: 0.9rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}