/* 后台管理样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 400px;
    padding: 40px;
}
.login-box h1 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 8px;
    color: #333;
}
.login-box .subtitle {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-bottom: 30px;
}
.login-box .form-group { margin-bottom: 20px; }
.login-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}
.login-box input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.login-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
.login-box .btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}
.login-box .btn-login:hover { transform: translateY(-1px); }
.login-box .error {
    background: #fef0f0;
    color: #f56c6c;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: #001529;
    color: #fff;
    flex-shrink: 0;
}
.sidebar .logo {
    padding: 20px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid #1f2937;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.sidebar .menu { padding: 10px 0; }
.sidebar .menu-item {
    display: block;
    padding: 12px 24px;
    color: #a0aec0;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar .menu-item:hover {
    color: #fff;
    background: #1f2937;
}
.sidebar .menu-item.active {
    color: #fff;
    background: #667eea;
    border-left-color: #fff;
}
.sidebar .menu-item .icon { margin-right: 10px; }

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.header {
    background: #fff;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.header .page-title { font-size: 18px; font-weight: 600; }
.header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}
.header .user-info a {
    color: #666;
    text-decoration: none;
}
.header .user-info a:hover { color: #667eea; }

.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
}
.stat-card .stat-info h4 { font-size: 14px; color: #999; margin-bottom: 6px; font-weight: normal; }
.stat-card .stat-info .stat-value { font-size: 28px; font-weight: bold; color: #333; }
.stat-card.blue .stat-icon { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-card.green .stat-icon { background: linear-gradient(135deg, #11998e, #38ef7d); }
.stat-card.orange .stat-icon { background: linear-gradient(135deg, #f093fb, #f5576c); }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, #4facfe, #00f2fe); }

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}
.table th {
    background: #fafafa;
    font-weight: 600;
    color: #666;
}
.table tr:hover { background: #fafafa; }
.table .actions { display: flex; gap: 8px; }

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn-primary {
    background: #667eea;
    color: #fff;
}
.btn-primary:hover { background: #5a67d8; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-default { background: #f3f4f6; color: #374151; }
.btn-default:hover { background: #e5e7eb; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* 表单 */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; }
.form-inline .form-group { margin-bottom: 0; }

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}
.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.switch input:checked + .slider { background-color: #667eea; }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 标签 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
}
.pagination .current {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* 提示框 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* 模态框 */
.modal-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    width: 480px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 16px; }
.modal-header .close {
    cursor: pointer;
    font-size: 20px;
    color: #999;
}
.modal-body { padding: 20px; }
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; }

/* 权限列表 */
.perm-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.perm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 13px;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .logo { font-size: 14px; padding: 15px 5px; }
    .sidebar .menu-item { padding: 12px; text-align: center; }
    .sidebar .menu-item span:not(.icon) { display: none; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
}
