/* ============================================================================
   样式表 - style.css
   ============================================================================
   
   知识分享网站样式设计
   风格：现代简约、卡片式布局、清新舒适
   
   文件位置：static/css/style.css
*/

/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* ==================== 导航栏样式 ==================== */
.nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
}

.nav a:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* ==================== 主容器 ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 10px;
}

/* ==================== 页面标题 ==================== */
.page-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.page-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.page-header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* ==================== 搜索框 ==================== */
.search-box {
    max-width: 600px;
    margin: 30px auto;
    display: flex;
    gap: 10px;
}

.search-box input[type="text"] {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.search-box button {
    padding: 15px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: #5568d3;
    transform: scale(1.05);
}

/* ==================== 分类标签 ==================== */
.category-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.category-tab {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #555;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.category-tab:hover,
.category-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

/* 标签筛选区域 */
.tag-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-tab {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    font-size: 0.9em;
}

.tag-tab:hover,
.tag-tab.active {
    background: white;
    border-color: #764ba2;
    color: #764ba2;
    transform: translateY(-1px);
}

/* ==================== 卡片网格布局 ==================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

/* ==================== 知识卡片 ==================== */
.card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-title {
    font-size: 1.1em;
    margin-bottom: 8px;
}

.card-category {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 0.85em;
}

.card-body {
    padding: 15px;
}

.card-excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 0.9em;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.card-date {
    color: #999;
    font-size: 0.9em;
}

.card-tags {
    display: flex;
    gap: 5px;
}

.tag {
    padding: 3px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 10px;
    font-size: 0.8em;
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

/* ==================== 表单样式 ==================== */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* ==================== 表格样式 ==================== */
.table-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    font-weight: 600;
    transition: all 0.2s ease;
}

/* 表格行 hover 效果 - 只影响 tbody */
tbody tr:hover {
    background: #f8f9fa;
}

/* 表格头 hover 效果 */
thead tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==================== 消息提示 ==================== */
.flash-messages {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    max-width: 400px;
}

.flash {
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
    width: auto;
    max-width: 100%;
    word-break: break-word;
}

/* ==================== 编辑器样式 ==================== */
/* SimpleMDE Markdown 编辑器 */
.editor-preview-full {
    z-index: 2001 !important;
}

/* CodeMirror 代码编辑器 */
.CodeMirror {
    height: 450px !important;
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: border-color 0.3s ease;
}

.CodeMirror:focus-within {
    border-color: #667eea;
}

/* SimpleMDE 编辑器高度 */
.editor-toolbar + .CodeMirror {
    border-radius: 0 0 8px 8px;
    border-top: none;
}

/* 模态框中的表单组 */
.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

/* 模态框最大化 */
.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

/* 自定义滚动条 */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 15px;
}

.empty-state-icon {
    font-size: 4em;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #999;
    margin-bottom: 10px;
}

.empty-state p {
    color: #bbb;
}

/* ==================== 后台管理布局 ==================== */
.admin-layout {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 左侧边栏 */
.admin-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 150px);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

/* 菜单项容器 */
.menu-item {
    margin-bottom: 8px;
}

/* 菜单头部（可点击区域） */
.menu-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.menu-header:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 箭头图标 */
.menu-arrow {
    display: inline-block;
    width: 20px;
    font-size: 12px;
    transition: transform 0.3s ease;
    color: #999;
}

.menu-header:hover .menu-arrow {
    color: white;
}

.sidebar-menu a {
    display: block;
    padding: 12px 15px;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(5px);
}

/* 二级菜单样式 */
.submenu {
    list-style: none;
    margin-top: 5px;
    padding-left: 15px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

.submenu.open {
    max-height: 500px; /* 足够大的值容纳所有子项 */
    transition: max-height 0.5s ease-in;
}

.submenu li a {
    font-size: 0.9em;
    padding: 8px 12px !important;
    background: #f8f9fa !important;
    color: #666 !important;
}

.submenu li a:hover {
    background: #e3f2fd !important;
    color: #1976d2 !important;
    transform: translateX(3px) !important;
}

.sidebar-menu .category-count {
    float: right;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    color: white;
    font-weight: bold;
}

/* 浅色背景下的数字计数 */
.sidebar-menu a:not(.menu-header) .category-count,
.submenu li a .category-count {
    background: #e3f2fd;
    color: #1976d2;
}

/* 右侧主内容区 */
.admin-main {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: calc(100vh - 150px);
}

/* 管理操作栏 */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.admin-search {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.admin-search input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.admin-search input:focus {
    outline: none;
    border-color: #667eea;
}

.admin-actions {
    display: flex;
    gap: 10px;
}

/* 内容网格 */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 管理卡片 */
.admin-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.admin-card:hover {
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.admin-card-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    flex: 1;
}

.admin-card-actions {
    display: flex;
    gap: 5px;
}

.admin-card-actions button {
    padding: 5px 10px;
    font-size: 0.85em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit {
    background: #e3f2fd;
    color: #1976d2;
}

.btn-edit:hover {
    background: #1976d2;
    color: white;
}

.btn-delete {
    background: #ffebee;
    color: #f44336;
}

.btn-delete:hover {
    background: #f44336;
    color: white;
}

.admin-card-body {
    color: #666;
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 10px;
}

.admin-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.85em;
    color: #999;
}

/* 复选框样式 */
.card-checkbox {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.knowledge-table {
    width: 100%;
    border-collapse: collapse;
}

.knowledge-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.knowledge-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    transition: all 0.2s ease;
}

.knowledge-table th:hover {
    background: rgba(255, 255, 255, 0.1);
    cursor: default;
}

.knowledge-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.knowledge-table tbody tr:hover {
    background: #f8f9fa;
}

.table-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 1em;
}

.table-excerpt {
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
}

.category-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 0.85em;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px 8px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    font-size: 3em;
    color: #ddd;
    margin-bottom: 15px;
}

.empty-state h3 {
    color: #999;
    margin-bottom: 10px;
}

.empty-state p {
    color: #bbb;
}

/* 开关切换样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* 私有分类专用红色开关样式 */
input:checked + .private-slider {
    background-color: #ff6b6b;
}

/* 表格中的开关样式 */
.knowledge-table .switch {
    margin-left: 10px;
}

/* 统计信息 */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.stat-card h3 {
    font-size: 1.8em;
    margin: 0;
    font-weight: bold;
}

.stat-card p {
    margin: 4px 0 0 0;
    font-size: 0.85em;
    opacity: 0.9;
}

/* ==================== 模态框样式 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none; /* 默认隐藏 */
    align-items: center;
    justify-content: center;
}

/* 当模态框显示时的样式 */
.modal[style*="display: block"] {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    margin: 0;
    color: #667eea;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.form-section {
    margin-bottom: 25px;
}

.form-section h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-input {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.category-list {
    max-height: 400px;
    overflow-y: auto;
}

.category-item {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.category-item:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.category-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-actions {
    display: flex;
    gap: 5px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.tag-list {
    max-height: 400px;
    overflow-y: auto;
}

.tag-item {
    padding: 12px 15px;
    background: #e3f2fd;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.tag-item:hover {
    background: #bbdefb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tag-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tag-actions {
    display: flex;
    gap: 5px;
}

/* ============================================================================
   响应式设计 - 媒体查询
   ============================================================================ */

/* 平板和手机适配（屏幕宽度小于 768px） */
@media (max-width: 768px) {
    /* 导航栏调整 */
    .nav-container {
        flex-direction: column;
        gap: 15px;
        padding: 10px 15px;
    }
    
    .nav-brand {
        font-size: 20px;
    }
    
    .nav-links {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav a {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    /* 主容器调整 */
    .container {
        padding: 20px 15px;
    }
    
    /* 页面标题 */
    .page-header h1 {
        font-size: 1.8em;
    }
    
    /* 搜索框 */
    .search-box {
        flex-direction: column;
    }
    
    .search-box input[type="text"],
    .search-box button {
        width: 100%;
    }
    
    /* 卡片网格变为单列 */
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    /* 后台管理布局调整为纵向 */
    .admin-layout {
        flex-direction: column;
        gap: 15px;
    }
    
    /* 侧边栏全宽显示 */
    .admin-sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
        overflow-y: auto;
    }
    
    /* 主内容区调整 */
    .admin-main {
        min-height: auto;
    }
    
    /* 统计卡片调整 */
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 工具栏调整 */
    .admin-toolbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .admin-search {
        width: 100%;
        max-width: none;
    }
    
    .admin-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .admin-actions button {
        flex: 1;
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* 内容网格调整 */
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    /* 表格在手机上横向滚动 */
    .table-container {
        overflow-x: auto;
    }
    
    .knowledge-table {
        min-width: 600px;
    }
}

/* 小屏手机（屏幕宽度小于 480px） */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .nav-brand {
        font-size: 18px;
    }
    
    .page-header h1 {
        font-size: 1.5em;
    }
    
    /* 统计卡片单列显示 */
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    /* 按钮文字调整 */
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    /* 卡片内边距减小 */
    .card-header,
    .card-body,
    .card-footer {
        padding: 15px;
    }
}

/* ==================== 分页组件样式 ==================== */
.pagination-container {
    margin-top: 40px;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.pagination-info {
    color: white;
    font-size: 14px;
    text-align: center;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.per-page-selector label {
    color: white;
    font-size: 14px;
}

.per-page-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.per-page-selector select:hover {
    border-color: #667eea;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.pagination li {
    display: inline-block;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    min-width: 40px;
    text-align: center;
}

.pagination a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pagination li.active span {
    background: #667eea;
    color: white;
    border-color: #667eea;
    cursor: default;
}

.pagination li.disabled span {
    color: #ccc;
    cursor: not-allowed;
    background: #f5f5f5;
}

.pagination li.disabled a {
    color: #ccc;
    cursor: not-allowed;
    background: #f5f5f5;
}

.pagination li.disabled a:hover {
    background: #f5f5f5;
    color: #ccc;
    transform: none;
    box-shadow: none;
}

/* ==================== 后台管理分页样式（覆盖白色文字） ==================== */
/* 后台背景是白色，所以文字需要用深色 */
.admin-main .pagination-container {
    margin-top: 30px;
}

.admin-main .pagination-info {
    color: #666;
}

.admin-main .per-page-selector label {
    color: #666;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .pagination-container {
        margin-top: 30px;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .per-page-selector {
        order: 2;
    }
    
    .pagination {
        order: 1;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination a,
    .pagination span {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 35px;
    }
}