/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; color: #333; background: #f5f5f5; line-height: 1.6; }
a { color: #333; text-decoration: none; transition: color .2s; }
a:hover { color: #e8590c; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 30px; }

/* ===== Header ===== */
.site-header { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; height: 60px; gap: 20px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; color: #333; white-space: nowrap; }
.logo-icon { flex-shrink: 0; }
.logo-text { color: #333; }
.main-nav { display: flex; gap: 8px; flex: 1; justify-content: flex-start; margin-left: 20px; }
.nav-link { padding: 6px 14px; border-radius: 6px; font-size: 15px; font-weight: 500; color: #555; transition: all .2s; white-space: nowrap; }
.nav-link:hover, .nav-link.active { color: #e8590c; background: #fff5f0; }
.header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.search-box { display: flex; align-items: center; background: #f5f5f5; border-radius: 20px; padding: 6px 14px; border: 1px solid #eee; }
.search-box .search-icon { flex-shrink: 0; margin-right: 6px; }
.search-box input { border: none; background: transparent; outline: none; font-size: 14px; width: 160px; }
.btn-login { background: #e8590c; color: #fff !important; padding: 7px 20px; border-radius: 20px; font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: background .2s; }
.btn-login:hover { background: #d14e0a; }
.user-menu { position: relative; cursor: pointer; }
.user-name { font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 6px; }
.user-name:hover { background: #f5f5f5; }
.user-dropdown { display: none; position: absolute; top: 100%; right: 0; background: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.1); min-width: 120px; z-index: 50; }
.user-menu:hover .user-dropdown { display: block; }
.user-dropdown a { display: block; padding: 10px 16px; font-size: 14px; }
.user-dropdown a:hover { background: #f5f5f5; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: #333; margin: 5px 0; transition: .3s; }
.mobile-nav { display: none; background: #fff; border-top: 1px solid #eee; padding: 12px 20px; }
.mobile-nav a { display: block; padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 15px; }

/* ===== Hero / Carousel ===== */
.hero-section { padding: 24px 0; }
.hero-grid { min-height: 400px; }
.carousel { position: relative; border-radius: 12px; overflow: hidden; width: 100%; min-height: 400px; }
.carousel-slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity .6s ease; }
.carousel-slide.active { opacity: 1; position: relative; min-height: 400px; }
.slide-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 30px 40px; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; }
.slide-overlay h2 { font-size: 26px; margin-bottom: 8px; }
.slide-overlay p { font-size: 15px; opacity: .9; margin-bottom: 14px; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.9); border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 22px; cursor: pointer; z-index: 5; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.carousel-btn.prev { left: 16px; }
.carousel-btn.next { right: 16px; }
.carousel-btn:hover { background: #fff; }
.carousel-dots { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 5; }
.carousel-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; transition: all .3s; }
.carousel-dots .dot.active { background: #fff; width: 24px; border-radius: 4px; }
.featured-side { display: none; }
.btn-primary { display: inline-block; background: #e8590c; color: #fff !important; padding: 8px 20px; border-radius: 6px; font-size: 14px; border: none; cursor: pointer; transition: background .2s; }
.btn-primary:hover { background: #d14e0a; }

/* ===== Stats Section (热门+最赞) ===== */
.stats-section { padding: 0 0 24px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stats-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stats-title { display: flex; align-items: center; gap: 8px; font-size: 18px; color: #e8590c; margin-bottom: 16px; font-weight: 600; }
.stats-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f5f5f5; }
.stats-list li:last-child { border-bottom: none; }
.rank-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #f0f0f0; color: #999; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.rank-1 { background: #e8590c; color: #fff; }
.rank-2 { background: #f0850c; color: #fff; }
.rank-3 { background: #f5a623; color: #fff; }
.stats-list a { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-list .meta { font-size: 12px; color: #999; white-space: nowrap; }

/* ===== Section Titles ===== */
.section-title { font-size: 22px; font-weight: 700; color: #e8590c; margin-bottom: 20px; }

/* ===== Tags Section (Homepage bottom) ===== */
.tags-section { padding: 0 0 30px; }
.tags-card { background: #fff; border-radius: 12px; padding: 24px 28px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tags-card .tag-cloud { gap: 10px; }
.tags-card .tag-item { padding: 6px 16px; font-size: 14px; }

/* ===== Content Grid (Main + Sidebar) ===== */
.content-section { padding: 0 0 40px; }
.content-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.articles-main { min-width: 0; }

/* ===== Card Shared Styles ===== */
.card-category { display: inline-block; background: #e8590c; color: #fff; padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; width: fit-content; line-height: 1.4; }
.card-meta { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.tag-small { background: #fff; color: #666; padding: 3px 10px; border-radius: 14px; font-size: 12px; border: 1px solid #e0e0e0; transition: all .2s; }
.tag-small:hover { border-color: #e8590c; color: #e8590c; background: #fff5f0; }
.meta-date, .meta-views, .meta-likes { font-size: 12px; color: #bbb; display: inline-flex; align-items: center; gap: 3px; }
.meta-date svg, .meta-views svg, .meta-likes svg { width: 14px; height: 14px; }
.meta-divider { display: flex; align-items: center; gap: 12px; font-size: 12px; color: #bbb; margin-top: 8px; }

/* ===== Article Card (Grid) ===== */
.card-grid { display: grid; gap: 20px; }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.article-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: all .2s; display: flex; flex-direction: column; }
.article-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,.1); transform: translateY(-3px); }
.article-card .card-image { height: 200px; overflow: hidden; position: relative; }
.article-card .card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.article-card:hover .card-image img { transform: scale(1.05); }
.article-card .card-body { padding: 0 16px 16px; display: flex; flex-direction: column; flex: 1; position: relative; }
.article-card .card-body .card-category { position: relative; top: -12px; margin-bottom: 0; }
.article-card .card-body h3, .article-card .card-body h4 { font-size: 16px; margin-bottom: 8px; line-height: 1.5; font-weight: 700; color: #333; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.article-card .card-body h3 a, .article-card .card-body h4 a { color: #333; }
.article-card .card-body h3 a:hover, .article-card .card-body h4 a:hover { color: #e8590c; }
.article-card .card-body p { font-size: 13px; color: #888; line-height: 1.7; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; flex: 1; margin-bottom: 10px; }
.article-card .card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.article-card .card-bottom { display: flex; align-items: center; gap: 14px; margin-top: auto; font-size: 12px; color: #bbb; }

/* ===== Sidebar ===== */
.sidebar { position: sticky; top: 80px; margin-top: 50px; }
.sidebar-widget { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.widget-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; margin-bottom: 16px; color: #333; }
.sidebar-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f5f5f5; }
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list a { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-list .meta { font-size: 12px; color: #999; white-space: nowrap; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-item { background: #f5f5f5; color: #555; padding: 4px 12px; border-radius: 16px; font-size: 13px; transition: all .2s; }
.tag-item:hover { background: #e8590c; color: #fff; }

/* ===== List Section ===== */
.list-section { padding: 30px 0 40px; }
.list-header { margin-bottom: 24px; }
.list-header h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.list-desc { color: #666; font-size: 15px; }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 30px; padding: 20px 0; flex-wrap: wrap; }
.page-btn, .page-num { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 12px; border-radius: 6px; font-size: 14px; background: #fff; border: 1px solid #e0e0e0; cursor: pointer; transition: all .2s; }
.page-btn:hover, .page-num:hover { border-color: #e8590c; color: #e8590c; }
.page-num.active { background: #e8590c; color: #fff; border-color: #e8590c; }
.page-dots { padding: 0 4px; color: #999; }
.page-info { font-size: 13px; color: #999; margin-left: 12px; }

/* ===== Article Detail ===== */
.article-section { padding: 24px 0 40px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #999; margin-bottom: 20px; flex-wrap: wrap; }
.breadcrumb a { color: #666; }
.breadcrumb a:hover { color: #e8590c; }
.article-content { background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.article-content h1 { font-size: 26px; line-height: 1.4; margin-bottom: 16px; }
.article-meta { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.meta-category { background: #fff5f0; color: #e8590c; padding: 3px 12px; border-radius: 4px; font-size: 13px; }
.article-tags { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.article-cover { margin-bottom: 24px; border-radius: 8px; overflow: hidden; }
.article-cover img { width: 100%; max-height: 400px; object-fit: cover; }
.article-body { font-size: 16px; line-height: 1.8; color: #333; }
.article-body h2 { font-size: 22px; margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 2px solid #e8590c; }
.article-body h3 { font-size: 18px; margin: 22px 0 10px; }
.article-body p { margin-bottom: 16px; }
.article-body img { border-radius: 8px; margin: 16px 0; }
.article-body ul, .article-body ol { margin: 12px 0; padding-left: 24px; }
.article-body li { margin-bottom: 8px; }
.article-body blockquote { border-left: 4px solid #e8590c; padding: 12px 20px; margin: 16px 0; background: #fef9f5; border-radius: 0 8px 8px 0; color: #555; }
.article-body pre { background: #f5f5f5; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 16px 0; }
.article-body code { background: #f5f5f5; padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.article-body table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.article-body th, .article-body td { border: 1px solid #e0e0e0; padding: 10px 14px; text-align: left; }
.article-body th { background: #f9f9f9; font-weight: 600; }

.article-actions { display: flex; gap: 16px; margin-top: 30px; padding-top: 20px; border-top: 1px solid #f0f0f0; }
.action-btn { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid #e0e0e0; background: #fff; cursor: pointer; font-size: 14px; transition: all .2s; }
.action-btn:hover, .action-btn.active { border-color: #e8590c; color: #e8590c; background: #fff5f0; }

.prev-next { display: flex; justify-content: space-between; margin-top: 24px; gap: 16px; }
.prev-link, .next-link { flex: 1; padding: 16px; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: box-shadow .2s; }
.prev-link:hover, .next-link:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.prev-link span, .next-link span { display: block; font-size: 12px; color: #999; margin-bottom: 4px; }
.prev-link strong, .next-link strong { font-size: 14px; color: #333; }
.next-link { text-align: right; }

.related-section { margin-top: 30px; }
.related-section h3 { font-size: 20px; margin-bottom: 16px; }

/* ===== Auth Section ===== */
.auth-section { display: flex; justify-content: center; align-items: center; min-height: 60vh; padding: 40px 20px; }
.auth-card { background: #fff; border-radius: 12px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.auth-card h2 { text-align: center; font-size: 24px; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border-color .2s; outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #e8590c; }
.btn-block { width: 100%; padding: 12px; font-size: 16px; }
.auth-link { text-align: center; margin-top: 16px; font-size: 14px; color: #666; }
.auth-link a { color: #e8590c; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ===== Search Form (Large) ===== */
.search-form-large { display: flex; gap: 12px; margin: 16px 0; }
.search-form-large input { flex: 1; padding: 12px 16px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 16px; outline: none; transition: border-color .2s; }
.search-form-large input:focus { border-color: #e8590c; }
.search-result-count { color: #666; font-size: 14px; }

/* ===== 404 ===== */
.error-section { text-align: center; padding: 80px 20px; }
.error-content h1 { font-size: 80px; color: #e8590c; margin-bottom: 16px; }
.error-content p { font-size: 18px; color: #666; margin-bottom: 24px; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: #999; font-size: 16px; background: #fff; border-radius: 12px; }

/* ===== Footer ===== */
.site-footer { background: #1a1a2e; color: #ccc; padding: 40px 0 0; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding-bottom: 30px; }
.footer-logo { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 12px; }
.footer-info p { font-size: 14px; color: #aaa; }
.footer-links h4 { color: #fff; font-size: 16px; margin-bottom: 12px; }
.footer-links a { display: block; color: #aaa; font-size: 14px; padding: 4px 0; transition: color .2s; }
.footer-links a:hover { color: #e8590c; }
.footer-bottom { border-top: 1px solid #333; padding: 16px 0; text-align: center; font-size: 13px; color: #777; }

/* ===== Admin ===== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #1a1a2e; color: #fff; padding: 20px 0; flex-shrink: 0; display: flex; flex-direction: column; }
.admin-sidebar .logo { padding: 0 20px 20px; border-bottom: 1px solid #333; margin-bottom: 10px; color: #fff; }
.admin-sidebar .logo-text { color: #fff; }
.admin-nav { flex: 1; }
.admin-nav a { display: flex; align-items: center; gap: 8px; padding: 12px 20px; color: #aaa; font-size: 14px; transition: all .2s; }
.admin-nav a:hover, .admin-nav a.active { background: rgba(232,89,12,.15); color: #e8590c; }
.admin-sidebar-footer { border-top: 1px solid #333; padding: 16px 20px; display: flex; gap: 16px; }
.admin-sidebar-footer a { color: #fff; font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 6px; background: rgba(255,255,255,.1); transition: all .2s; }
.admin-sidebar-footer a:hover { background: #e8590c; color: #fff; }
.admin-main { flex: 1; background: #f5f5f5; }
.admin-header { background: #fff; padding: 16px 24px; box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; justify-content: space-between; align-items: center; }
.admin-content { padding: 24px; }
.admin-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px; }
.admin-card h3 { font-size: 18px; margin-bottom: 16px; }
.dashboard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); text-align: center; }
.stat-card .number { font-size: 28px; font-weight: 700; color: #e8590c; }
.stat-card .label { font-size: 14px; color: #666; margin-top: 4px; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.data-table th { background: #f9f9f9; font-weight: 600; font-size: 13px; color: #666; text-transform: uppercase; }
.data-table td { font-size: 14px; }
.data-table tr:hover td { background: #fafafa; }
.btn-sm { padding: 4px 12px; font-size: 13px; border-radius: 4px; border: 1px solid #ddd; background: #fff; cursor: pointer; transition: all .2s; }
.btn-sm:hover { border-color: #e8590c; color: #e8590c; }
.btn-sm.danger { color: #dc2626; border-color: #fecaca; }
.btn-sm.danger:hover { background: #fef2f2; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .content-grid { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .card-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
    .card-grid.cols-4 { grid-template-columns: repeat(3, 1fr); }
    .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 992px) {
    .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .main-nav { display: none; }
    .header-right .search-box { display: none; }
    .hamburger { display: block; }
    .mobile-nav.show { display: block; }
    .hero-grid { min-height: 260px; }
    .stats-grid { grid-template-columns: 1fr; }
    .card-grid.cols-3, .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .article-card-horizontal { flex-direction: column; }
    .article-card-horizontal .card-image { width: 100%; min-height: 200px; }
    .article-card-horizontal .card-body { padding: 16px; }
    .article-content { padding: 20px; }
    .article-content h1 { font-size: 22px; }
    .prev-next { flex-direction: column; }
    .footer-inner { grid-template-columns: 1fr; gap: 24px; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .admin-sidebar { display: none; }
}

@media (max-width: 480px) {
    .card-grid.cols-3, .card-grid.cols-4 { grid-template-columns: 1fr; }
}
