/* ==========================================
   Chinglish Lab - Frontend Styles
   ========================================== */

/* Reset & Variables */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --red: #e74c3c; --red-dark: #c0392b; --red-light: #fadbd8;
    --gold: #f1c40f; --gold-light: #fef9e7;
    --dark: #1a1a2e; --dark2: #2c3e50;
    --gray: #7f8c8d; --gray-light: #ecf0f1; --bg: #fafafa;
    --white: #ffffff; --radius: 12px;
    --shadow: 0 2px 16px rgba(0,0,0,0.06);
    --font: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--dark2); line-height: 1.7; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* Header */
.header { background: var(--white); border-bottom: 1px solid var(--gray-light); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1140px; margin: 0 auto; padding: 14px 24px; }
.logo { font-size: 1.4rem; font-weight: 800; color: var(--red); display: flex; align-items: center; gap: 8px; }
.logo span { color: var(--dark2); }
.badge { font-size: 0.6rem; font-weight: 600; background: var(--gold); color: var(--dark2); padding: 2px 8px; border-radius: 6px; margin-left: 4px; }
.nav { display: flex; gap: 28px; align-items: center; }
.nav a { font-size: 0.92rem; font-weight: 500; color: var(--dark2); transition: color 0.2s; }
.nav a:hover { color: var(--red); }
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.hamburger span { width: 26px; height: 3px; background: var(--dark2); border-radius: 2px; }

/* Search Form in Header */
.search-form { display: flex; align-items: center; gap: 0; position: relative; }
.search-input { width: 200px; padding: 10px 40px 10px 16px; border: 1.5px solid var(--gray-light); border-radius: 24px; font-size: 0.9rem; outline: none; transition: all 0.25s; font-family: inherit; background: #f8f9fa; color: var(--dark2); }
.search-input::placeholder { color: #aaa; font-size: 0.85rem; }
.search-input:focus { width: 250px; border-color: var(--red); background: #fff; box-shadow: 0 0 0 3px rgba(231,76,60,0.08); }
.search-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 1rem; cursor: pointer; padding: 8px; opacity: 0.5; transition: opacity 0.2s; line-height: 1; }
.search-btn:hover { opacity: 1; }

@media (max-width: 768px) {
    .search-form { display: none; }
}

/* Search Results Page */
.search-page { padding: 40px 0; }
.search-page h1 { font-size: 1.6rem; margin-bottom: 20px; }
.search-page .search-again { margin-bottom: 30px; }
.search-page .search-again input { width: 100%; max-width: 520px; padding: 14px 20px; border: 2px solid var(--gray-light); border-radius: 28px; font-size: 1.05rem; outline: none; font-family: inherit; transition: all 0.25s; background: #f8f9fa; }
.search-page .search-again input:focus { border-color: var(--red); background: #fff; box-shadow: 0 0 0 4px rgba(231,76,60,0.08); }
.search-result-section { margin-bottom: 40px; }
.search-result-section h2 { font-size: 1.2rem; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--gray-light); }
.search-result-section .empty { color: var(--gray); font-size: 0.95rem; }
.search-result-item { padding: 14px 18px; background: var(--white); border-radius: var(--radius); margin-bottom: 10px; border: 1px solid var(--gray-light); transition: all 0.2s; }
.search-result-item:hover { border-color: var(--red-light); }
.search-result-item .result-title { font-size: 1.05rem; font-weight: 700; color: var(--dark2); }
.search-result-item .result-title:hover { color: var(--red); }
.search-result-item .result-snippet { font-size: 0.88rem; color: var(--gray); margin-top: 4px; line-height: 1.5; }
.search-result-item .result-meta { font-size: 0.78rem; color: var(--gray); margin-top: 6px; }
mark { background: #fff3cd; padding: 0 2px; border-radius: 2px; }

/* Hero */
.hero { background: linear-gradient(135deg, #1a1a2e 0%, #2c3e50 50%, #e74c3c 100%); color: #fff; padding: 80px 0 70px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle at 30% 50%, rgba(241,196,15,0.08) 0%, transparent 60%); }
.hero-content { position: relative; }
.hero .subtitle { display: inline-block; background: rgba(255,255,255,0.12); padding: 6px 18px; border-radius: 20px; font-size: 0.82rem; font-weight: 500; margin-bottom: 20px; }
.hero h1 { font-size: 3rem; font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.hero h1 .highlight { color: var(--gold); }
.hero p { font-size: 1.15rem; opacity: 0.88; max-width: 640px; margin: 0 auto 32px; line-height: 1.7; }
.hero-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-primary, .btn-secondary { padding: 14px 34px; border-radius: 10px; font-weight: 700; font-size: 1rem; transition: all 0.2s; display: inline-block; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); background: var(--red-dark); }
.btn-secondary { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.btn-secondary:hover { background: rgba(255,255,255,0.2); }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 40px; padding-top: 35px; border-top: 1px solid rgba(255,255,255,0.12); }
.hero-stats .stat { text-align: center; }
.hero-stats .stat .num { font-size: 1.6rem; font-weight: 800; }
.hero-stats .stat .lbl { font-size: 0.82rem; opacity: 0.7; margin-top: 2px; }

/* Section */
.section { padding: 60px 0; }
.section-header { text-align: center; margin-bottom: 40px; }
.section-header h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 10px; }
.section-header p { color: var(--gray); max-width: 560px; margin: 0 auto; font-size: 1rem; }
.bg-white { background: var(--white); }

/* Featured Card */
.featured-card { background: linear-gradient(135deg, var(--white), #fff8f0); border: 2px solid var(--gold-light); border-radius: 16px; padding: 36px; text-align: center; max-width: 600px; margin: 0 auto; box-shadow: var(--shadow); }
.featured-card .label { display: inline-block; background: var(--gold); color: var(--dark2); padding: 4px 16px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; margin-bottom: 18px; }
.featured-card .phrase { font-size: 2rem; font-weight: 800; color: var(--red); margin-bottom: 6px; }
.featured-card .meaning { font-size: 1.1rem; color: var(--dark2); margin-bottom: 14px; }
.featured-card .origin { font-size: 0.9rem; color: var(--gray); line-height: 1.6; }
.featured-card .cta-link { display: inline-block; margin-top: 16px; color: var(--red); font-weight: 600; font-size: 0.92rem; }
.featured-card .cta-link:hover { text-decoration: underline; }

/* Category Grid */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cat-card { background: var(--white); border-radius: var(--radius); padding: 24px 20px; text-align: center; box-shadow: var(--shadow); transition: transform 0.2s; cursor: default; border: 1px solid var(--gray-light); }
.cat-card:hover { transform: translateY(-3px); }
.cat-card .emoji { font-size: 2rem; margin-bottom: 8px; }
.cat-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.cat-card .count { font-size: 0.82rem; color: var(--gray); }
.cat-card a { display: block; }

/* Trending Grid */
.trending-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.trend-card { background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--gray-light); transition: all 0.2s; }
.trend-card:hover { border-color: var(--red-light); }
.trend-card .en { font-size: 1.1rem; font-weight: 700; color: var(--red); }
.trend-card .cn { font-size: 0.88rem; color: var(--gray); margin: 4px 0 8px; }
.trend-card .meaning-text { font-size: 0.88rem; color: var(--dark2); line-height: 1.5; }
.trend-card .tag-hot { display: inline-block; background: var(--red-light); color: var(--red-dark); font-size: 0.7rem; font-weight: 600; padding: 2px 10px; border-radius: 10px; margin-bottom: 8px; }
.trend-card a { display: block; }

/* Trivia */
.trivia-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.trivia-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border-left: 4px solid var(--gold); }
.trivia-card:first-child { background: linear-gradient(135deg, var(--gold-light), var(--white)); }
.trivia-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.trivia-card p { font-size: 0.9rem; color: var(--gray); line-height: 1.6; }

/* CTA Section */
.cta-section { background: linear-gradient(135deg, var(--dark), #16213e); color: #fff; text-align: center; padding: 60px 0; }
.cta-section h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 12px; }
.cta-section p { opacity: 0.8; max-width: 500px; margin: 0 auto 28px; font-size: 1rem; }
.cta-btn { display: inline-block; background: var(--red); color: #fff; padding: 14px 40px; border-radius: 10px; font-weight: 700; font-size: 1.05rem; }
.cta-btn:hover { background: var(--red-dark); }

/* Footer */
.footer { background: #111; color: rgba(255,255,255,0.6); padding: 40px 0; text-align: center; font-size: 0.85rem; }
.footer .links { display: flex; gap: 20px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.footer .links a { color: rgba(255,255,255,0.7); }
.footer .links a:hover { color: #fff; }

/* ===== Browse / Category Pages ===== */
.page-header { padding: 50px 0 30px; text-align: center; background: linear-gradient(135deg, #1a1a2e, #2c3e50); color: #fff; }
.page-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.page-header p { opacity: 0.8; font-size: 1rem; }
.breadcrumb { font-size: 0.85rem; margin-bottom: 12px; opacity: 0.7; }
.breadcrumb a { color: var(--gold); }
.breadcrumb a:hover { text-decoration: underline; }

.phrase-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.phrase-item { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--gray-light); transition: all 0.2s; }
.phrase-item:hover { border-color: var(--red-light); }
.phrase-item .en { font-size: 1.15rem; font-weight: 700; color: var(--red); }
.phrase-item .cn { font-size: 0.9rem; color: var(--gray); margin: 4px 0; }
.phrase-item .excerpt { font-size: 0.88rem; color: var(--dark2); margin-top: 6px; }

/* Phrase Detail */
.phrase-detail { background: var(--white); border-radius: 16px; padding: 40px; box-shadow: var(--shadow); margin: 30px 0; }
.phrase-detail .phrase-big { font-size: 2.2rem; font-weight: 800; color: var(--red); margin:0; }
.phrase-detail .phrase-cn-big { font-size: 1.2rem; color: var(--gray); margin: 6px 0 20px; }
.phrase-detail .section-title { font-size: 1rem; font-weight: 700; color: var(--dark2); margin: 20px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--gray-light); }
.phrase-detail .section-body { font-size: 0.95rem; color: var(--dark2); line-height: 1.8; }
.phrase-detail .example-box { background: #f8f9fa; border-left: 3px solid var(--red); padding: 16px 20px; border-radius: 8px; font-size: 0.92rem; line-height: 1.6; white-space: pre-line; }

/* Blog */
.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.post-card { background: var(--white); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--gray-light); }
.post-card .post-cat { font-size: 0.78rem; color: var(--red); font-weight: 600; text-transform: uppercase; }
.post-card h2 { font-size: 1.2rem; font-weight: 700; margin: 6px 0; }
.post-card h2 a { color: var(--dark2); }
.post-card h2 a:hover { color: var(--red); }
.post-card .post-meta { font-size: 0.82rem; color: var(--gray); margin-bottom: 10px; }
.post-card .post-excerpt { font-size: 0.92rem; color: var(--dark2); line-height: 1.6; }
.post-card .read-more { color: var(--red); font-weight: 600; font-size: 0.9rem; display: inline-block; margin-top: 10px; }

/* Related Post Grid - 2 columns, 5 rows */
.related-post-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.related-post-card { background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--gray-light); transition: all 0.2s; }
.related-post-card:hover { border-color: var(--red-light); }
.related-post-card .post-cat { font-size: 0.78rem; color: var(--red); font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.related-post-card h3 { font-size: 1rem; font-weight: 700; margin: 4px 0 8px; line-height: 1.4; }
.related-post-card h3 a { color: var(--dark2); }
.related-post-card h3 a:hover { color: var(--red); }
.related-post-card .post-excerpt { font-size: 0.88rem; color: var(--gray); line-height: 1.5; }
.related-post-card .read-more { color: var(--red); font-weight: 600; font-size: 0.85rem; display: inline-block; margin-top: 8px; }

@media (max-width: 640px) {
    .related-post-grid { grid-template-columns: 1fr; }
}

/* Post Detail */
.post-detail { background: var(--white); border-radius: 16px; padding: 40px; box-shadow: var(--shadow); margin: 30px 0; }
.post-detail h1 { font-size: 2rem; font-weight: 800; margin-bottom: 10px; }
.post-detail .post-meta { color: var(--gray); font-size: 0.9rem; margin-bottom: 25px; }
.post-detail .post-content { font-size: 1rem; line-height: 1.9; }
.post-detail .post-content h2 { font-size: 1.4rem; margin: 30px 0 10px; }
.post-detail .post-content h3 { font-size: 1.15rem; margin: 20px 0 8px; }
.post-detail .post-content p { margin-bottom: 15px; }
.post-detail .post-content ul, .post-detail .post-content ol { margin: 10px 0 15px 20px; }
.post-detail .post-content li { margin-bottom: 6px; }
.post-detail .post-content strong { font-weight: 700; }

/* Categories Page */
.cat-page-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 30px 0; }

/* About Page */
.about-content { background: var(--white); border-radius: 16px; padding: 40px; box-shadow: var(--shadow); margin: 30px 0; }
.about-content h2 { font-size: 1.4rem; font-weight: 700; margin: 25px 0 10px; }
.about-content p { font-size: 1rem; line-height: 1.8; margin-bottom: 12px; color: var(--dark2); }

/* Pagination */
.pagination { display: flex; gap: 8px; justify-content: center; margin: 30px 0; }
.page-link { padding: 8px 16px; border: 1px solid var(--gray-light); border-radius: 8px; font-size: 0.9rem; color: var(--dark2); }
.page-link.active { background: var(--red); color: #fff; border-color: var(--red); }
.page-link:hover:not(.active) { background: #f8f9fa; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray); font-size: 1.1rem; }

/* Responsive */
@media (max-width: 900px) {
    .cat-grid, .trending-grid, .trivia-grid, .phrase-list, .post-grid, .cat-page-grid { grid-template-columns: repeat(2, 1fr); }
    .hero h1 { font-size: 2.2rem; }
    .hero-stats { flex-wrap: wrap; gap: 24px; }
}
@media (max-width: 640px) {
    .nav { display: none; }
    .hamburger { display: flex; }
    .cat-grid, .trending-grid, .trivia-grid, .phrase-list, .post-grid, .cat-page-grid { grid-template-columns: 1fr; }
    .hero { padding: 50px 0 40px; }
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }
    .section { padding: 40px 0; }
    .section-header h2 { font-size: 1.4rem; }
    .featured-card .phrase { font-size: 1.5rem; }
    .phrase-detail { padding: 24px; }
    .phrase-detail .phrase-big { font-size: 1.6rem; }
    .post-detail { padding: 24px; }
    .post-detail h1 { font-size: 1.5rem; }
    .phrase-nav { flex-direction: column; gap: 10px; }
    .search-suggestions { justify-content: center; }
}

/* ===== 短语页 - 来源徽章 ===== */
.phrase-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 5px 14px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.3px; }
.badge-trending { background: linear-gradient(135deg, #fff5e6, #ffe8cc); color: #d35400; border: 1px solid #ffd8b3; }
.badge-featured { background: linear-gradient(135deg, #e8f8f0, #d1f2e8); color: #1a7a4a; border: 1px solid #b8e6d4; }
.badge-cat { background: linear-gradient(135deg, #eef2ff, #dde5ff); color: #3b5cb8; border: 1px solid #ccd9ff; }

/* ===== 短语页 - 元信息 + 标签 ===== */
.phrase-meta-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 32px; padding: 18px 20px; background: #fafbfc; border-radius: 12px; border: 1px solid var(--gray-light); }
.phrase-stats { font-size: 0.82rem; color: #888; }
.phrase-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 4px 12px; border-radius: 14px; font-size: 0.75rem; font-weight: 500; background: var(--white); color: var(--dark2); border: 1px solid #e0e0e0; transition: all 0.2s; }
.tag:hover { border-color: var(--red); color: var(--red); background: #fff5f5; }

/* ===== 短语页 - 上下篇 ===== */
.phrase-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; }
.nav-left, .nav-right { flex: 1; min-width: 0; }
.nav-right { text-align: right; }
.nav-link { display: inline-flex; flex-direction: column; gap: 2px; padding: 12px 20px; border-radius: 12px; border: 1px solid #e8e8e8; font-size: 0.9rem; font-weight: 500; color: var(--dark2); transition: all 0.25s; max-width: 100%; background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.nav-link:hover { border-color: var(--red); color: var(--red); box-shadow: 0 2px 8px rgba(231,76,60,0.1); transform: translateY(-1px); }
.nav-dir { font-size: 0.75rem; color: var(--gray); font-weight: 400; }

/* ===== 搜索建议 ===== */
.section + .section.search-suggestions-section { padding-top: 0; }
.search-suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.suggestion-chip { display: inline-flex; align-items: center; gap: 4px; padding: 9px 20px; border-radius: 24px; border: 1.5px solid #e8e8e8; font-size: 0.88rem; color: #555; transition: all 0.2s; background: var(--white); }
.suggestion-chip:hover { border-color: var(--red); color: var(--red); background: #fff7f7; box-shadow: 0 2px 8px rgba(231,76,60,0.08); transform: translateY(-1px); }

/* ===== 评论区 ===== */
.comment-section { max-width: 720px; margin: 0 auto; }
.comment-section h3 { font-size: 1.25rem; margin-bottom: 4px; }
.comment-subtitle { font-size: 0.9rem; color: #888; margin-bottom: 24px; }
.comment-form { background: var(--white); border-radius: 14px; padding: 28px; border: 1px solid #e8e8e8; box-shadow: 0 2px 12px rgba(0,0,0,0.04); margin-bottom: 28px; }
.comment-input, .comment-textarea { width: 100%; padding: 12px 16px; border: 1.5px solid #e0e0e0; border-radius: 10px; font-size: 0.92rem; font-family: inherit; outline: none; transition: all 0.25s; background: #fafbfc; margin-bottom: 14px; }
.comment-input:focus, .comment-textarea:focus { border-color: var(--red); background: #fff; box-shadow: 0 0 0 4px rgba(231,76,60,0.08); }
.comment-btn { display: inline-flex; align-items: center; gap: 6px; padding: 11px 28px; background: var(--red); color: #fff; border: none; border-radius: 10px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.comment-btn:hover { background: #c0392b; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(231,76,60,0.25); }
.comment-success { background: #eafaf1; border: 1px solid #82e0aa; color: #1e8449; padding: 14px 18px; border-radius: 10px; margin-bottom: 18px; font-size: 0.9rem; }
.comment-error { background: #fdedec; border: 1px solid #f5b7b1; color: #c0392b; padding: 14px 18px; border-radius: 10px; margin-bottom: 18px; font-size: 0.9rem; }
.comment-list { margin-top: 8px; }
.comment-item { background: var(--white); border-radius: 12px; padding: 18px 22px; margin-bottom: 12px; border: 1px solid #e8e8e8; box-shadow: 0 1px 4px rgba(0,0,0,0.03); transition: all 0.2s; }
.comment-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.comment-email { font-size: 0.82rem; font-weight: 600; color: var(--dark2); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.comment-text { font-size: 0.92rem; color: var(--dark2); line-height: 1.7; }
.comment-date { font-size: 0.75rem; color: #aaa; margin-top: 10px; }
.bg-light { background: #f8f9fa; }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .phrase-meta-bar { flex-direction: column; align-items: flex-start; }
    .comment-form { padding: 20px; }
    .phrase-nav { flex-direction: column; }
    .nav-left, .nav-right { text-align: left; }
}
