/* 
 * 轻量化UI样式 - 遵循UI/UX设计规范
 */

/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9fafb;
    color: #1f2937;
    line-height: 1.6;
}

/* 通用组件样式 */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563EB, #1E40AF);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(59, 130, 246, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #D97706, #B45309);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(245, 158, 11, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(239, 68, 68, 0.3);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    background-color: #F8FAFC;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background-color: white;
    transform: translateY(-1px);
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table th {
    background: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 100%);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.table td {
    padding: 14px 16px;
    color: #4b5563;
}

.table tr:nth-child(even) {
    background-color: #F8FAFC;
}

.table tr:hover {
    background-color: #F0F9FF;
    transform: scale(1.01);
}

/* 布局样式 */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.main-layout {
    display: flex;
    width: 100%;
}

/* 侧边栏样式 */
.sidebar {
    width: 200px;
    background: linear-gradient(180deg, #1a2332 0%, #161d29 100%);
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.logo {
    padding: 20px 16px;
    font-size: 18px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav {
    padding: 20px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #cbd5e0;
    font-weight: 500;
    font-size: 14px;
    position: relative;
    border: none;
    text-decoration: none;
    color: inherit;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-item.active {
    background: rgba(37, 99, 235, 0.15);
    color: white;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: #3B82F6;
}

.nav-item i {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item span {
    flex: 1;
}

.user-info {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

#adminName {
    flex: 1;
    color: #e2e8f0;
    font-weight: 500;
    font-size: 14px;
}

#logoutBtn {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#logoutBtn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 200px;
    padding: 24px;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: none;
}

.section-header h2 {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 8px;
    font-weight: 700;
}

.section-header p {
    color: #6b7280;
    font-size: 16px;
}

.card-header {
    padding: 20px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8fafc;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569, #334155);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    border: none;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3B82F6, #8B5CF6);
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
    font-size: 20px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #1f2937;
    margin: 8px 0;
    background: linear-gradient(135deg, #1f2937, #4b5563);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

/* 消息提示 */
.message {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: none;
    animation: slideIn 0.3s ease;
    position: relative;
    overflow: hidden;
}

.message.success {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    display: block;
}

.message.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    display: block;
}

.message.info {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    display: block;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 表单样式 */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 15px;
    position: relative;
}

.form-group label::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background: #3B82F6;
    transition: width 0.3s ease;
    border: none;
}

.form-group:focus-within label::after {
    width: 24px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar .logo span,
    .nav-item span,
    .user-info span {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 14px;
    }
    
    .nav-item i {
        margin-right: 0;
    }
    
    .main-content {
        margin-left: 70px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 16px;
    }
    
    .section-header h2 {
        font-size: 22px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.close {
    color: #9ca3af;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #ef4444;
}

.modal-body {
    padding: 20px;
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* 编辑器样式 */
.editor-container {
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    overflow: hidden;
}

.editor-toolbar {
    padding: 10px;
    background: #f8fafc;
    border-bottom: 1px solid #cbd5e0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-content {
    padding: 16px;
    display: flex;
    flex-direction: row;
    gap: 16px;
}

.markdown-editor {
    flex: 1;
    min-height: 450px;
    padding: 16px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
    font-family: "Microsoft YaHei", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
}

.preview-container {
    flex: 1;
    min-width: 40%;
    height: 400px;
    border-left: 1px solid #e0e0e0;
    overflow: hidden;
    position: relative;
    background-color: white;
}

.editor-preview-container {
    display: flex;
    gap: 16px;
    width: 100%;
    margin-top: 10px;
}

.editor-column {
    flex: 1;
    min-width: 0; /* 允许flex项目收缩到其内容的固有大小以下 */
}

.preview-column {
    flex: 1;
    min-width: 0; /* 允许flex项目收缩到其内容的固有大小以下 */
    display: flex;
    flex-direction: column;
}

.editor {
    width: 100%;
    height: 400px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
    font-family: "Microsoft YaHei", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: white;
    box-sizing: border-box;
    outline: none;
    color: #1e293b;
    caret-color: #3b82f6;
    font-weight: 400;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.editor:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.preview-header {
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
    color: #1f2937;
}

.preview-content.create-page {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    overflow-y: auto;
    padding: 20px;
    background-color: white;
    border-radius: 10px;
}

.template-selector {
    margin-left: auto;
}

.form-control.template-selector {
    min-width: 100px;
    width: auto;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background-color: white;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-control.template-selector:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* 知识库分类按钮 */
.category-buttons-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-category {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #4b5563;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-category:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-category.active {
    background: #3B82F6;
    color: white;
    border-color: #3B82F6;
}

/* 知识库卡片网格 */
.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.knowledge-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.knowledge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.knowledge-card-header {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.knowledge-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    word-break: break-word;
}

.knowledge-card-body {
    padding: 16px;
    flex-grow: 1;
    overflow: hidden;
}

.knowledge-card-content {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.knowledge-card-footer {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
}

.knowledge-card-meta {
    font-size: 12px;
    color: #6b7280;
}

.knowledge-card-actions {
    display: flex;
    gap: 8px;
}

.knowledge-card-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    min-height: auto;
}

.category-tag {
    display: inline-block;
    padding: 4px 8px;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 16px;
}

.preview-content-wrapper h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #1f2937;
}

.content-meta {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
}

.preview-content {
    line-height: 1.6;
    color: #374151;
}

.preview-content-no-absolute {
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    line-height: 1.6;
    color: #374151;
}

.modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 20px;
    display: flex;
    justify-content: flex-end;
}

/* 分页控件样式 */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    padding: 10px;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 5px;
}

.pagination li {
    display: inline-block;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #ddd;
    color: #333;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background-color: #e0e0e0;
}

.pagination .active {
    background-color: #1d4ed8;
    color: white;
    border-color: #1d4ed8;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(29, 78, 216, 0.4);
    transform: scale(1.05);
    transition: all 0.3s ease;
}

.pagination .disabled {
    color: #999;
    cursor: not-allowed;
    background-color: #f5f5f5;
    border-color: #ddd;
}

.pagination .active a {
    color: white;
}

.pagination-container[style*="display: none"] {
    display: none !important;
}

/* 状态徽章样式 */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.3);
}

.badge-error {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.badge-default {
    background: linear-gradient(135deg, #6B7280, #4B5563);
    color: white;
    box-shadow: 0 4px 6px rgba(107, 114, 128, 0.3);
}

.badge-published {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.badge-draft {
    background: linear-gradient(135deg, #6B7280, #4B5563);
    color: white;
    box-shadow: 0 4px 6px rgba(107, 114, 128, 0.3);
}

.badge-pending {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.3);
}

.badge-rejected {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.3);
}

.badge-processing {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

