/* 行业新闻网 - 响应式样式 */
:root {
    --primary: #1a56db;
    --primary-dark: #1240a8;
    --primary-light: #dbeafe;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f9fafb;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --info: #1d4ed8;
    --info-bg: #dbeafe;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ========== 前台：头部 ========== */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 60px;
}

.site-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
}

.main-nav a {
    color: var(--text);
    font-size: 15px;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary);
    background: var(--primary-light);
}

.search-form {
    display: flex;
    gap: 4px;
}

.search-form input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 14px;
    width: 180px;
    outline: none;
    transition: border-color 0.2s;
}

.search-form input:focus { border-color: var(--primary); }

.search-form button {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-form button:hover { background: var(--primary-dark); }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.mobile-menu-btn:hover { background: var(--bg); }

/* ========== 前台：主体 ========== */
.site-main { padding: 24px 0; }

.home-page { display: flex; gap: 24px; }
.content-area { flex: 1; min-width: 0; }

/* 文章卡片 */
.article-list { display: flex; flex-direction: column; gap: 16px; }

.article-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.article-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.article-thumb {
    width: 200px;
    min-height: 140px;
    flex-shrink: 0;
    overflow: hidden;
}

.article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.article-card:hover .article-thumb img { transform: scale(1.05); }

/* 无图文章卡片 */
.article-card.no-thumb { display: block; }
.article-card.no-thumb .article-body { padding: 20px 24px; }

.article-thumb-placeholder {
    width: 200px;
    min-height: 140px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 32px;
    opacity: 0.6;
}

.article-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.article-title {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.article-title a { color: var(--text); }
.article-title a:hover { color: var(--primary); }

.article-summary {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

/* ========== 前台：文章详情 ========== */
.article-detail {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

.article-detail .article-title {
    font-size: 28px;
    margin-bottom: 12px;
}

.article-detail .article-meta {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.article-content {
    font-size: 16px;
    line-height: 1.8;
}

.article-content p { margin-bottom: 16px; }
.article-content h2 { margin: 24px 0 12px; font-size: 22px; }
.article-content h3 { margin: 20px 0 10px; font-size: 18px; }
.article-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.article-content a { color: var(--primary); }
.article-content blockquote { border-left: 4px solid var(--primary); padding: 12px 16px; background: var(--bg); margin: 16px 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.article-content pre { background: #1f2937; color: #e5e7eb; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; margin: 16px 0; }
.article-content code { font-size: 14px; }

.article-original { margin-top: 24px; font-size: 14px; color: var(--text-light); }

/* 锚文本推荐阅读 */
.anchor-recommend {
    margin-top: 24px;
    padding: 16px 20px;
    background: #f0f5ff;
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 15px;
    line-height: 2;
}
.anchor-recommend strong { color: var(--text); }
.anchor-recommend a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.anchor-recommend a:hover { color: var(--primary-dark); }

/* 面包屑 */
.breadcrumb {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }

/* 相关文章 */
.related-articles {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 24px;
    box-shadow: var(--shadow);
}

.related-articles h2 { font-size: 18px; margin-bottom: 16px; }
.related-articles ul { list-style: none; }
.related-articles li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.related-articles li:last-child { border: none; }
.related-articles time { font-size: 13px; color: var(--text-light); }

/* 侧栏 */
.sidebar { width: 300px; flex-shrink: 0; }

.widget {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.widget h3 {
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

.widget ol, .widget ul { list-style: none; }
.widget ol { counter-reset: hot; }
.widget ol li { counter-increment: hot; padding: 6px 0; font-size: 14px; }
.widget ol li::before { content: counter(hot); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: var(--primary); color: var(--white); border-radius: 50%; font-size: 11px; margin-right: 8px; }
.widget ol li:nth-child(n+4)::before { background: var(--text-light); }
.widget ul li { padding: 6px 0; font-size: 14px; }
.widget ul li::before { content: "›"; margin-right: 6px; color: var(--primary); }

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px 0;
}

.pagination a, .pagination .current {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.pagination a {
    background: var(--white);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--white);
    background: var(--primary);
}

.pagination .current { color: var(--text-light); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

/* 分类页 */
.category-page h1 { margin-bottom: 8px; }
.category-desc { color: var(--text-light); margin-bottom: 24px; }

/* 搜索页 */
.search-page h1 { margin-bottom: 16px; }
.search-info { color: var(--text-light); margin-bottom: 16px; }

/* 底部 */
.site-footer {
    background: #1f2937;
    color: #9ca3af;
    padding: 24px 0;
    margin-top: 40px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.footer-nav { display: flex; gap: 16px; }
.footer-nav a { color: #9ca3af; }
.footer-nav a:hover { color: var(--white); }

/* 友情链接 */
.friend-links {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #374151;
    font-size: 14px;
}
.friend-links-label { color: var(--white); font-weight: 500; }
.friend-links a { color: #9ca3af; }
.friend-links a:hover { color: var(--white); }

/* ========== 后台样式 ========== */
.admin-wrap { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 220px;
    background: #1f2937;
    color: var(--white);
    padding: 0 0 24px;
    flex-shrink: 0;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
}

.admin-sidebar .admin-logo {
    padding: 20px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid #374151;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-group-label {
    padding: 20px 20px 6px;
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.admin-sidebar nav a {
    display: block;
    padding: 9px 20px;
    color: #d1d5db;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
    border-left: 3px solid transparent;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    background: #374151;
    color: var(--white);
    border-left-color: var(--primary);
}

.admin-main { flex: 1; background: var(--bg); padding: 24px; min-width: 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h1 { font-size: 24px; }

/* 后台表格 */
.admin-table { width: 100%; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.admin-table th { background: var(--bg); font-weight: 600; color: var(--text-light); white-space: nowrap; }
.admin-table tr:hover { background: #f3f4f6; }
.admin-table tr:last-child td { border-bottom: none; }

/* 后台按钮 */
.btn { display: inline-block; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; border: none; transition: background 0.2s, transform 0.1s; text-align: center; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

/* 状态标签 */
.status { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.status-published { background: var(--success-bg); color: #166534; }
.status-draft { background: #fef3c7; color: #92400e; }
.status-archived { background: #e5e7eb; color: #374151; }
.status-active { background: var(--success-bg); color: #166534; }
.status-inactive { background: #fef3c7; color: #92400e; }
.status-error { background: var(--danger-bg); color: var(--danger); }
.status-info { background: var(--info-bg); color: var(--info); }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 14px; color: var(--text-light); margin-top: 4px; }
.stat-card .stat-icon { font-size: 20px; margin-bottom: 8px; }

/* 后台表单 */
.admin-form { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
.form-group textarea { min-height: 200px; }
.form-group .form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* 两列表单布局 */
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* 设置页分区卡片 */
.settings-section { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.settings-section h3 { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); font-size: 16px; }

/* 提示消息 */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: var(--success-bg); color: #166534; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-warning { background: #fef3c7; color: #92400e; }

/* 标签筛选栏 */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }

/* 文字工具类 */
.text-muted { color: var(--text-light); font-size: 14px; }
.text-small { font-size: 12px; color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.monospace { font-family: monospace; font-size: 12px; }

/* 代码块 */
.code-block { background: #1f2937; color: #e5e7eb; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; overflow-x: auto; font-family: monospace; line-height: 1.5; }
.code-block-sm { max-height: 200px; overflow-y: auto; }

/* 操作按钮组 */
.action-group { display: flex; gap: 4px; flex-wrap: wrap; }

/* 后台两列布局 */
.admin-two-col { display: flex; gap: 24px; flex-wrap: wrap; }
.admin-two-col > * { flex: 2; min-width: 400px; }
.admin-two-col > :last-child { flex: 1; min-width: 250px; }

/* 登录页 */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #1a56db 0%, #3b82f6 50%, #60a5fa 100%); }
.login-form { background: var(--white); border-radius: 12px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-form h1 { text-align: center; margin-bottom: 24px; font-size: 24px; color: var(--primary); }
.login-form .login-icon { text-align: center; font-size: 48px; margin-bottom: 16px; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .home-page { flex-direction: column; }
    .sidebar { width: 100%; }
    .article-card { flex-direction: column; }
    .article-thumb, .article-thumb-placeholder { width: 100%; min-height: 180px; }
    .main-nav { display: none; }
    .mobile-menu-btn { display: block; }
    .main-nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--white);
        padding: 16px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        z-index: 99;
    }
    .header-inner { flex-wrap: wrap; }
    .search-form { width: 100%; order: 3; }
    .search-form input { flex: 1; }
    .article-detail { padding: 16px; }
    .article-detail .article-title { font-size: 22px; }
    .footer-inner { flex-direction: column; gap: 8px; text-align: center; }

    /* 后台响应式 */
    .admin-wrap { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 0;
    }
    .admin-sidebar.open { max-height: 600px; padding: 0 0 16px; }
    .admin-sidebar .admin-logo { padding: 14px 20px; }
    .admin-main { padding: 16px; }
    .mobile-sidebar-btn {
        display: block;
        width: 100%;
        background: #1f2937;
        color: var(--white);
        border: none;
        padding: 12px 20px;
        font-size: 16px;
        cursor: pointer;
        text-align: left;
    }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; }
    .admin-two-col { flex-direction: column; }
    .admin-two-col > * { min-width: 0; }
}

@media (min-width: 769px) {
    .mobile-sidebar-btn { display: none; }
}
