:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #2563eb;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--content-bg);
    color: var(--text-dark);
}

/* ===== 登录页 ===== */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ===== 管理后台布局 ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand i {
    margin-right: 8px;
    color: #60a5fa;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-menu .nav-item {
    margin: 2px 12px;
}

.sidebar-menu .nav-link {
    color: #cbd5e1;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar-menu .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-menu .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-menu .nav-link i {
    width: 20px;
    margin-right: 10px;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 0;
}

.topbar {
    background: #fff;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.content-area {
    padding: 24px 32px;
}

/* 卡片 */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
}

/* 统计卡片 */
.stat-card {
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    opacity: 0.9;
}

/* 表格 */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.table td {
    vertical-align: middle;
}

/* 按钮 */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* 上传区域 */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-area i {
    font-size: 48px;
    color: var(--primary);
}

/* 树形结构 */
.tree-view {
    list-style: none;
    padding-left: 0;
}

.tree-view ul {
    list-style: none;
    padding-left: 24px;
}

.tree-node {
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.tree-node:hover {
    background: #f1f5f9;
}

.tree-node .tree-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-toggle {
    cursor: pointer;
    width: 16px;
    display: inline-block;
    text-align: center;
}

/* 分页 */
.pagination {
    margin-bottom: 0;
}

/* 标签 */
.badge-active {
    background: #dcfce7;
    color: #16a34a;
}

.badge-inactive {
    background: #fee2e2;
    color: #dc2626;
}

/* 页面切换 */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .content-area {
        padding: 16px;
    }
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast 通知 */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9999;
}
