/* assets/css/style.css */
:root {
    /* 浅色主题变量 */
    --bg-color: #f3f4f6; /* 网页背景：淡灰 */
    --card-bg: #ffffff; /* 卡片背景：纯白 */
    --text-main: #1f2937; /* 主文字：深灰 */
    --text-muted: #6b7280; /* 次要文字：中灰 */
    --primary: #3b82f6; /* 主题蓝 */
    --primary-hover: #2563eb;
    --danger: #ef4444; /* 错误红 */
    --border: #e5e7eb; /* 边框色 */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

input, button {
    font-family: inherit;
    outline: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* === 布局结构 (Layout) === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: #f8fafc; /* 更柔和的背景 */
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 0px; /*稍微圆角，或者用 50% 变成圆形 */
    object-fit: contain; /* 保持图片比例 */
}

.logo-text {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-main);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    font-size: 0.95rem;
}

    .nav-item:hover {
        background: #f3f4f6;
        color: var(--text-main);
    }

    .nav-item.active {
        background: #eff6ff;
        color: var(--primary);
        font-weight: 500;
    }

.nav-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    margin-right: 12px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.logout:hover {
    background: #fef2f2;
    color: var(--danger);
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 240px; /* 留出侧边栏宽度 */
    display: flex;
    flex-direction: column;
}

/* 顶部栏 */
.top-header {
    height: 64px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 5;
}

.breadcrumb {
    font-weight: 600;
    font-size: 1.1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.action-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    cursor: pointer;
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 页面内容容器 */
.page-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* === 仪表盘专用样式 === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    }

.stat-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

    .stat-value.loading {
        color: #d1d5db;
        font-size: 1.5rem;
    }

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 2fr; /* 左1 右2 比例 */
    gap: 1.5rem;
}

.content-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 1.5rem;
    height: 100%;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* 热门文章列表 */
.rank-list {
    list-style: none;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px dashed var(--border);
}

    .rank-item:last-child {
        border: none;
    }

.rank-num {
    width: 24px;
    height: 24px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 12px;
}

.rank-item:nth-child(1) .rank-num {
    background: #fee2e2;
    color: #ef4444;
}

.rank-item:nth-child(2) .rank-num {
    background: #ffedd5;
    color: #f97316;
}

.rank-item:nth-child(3) .rank-num {
    background: #dbeafe;
    color: #3b82f6;
}

.rank-link {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
    margin-right: 10px;
    transition: color 0.2s;
}

    .rank-link:hover {
        color: var(--primary);
        text-decoration: underline;
    }

.rank-views {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ECharts 容器 */
#trend-chart {
    width: 100%;
    height: 300px;
}