/* ====================================================
   DeepSeek 风格 - 快手粉条系统 UI
   特点：柔光卡片、渐变主色、圆角、清爽留白
   ==================================================== */

/* ---------- 全局重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #1e293b;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background: #ffffff;
    border-right: 1px solid #e9edf4;
    padding: 24px 14px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

.sidebar .logo {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}

.sidebar .logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

.sidebar .logo .logo-text {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    font-weight: 500;
}

.nav-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.nav-item.active {
    background: #eef2ff;
    color: #4f46e5;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.1);
}

.nav-item .icon {
    font-size: 18px;
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
    padding: 0 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* ---------- 主内容区 ---------- */
.main-content {
    margin-left: 220px;
    padding: 24px 32px 40px;
    min-height: 100vh;
}

/* ---------- 顶部栏 ---------- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.top-bar .left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar h2 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.3px;
}

.top-bar h2 .highlight {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar .advertiser-select {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    background: #ffffff;
    color: #1e293b;
    outline: none;
    cursor: pointer;
    min-width: 160px;
    transition: border-color 0.2s;
}

.top-bar .advertiser-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar .user-info .username {
    font-weight: 500;
    color: #1e293b;
}

.top-bar .user-info .username::before {
    content: "👤 ";
}

.top-bar .user-info .logout {
    color: #94a3b8;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 13px;
}

.top-bar .user-info .logout:hover {
    background: #f1f5f9;
    color: #ef4444;
}

/* ---------- 滚动时关闭 hover 动效（避免滚轮滑动时整页闪烁） ---------- */
html.is-scrolling *,
html.is-scrolling *::before,
html.is-scrolling *::after,
body.is-scrolling *,
body.is-scrolling *::before,
body.is-scrolling *::after {
    transition: none !important;
    animation: none !important;
}

html.is-scrolling .card:hover,
body.is-scrolling .card:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

html.is-scrolling .kpi-card:hover,
body.is-scrolling .kpi-card:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

html.is-scrolling table tbody tr:hover,
body.is-scrolling table tbody tr:hover,
html.is-scrolling .data-table tr:hover,
body.is-scrolling .data-table tr:hover {
    background: transparent;
}

@media (hover: none), (pointer: coarse) {
    .kpi-card:hover {
        transform: none;
    }
}

/* ---------- 使用者：可见功能，数据由后端屏蔽 ---------- */
.viewer-mode-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}

body.role-viewer .kpi-card .value,
body.role-viewer .stat-value,
body.role-viewer .stat-card .stat-value {
    color: #94a3b8;
}

/* ---------- 卡片通用设计 ---------- */
.card {
    background: #ffffff;
    border-radius: 14px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
    border: 1px solid #f1f5f9;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.card .card-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card .card-title .sub {
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
    margin-left: auto;
}

/* ---------- KPI 卡片网格 ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
}

@media (hover: hover) and (pointer: fine) {
    .kpi-card {
        transition: box-shadow 0.2s ease;
    }
    .kpi-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    }
}

.kpi-card .label {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 4px;
}

.kpi-card .value {
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.kpi-card .value .unit {
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    margin-left: 2px;
}

.kpi-card .trend {
    font-size: 12px;
    margin-top: 4px;
    display: inline-block;
    padding: 0 8px;
    border-radius: 6px;
}

.kpi-card .trend.up {
    color: #10b981;
    background: #ecfdf5;
}

.kpi-card .trend.down {
    color: #ef4444;
    background: #fef2f2;
}

/* ---------- 图表行 ---------- */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-box {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px 20px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
}

.chart-box .title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 12px;
}

.chart-container {
    width: 100%;
    height: 260px;
}

/* ---------- 表格 ---------- */
.table-container {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table thead {
    background: #f8fafc;
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #e9edf4;
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

table tbody tr:hover {
    background: #fafbfc;
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- 状态标签 ---------- */
.status-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.审核中 {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.投放中 {
    background: #dbeafe;
    color: #2563eb;
}

.status-badge.已完成 {
    background: #d1fae5;
    color: #059669;
}

.status-badge.已关停 {
    background: #fee2e2;
    color: #dc2626;
}

.status-badge.付款中 {
    background: #fef3c7;
    color: #d97706;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: #f1f5f9;
    color: #475569;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.btn-success {
    background: #10b981;
    color: #ffffff;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-ghost:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 16px 0 12px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.page-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.page-btn.active {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.page-btn.active:hover {
    background: #4338ca;
}

/* ---------- 工具类 ---------- */
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.text-muted { color: #94a3b8; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 992px) {
    .chart-row {
        grid-template-columns: 1fr;
    }
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 16px 8px;
    }
    .sidebar .logo-text,
    .sidebar .nav-item span:last-child {
        display: none;
    }
    .sidebar .logo .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .main-content {
        margin-left: 60px;
        padding: 16px;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .kpi-card .value {
        font-size: 20px;
    }
    .top-bar h2 {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .kpi-card {
        padding: 12px 14px;
    }
    .kpi-card .value {
        font-size: 18px;
    }
    .table-container {
        overflow-x: auto;
    }
}
