/* ============================================
   天安保安 - 后台管理样式 (Premium Edition)
   ============================================ */

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

:root {
    /* 主色调 - 深邃墨蓝 */
    --navy: #0a1f3d;
    --navy-light: #14305c;
    --navy-dark: #050f1f;
    --navy-gradient: linear-gradient(160deg, #0a1f3d 0%, #112a52 100%);
    --navy-gradient-deep: linear-gradient(180deg, #050f1f 0%, #0a1f3d 100%);

    /* 金色 - 奢华质感 */
    --gold: #c9a227;
    --gold-light: #e0bc42;
    --gold-dark: #a8861a;
    --gold-gradient: linear-gradient(135deg, #d4af37 0%, #f0d068 50%, #c9a227 100%);
    --gold-gradient-soft: linear-gradient(135deg, rgba(212,175,55,.12) 0%, rgba(240,208,104,.08) 100%);

    /* 基础色 */
    --white: #fff;
    --bg: #f5f6fa;
    --bg-alt: #eef0f5;
    --card-bg: #fff;
    --text: #1a2233;
    --text-light: #5a6577;
    --text-lighter: #9ca3b0;

    /* 边框与阴影 */
    --border: #e3e7ed;
    --border-light: #eef1f5;

    /* 语义色 - 更沉稳 */
    --green: #0d9e5e;
    --green-bg: #e6f7ef;
    --green-border: #b8ebcf;
    --red: #d63b3b;
    --red-bg: #fcebeb;
    --red-border: #f5c2c2;
    --orange: #e07b1a;
    --orange-bg: #fdf3e6;
    --orange-border: #f5d4a8;
    --blue: #2563eb;
    --blue-bg: #ebf2ff;
    --blue-border: #c5d8f9;
    --purple: #7c3aed;
    --purple-bg: #f3eefe;
    --purple-border: #ddd0f7;

    /* 阴影系统 */
    --shadow-xs: 0 1px 2px rgba(10,31,61,.04);
    --shadow-sm: 0 1px 3px rgba(10,31,61,.06), 0 1px 2px rgba(10,31,61,.04);
    --shadow-md: 0 4px 16px rgba(10,31,61,.08), 0 2px 6px rgba(10,31,61,.05);
    --shadow-lg: 0 12px 36px rgba(10,31,61,.12), 0 4px 12px rgba(10,31,61,.06);
    --shadow-xl: 0 24px 60px rgba(10,31,61,.16), 0 8px 24px rgba(10,31,61,.08);
    --shadow-gold: 0 4px 16px rgba(201,162,39,.25);
    --shadow-navy: 0 4px 16px rgba(10,31,61,.2);

    /* 圆角 */
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --sidebar-w: 250px;
    --transition: all .28s cubic-bezier(.4,0,.2,1);
    --transition-fast: all .15s cubic-bezier(.4,0,.2,1);
}

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

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* --- Layout --- */
.admin-layout { display: flex; min-height: 100vh; }

/* ============================================
   SIDEBAR - 深色渐变侧边栏
   ============================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy-gradient-deep);
    color: rgba(255,255,255,.8);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 4px 0 24px rgba(5,15,31,.15);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 24px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.02);
}
.logo-info { display: flex; flex-direction: column; }
.logo-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 1.5px;
}
.logo-sub {
    font-size: 11px;
    color: var(--gold);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

/* 滚动条美化 */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.6);
    font-size: 14px;
    font-weight: 400;
    transition: var(--transition);
    margin-bottom: 3px;
    position: relative;
    overflow: hidden;
}
.nav-item::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--gold-gradient);
    transform: scaleY(0);
    transition: var(--transition);
    border-radius: 0 3px 3px 0;
}
.nav-item:hover {
    background: rgba(255,255,255,.06);
    color: var(--white);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(201,162,39,.15) 0%, rgba(201,162,39,.05) 100%);
    color: var(--gold-light);
    font-weight: 500;
}
.nav-item.active::before { transform: scaleY(1); }
.nav-icon { font-size: 17px; width: 24px; text-align: center; flex-shrink: 0; }

.nav-badge {
    position: absolute;
    right: 12px;
    background: linear-gradient(135deg, var(--red) 0%, #e85555 100%);
    color: var(--white);
    font-size: 11px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(214,59,59,.4);
}

.nav-group { margin-top: 14px; }
.nav-group-title {
    font-size: 10px;
    color: rgba(255,255,255,.25);
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 4px 16px 8px;
    font-weight: 600;
}

.sidebar-footer { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: rgba(255,255,255,.4);
    font-size: 13px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.sidebar-link:hover { background: rgba(255,255,255,.05); color: var(--white); }

/* ============================================
   MAIN WRAP
   ============================================ */
.main-wrap {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* --- Topbar --- */
.topbar {
    height: 66px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: var(--shadow-sm);
}
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}
.menu-toggle span { width: 22px; height: 2px; background: var(--navy); border-radius: 1px; }
.topbar-title {
    font-size: 19px;
    font-weight: 600;
    color: var(--navy);
    flex: 1;
    letter-spacing: .5px;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); font-weight: 500; }
.user-avatar {
    width: 38px; height: 38px;
    background: var(--navy-gradient);
    color: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid var(--gold);
    box-shadow: var(--shadow-gold);
}

/* --- Content --- */
.content { flex: 1; padding: 28px; }

/* ============================================
   CARDS - 精致卡片
   ============================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 20px 26px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: .3px;
}
.card-body { padding: 26px; }

/* ============================================
   STATS CARDS - 数据概览卡片
   ============================================ */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 50%;
    opacity: .04;
    transform: translate(30px, -30px);
    transition: var(--transition);
}
.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}
.stat-card:hover::after { transform: translate(20px, -20px) scale(1.5); opacity: .06; }

.stat-card-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    transition: var(--transition);
}
.stat-card:hover .stat-card-icon { transform: scale(1.08); }
.stat-card-icon.bg-blue { background: linear-gradient(135deg, var(--blue-bg) 0%, #dce8ff 100%); }
.stat-card-icon.bg-green { background: linear-gradient(135deg, var(--green-bg) 0%, #d4f5e5 100%); }
.stat-card-icon.bg-orange { background: linear-gradient(135deg, var(--orange-bg) 0%, #fce8cf 100%); }
.stat-card-icon.bg-purple { background: linear-gradient(135deg, var(--purple-bg) 0%, #ebe2ff 100%); }
.stat-card-info { flex: 1; }
.stat-card-value { font-size: 30px; font-weight: 700; color: var(--navy); line-height: 1.2; letter-spacing: -.5px; }
.stat-card-label { font-size: 13px; color: var(--text-light); margin-top: 4px; font-weight: 500; }

/* ============================================
   BUTTONS - 高端按钮系统
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: .3px;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.15) 0%, transparent 50%);
    pointer-events: none;
}

/* 主按钮 - 深蓝渐变 */
.btn-primary {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: var(--white);
    box-shadow: var(--shadow-navy);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--navy-light) 0%, #1e3d70 100%);
    box-shadow: 0 6px 20px rgba(10,31,61,.3);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* 金色按钮 - 奢华质感 */
.btn-gold {
    background: var(--gold-gradient);
    color: var(--navy-dark);
    font-weight: 600;
    box-shadow: var(--shadow-gold);
}
.btn-gold:hover {
    background: linear-gradient(135deg, #e0bc42 0%, #f5d870 50%, #d4af37 100%);
    box-shadow: 0 6px 20px rgba(201,162,39,.4);
    transform: translateY(-1px);
}
.btn-gold:active { transform: translateY(0); }

/* 危险按钮 */
.btn-danger {
    background: linear-gradient(135deg, var(--red) 0%, #e85555 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(214,59,59,.25);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #c53030 0%, #d63b3b 100%);
    box-shadow: 0 6px 20px rgba(214,59,59,.35);
    transform: translateY(-1px);
}

/* 成功按钮 */
.btn-success {
    background: linear-gradient(135deg, var(--green) 0%, #12b370 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(13,158,94,.25);
}
.btn-success:hover {
    box-shadow: 0 6px 20px rgba(13,158,94,.35);
    transform: translateY(-1px);
}

/* 轮廓按钮 - 精致边框 */
.btn-outline {
    background: var(--white);
    border: 1.5px solid var(--border);
    color: var(--text-light);
}
.btn-outline:hover {
    border-color: var(--navy);
    color: var(--navy);
    background: #f8f9fb;
    box-shadow: var(--shadow-xs);
}

/* 文本按钮 */
.btn-text {
    background: transparent;
    color: var(--blue);
    padding: 4px 8px;
}
.btn-text:hover { color: #1d4ed8; background: var(--blue-bg); }

/* 编辑按钮 - 蓝色渐变，清晰可辨 */
.btn-edit {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: #fff;
    border: none;
    text-decoration: none;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(37,99,235,.25);
    transition: all .2s;
}
.btn-edit:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
    transform: translateY(-1px);
}
.btn-edit:active { transform: translateY(0); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

/* 表格操作列 */
.actions-cell { white-space: nowrap; }
.actions-cell .btn-sm { margin-right: 6px; }

/* ============================================
   TABLE - 数据表格
   ============================================ */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 14px 18px;
    background: var(--bg-alt);
    color: var(--text-light);
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    letter-spacing: .3px;
}
.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
.data-table tbody tr { transition: var(--transition-fast); }
.data-table tbody tr:hover { background: #f8f9fb; }
.data-table .actions { display: flex; gap: 8px; white-space: nowrap; }

/* ============================================
   BADGES - 状态标签
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .3px;
    border: 1px solid transparent;
}
.badge-green { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.badge-red { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.badge-blue { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }
.badge-orange { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-border); }
.badge-gray { background: #f1f5f9; color: var(--text-light); border-color: #e2e8f0; }
.badge-gold { background: var(--gold-gradient-soft); color: var(--gold-dark); border-color: rgba(201,162,39,.2); }

/* ============================================
   FORMS - 表单
   ============================================ */
.form-group { margin-bottom: 22px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: .3px;
}
.form-group label .req { color: var(--red); margin-left: 2px; }
.form-control {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
    color: var(--text);
}
.form-control:hover { border-color: #c8cfd9; }
.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(201,162,39,.1);
}
.form-control::placeholder { color: var(--text-lighter); }
textarea.form-control { resize: vertical; min-height: 120px; line-height: 1.7; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border-light); }
.form-hint { font-size: 12px; color: var(--text-lighter); margin-top: 6px; }

/* ============================================
   ALERTS - 提示框
   ============================================ */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-success { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.alert-error { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }

/* ============================================
   FILTER BAR - 筛选栏
   ============================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.filter-bar .form-control { width: auto; min-width: 180px; }

/* ============================================
   PAGINATION - 分页
   ============================================ */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; align-items: center; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    transition: var(--transition);
    font-weight: 500;
}
.pagination a:hover {
    border-color: var(--navy);
    color: var(--navy);
    background: #f8f9fb;
}
.pagination .current {
    background: var(--navy-gradient);
    color: var(--white);
    border-color: var(--navy);
    box-shadow: var(--shadow-navy);
}

/* ============================================
   LOGIN PAGE - 登录页
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-gradient-deep);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 85%, rgba(201,162,39,.15) 0%, transparent 45%),
        radial-gradient(circle at 85% 15%, rgba(201,162,39,.10) 0%, transparent 45%);
}
.login-page::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
    background-size: 50px 50px;
}
.login-card {
    position: relative;
    z-index: 1;
    width: 420px;
    max-width: 92%;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(201,162,39,.08);
    overflow: hidden;
}
.login-header {
    background: var(--navy-gradient);
    padding: 40px 32px;
    text-align: center;
    color: var(--white);
    position: relative;
    overflow: hidden;
}
.login-header::after {
    content: "";
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 3px;
    background: var(--gold-gradient);
}
.login-header svg { margin-bottom: 14px; filter: drop-shadow(0 4px 12px rgba(201,162,39,.3)); }
.login-header h1 { font-size: 23px; font-weight: 700; letter-spacing: 3px; }
.login-header p { font-size: 13px; color: var(--gold-light); margin-top: 8px; letter-spacing: 1px; }
.login-body { padding: 36px 32px 28px; }
.login-body .form-group { margin-bottom: 20px; }
.login-body .form-control { padding: 13px 16px; font-size: 15px; }
.login-btn {
    width: 100%;
    padding: 15px;
    background: var(--gold-gradient);
    color: var(--navy-dark);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 2px;
    box-shadow: var(--shadow-gold);
}
.login-btn:hover {
    background: linear-gradient(135deg, #e0bc42 0%, #f5d870 50%, #d4af37 100%);
    box-shadow: 0 8px 24px rgba(201,162,39,.4);
    transform: translateY(-1px);
}
.login-btn:active { transform: translateY(0); }
.login-footer { text-align: center; padding: 0 32px 28px; font-size: 12px; color: var(--text-lighter); }

/* ============================================
   EMPTY STATE - 空状态
   ============================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-lighter); }
.empty-state .icon { font-size: 52px; margin-bottom: 16px; opacity: .6; }
.empty-state p { font-size: 15px; }

/* ============================================
   SECTION DIVIDER - 区块分隔
   ============================================ */
.section-divider-line {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--border) 20%, var(--border) 80%, transparent 100%);
    margin: 28px 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-wrap { margin-left: 0; }
    .menu-toggle { display: flex; }
    .stats-row { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}
