/* 后台通用样式 - 现代简洁 */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --radius: 0.5rem;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-700);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 登录页 */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    color: var(--gray-900);
    text-align: center;
}

.login-box .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--gray-700);
}
.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

/* 后台布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--gray-900);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    padding: 1.2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.sidebar-menu { list-style: none; margin: 0; padding: 0.75rem 0; }
.sidebar-menu li a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: rgba(255,255,255,0.85);
    border-left: 3px solid transparent;
}
.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-left-color: var(--primary);
    text-decoration: none;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--shadow);
}

.topbar .user { color: var(--gray-500); }

.content {
    padding: 1.5rem;
    flex: 1;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 1.25rem; }

/* 统计卡片 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    border-left: 4px solid var(--primary);
}
.stat-card.green { border-left-color: var(--success); }
.stat-card.orange { border-left-color: var(--warning); }
.stat-card.red { border-left-color: var(--danger); }
.stat-card .label { color: var(--gray-500); font-size: 13px; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); margin-top: 0.25rem; }

/* 表单 */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
table th, table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    text-align: left;
}
table th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 13px;
}
table tr:hover { background: var(--gray-50); }

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* 分页 */
.pagination {
    display: flex;
    gap: 0.35rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.7rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--gray-700);
    background: #fff;
}
.page-item:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-item.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    align-items: flex-end;
}
.search-bar .form-group { margin-bottom: 0; min-width: 160px; }

/* Tab */
.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1rem;
}
.tab-nav a {
    padding: 0.6rem 1rem;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
}
.tab-nav a:hover,
.tab-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    text-decoration: none;
}

/* 小标签 */
.text-muted { color: var(--gray-500); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.justify-between { justify-content: space-between; }
