/* ============================================================
   广告管理系统 - 现代卡片式 UI
   ============================================================ */
:root {
    --c-bg: #f4f6fb;
    --c-card: #ffffff;
    --c-primary: #5b7cfa;
    --c-primary-dark: #4263eb;
    --c-text: #2b3445;
    --c-text-muted: #8893a7;
    --c-border: #e9edf5;
    --c-success: #2bb673;
    --c-danger: #f04864;
    --c-warning: #f5a623;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 6px 24px rgba(91, 124, 250, .08);
    --shadow-hover: 0 10px 30px rgba(91, 124, 250, .16);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.6;
}

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

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5b7cfa 0%, #7b5bfa 50%, #b45bf5 100%);
    padding: 20px;
}
.login-card {
    width: 400px;
    max-width: 100%;
    background: #fff;
    border-radius: 20px;
    padding: 44px 38px 36px;
    box-shadow: 0 30px 80px rgba(0,0,0,.18);
}
.login-card .logo {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, #5b7cfa, #b45bf5);
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 30px; font-weight: 700;
    box-shadow: 0 8px 20px rgba(91,124,250,.4);
}
.login-card h2 { text-align: center; margin: 0 0 6px; font-size: 22px; }
.login-card .sub { text-align: center; color: var(--c-text-muted); margin-bottom: 28px; font-size: 13px; }
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--c-text-muted); }
.field input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all .2s;
    background: #fbfcfe;
}
.field input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(91,124,250,.12);
    background: #fff;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    background: #eef1f8;
    color: var(--c-text);
}
.btn:hover { background: #e2e7f3; }
.btn-primary {
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
    color: #fff;
    box-shadow: 0 6px 16px rgba(91,124,250,.3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--c-primary-dark), #3b54d4); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(91,124,250,.4); }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: #ffeef0; color: var(--c-danger); }
.btn-danger:hover { background: #ffdde2; }
.btn-success { background: #e6f8ef; color: var(--c-success); }
.btn-success:hover { background: #d2f0e1; }
.btn-warning { background: #fff5e6; color: var(--c-warning); }
.btn-warning:hover { background: #ffe9c7; }

/* ---------- 主框架 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid var(--c-border);
    padding: 22px 14px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    z-index: 30;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px 22px;
}
.sidebar .brand .logo {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #5b7cfa, #b45bf5);
    color: #fff; font-size: 18px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 14px rgba(91,124,250,.4);
}
.sidebar .brand .name { font-size: 16px; font-weight: 600; }
.nav { flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--c-text-muted);
    margin-bottom: 4px;
    cursor: pointer;
    transition: all .2s;
    font-size: 14px;
}
.nav-item:hover { background: #f4f6fb; color: var(--c-primary); }
.nav-item.active { background: linear-gradient(135deg, rgba(91,124,250,.12), rgba(180,91,245,.12)); color: var(--c-primary); font-weight: 500; }
.nav-item .icon { width: 18px; text-align: center; }
.sidebar .footer { font-size: 12px; color: var(--c-text-muted); text-align: center; padding-top: 14px; border-top: 1px solid var(--c-border); }

.main { flex: 1; margin-left: 220px; padding: 24px 30px; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px;
}
.topbar .page-title { font-size: 20px; font-weight: 600; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .user { display: flex; align-items: center; gap: 10px; }
.topbar .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #5b7cfa, #b45bf5);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.top-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 10px;
    font-size: 13px; font-weight: 500;
    text-decoration: none; cursor: pointer;
    transition: all .2s;
    border: 1px solid var(--c-border);
    background: #fff; color: var(--c-text);
}
.top-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(91,124,250,.15); }
.top-btn-home { color: var(--c-primary); border-color: rgba(91,124,250,.3); }
.top-btn-home:hover { background: rgba(91,124,250,.08); }
.top-btn-logout { color: var(--c-danger); border-color: rgba(240,72,100,.3); }
.top-btn-logout:hover { background: rgba(240,72,100,.08); }
.top-btn .tb-icon { font-size: 15px; }

.admin-footer {
    margin-top: 40px; padding: 20px 0 10px;
    text-align: center; font-size: 12px;
    color: var(--c-text-muted);
    border-top: 1px solid var(--c-border);
}

/* ---------- 卡片 ---------- */
.card {
    background: var(--c-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 22px;
}
.card-title { margin: 0 0 16px; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }

/* 统计卡片网格 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stat-card .stat-label { color: var(--c-text-muted); font-size: 13px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-icon {
    position: absolute; right: -10px; bottom: -10px;
    width: 70px; height: 70px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; opacity: .12;
}
.stat-card.blue .stat-value { color: var(--c-primary); }
.stat-card.green .stat-value { color: var(--c-success); }
.stat-card.orange .stat-value { color: var(--c-warning); }
.stat-card.red .stat-value { color: var(--c-danger); }
.stat-card.purple .stat-value { color: #b45bf5; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse;
}
table.data th, table.data td {
    padding: 12px 14px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--c-border);
}
table.data th { color: var(--c-text-muted); font-weight: 500; background: #fbfcfe; }
table.data tr:hover td { background: #fafbfe; }
table.data tr:last-child td { border-bottom: none; }

/* ---------- 标签 ---------- */
.tag {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 12px;
    line-height: 1.5;
}
.tag-blue { background: #eaf0ff; color: var(--c-primary); }
.tag-green { background: #e6f8ef; color: var(--c-success); }
.tag-gray { background: #f0f1f5; color: var(--c-text-muted); }
.tag-orange { background: #fff5e6; color: var(--c-warning); }
.tag-red { background: #ffeef0; color: var(--c-danger); }
.tag-purple { background: #f4ecff; color: #b45bf5; }

/* ---------- 筛选 ---------- */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    margin-bottom: 18px;
}
.filter-bar select, .filter-bar input {
    padding: 9px 12px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #fbfcfe;
    transition: all .2s;
    cursor: pointer;
}
.filter-bar input { cursor: text; }
.filter-bar select:focus, .filter-bar input:focus {
    outline: none; border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(91,124,250,.12);
    background: #fff;
}

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--c-text-muted); }
.form-item label .req { color: var(--c-danger); }
.form-item input[type=text],
.form-item input[type=url],
.form-item input[type=datetime-local],
.form-item textarea,
.form-item select {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: #fbfcfe;
    transition: all .2s;
    font-family: inherit;
}
.form-item input:focus, .form-item textarea:focus, .form-item select:focus {
    outline: none; border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(91,124,250,.12);
    background: #fff;
}
.form-item textarea { min-height: 90px; resize: vertical; }
.form-actions { margin-top: 8px; display: flex; gap: 10px; }
.form-hint { font-size: 12px; color: var(--c-text-muted); margin-top: 4px; }

/* ---------- 分页 ---------- */
.pagination { margin-top: 18px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pagination a, .pagination span {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    border: 1px solid var(--c-border);
    color: var(--c-text);
    transition: all .2s;
}
.pagination a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pagination .active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.pagination .disabled { color: #c0c6d3; background: #f7f8fb; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--c-text-muted); }

/* ---------- 图表 ---------- */
.chart-box { width: 100%; height: 280px; }

/* ---------- 提示条 ---------- */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    margin-bottom: 16px; font-size: 13px;
}
.alert-info { background: #eaf0ff; color: var(--c-primary); }

/* ---------- 工具类 ---------- */
.text-muted { color: var(--c-text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mr-10 { margin-right: 10px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.clickable { cursor: pointer; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
}
