:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --sidebar-bg: #1f2937;
    --sidebar-text: #9ca3af;
    --sidebar-hover: #374151;
    --sidebar-active: #4f46e5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* 左侧导航布局 */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--sidebar-hover);
}

.sidebar-header h1 {
    font-size: 1.3rem;
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-nav a.active {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--sidebar-active);
}

.sidebar-nav .nav-icon {
    margin-right: 10px;
    font-size: 1.1rem;
}

.sidebar-nav .logout-link {
    margin-top: auto;
    border-top: 1px solid var(--sidebar-hover);
}

.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 20px;
    max-width: calc(100% - 220px);
}

/* 旧导航（保留兼容） */
.navbar {
    background: var(--card-bg);
    padding: 15px 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar h1 { font-size: 1.5rem; color: var(--primary); }
.navbar nav a {
    margin-left: 20px;
    text-decoration: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}
.navbar nav a:hover, .navbar nav a.active {
    background: var(--primary);
    color: white;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 1.2rem; }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.stat-card .label { color: var(--text-muted); font-size: 0.9rem; }
.stat-card .value { font-size: 2rem; font-weight: bold; color: var(--primary); }

/* 表格 */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; }
tr:hover { background: #f9fafb; }

/* 按钮 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* 表单 */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}
.form-control:focus { outline: none; border-color: var(--primary); }

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* 登录页 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}
.login-box h1 { text-align: center; margin-bottom: 30px; color: var(--primary); }

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.show { display: flex; }
.modal-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; }

/* 分页 */
.pagination { display: flex; gap: 5px; margin-top: 15px; }
.pagination a, .pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text);
}
.pagination a:hover { background: var(--bg); }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-header h1 {
        display: none;
    }
    .sidebar-nav a span:not(.nav-icon) {
        display: none;
    }
    .sidebar-nav .nav-icon {
        margin-right: 0;
    }
    .main-content {
        margin-left: 60px;
        max-width: calc(100% - 60px);
    }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
