/* 知识库系统 — 现代主题 */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --accent: #0ea5e9;
    --bg-page: #f0f4f8;
    --bg-card: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.12);
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    background: var(--bg-page) !important;
    color: var(--text);
    min-height: 100vh;
}

/* 顶栏 */
.app-navbar {
    background: linear-gradient(120deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%) !important;
    box-shadow: 0 4px 20px rgba(49, 46, 129, 0.35);
    padding: 0.65rem 0;
}

.app-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}

.app-navbar .navbar-brand i {
    color: #a5b4fc;
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.82) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    margin: 0 2px;
    transition: background 0.2s, color 0.2s;
}

.app-navbar .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.12);
}

.app-navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.2);
}

.app-navbar .dropdown-menu {
    border: none;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.app-navbar .dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 1rem;
}

.app-navbar .dropdown-item:hover {
    background: #eef2ff;
    color: var(--primary);
}

#authUserBadge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* 主内容区 */
.page-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

/* 页面标题区 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-breadcrumb {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.page-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.page-breadcrumb a:hover {
    color: var(--primary);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.page-title-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.page-title-icon.work { background: #fef2f2; color: #dc2626; }
.page-title-icon.business { background: #eff6ff; color: #2563eb; }
.page-title-icon.knowledge { background: #f0fdf4; color: #16a34a; }

.btn-app-primary {
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s;
}

.btn-app-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

.btn-app-outline {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
    font-weight: 500;
}

.btn-app-outline:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: #f8fafc;
}

/* 搜索区 */
.search-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.search-panel .search-inner {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-panel .search-field {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-panel .search-field i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 2;
}

.search-panel .search-field input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-panel .search-field input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-panel .btn-search {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
}

.search-panel .btn-search:hover {
    background: var(--primary-dark);
    color: #fff;
}

.search-panel .btn-reset {
    background: #f1f5f9;
    color: var(--text-secondary);
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
}

.search-panel .btn-reset:hover {
    background: #e2e8f0;
    color: var(--text);
}

/* 列表面板 */
.panel-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    border-bottom: 1px solid var(--border);
}

.panel-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-card-header .count-badge {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.panel-card-body {
    padding: 0;
    min-height: 200px;
}

/* 文档列表 */
.document-list .document-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.document-list .document-item:last-child {
    border-bottom: none;
}

.document-list .document-item:hover {
    background: #f8fafc;
}

.document-list .doc-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.document-list .doc-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.document-list .doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.document-list .doc-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.document-list .doc-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.document-list .doc-actions .btn-view {
    background: #eef2ff;
    color: var(--primary);
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

.document-list .doc-actions .btn-view:hover {
    background: #e0e7ff;
}

.document-list .doc-actions .btn-dl {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.document-list .doc-actions .btn-dl:hover {
    background: var(--primary-dark);
    color: #fff;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary-light);
}

.empty-state h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading-state i {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

/* 知识库页 */
.knowledge-page .top-nav-bar {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 1rem;
}

.knowledge-page .nav-tab {
    padding: 0.5rem 1.25rem;
    background: #f8fafc;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.knowledge-page .nav-tab:hover {
    background: #eef2ff;
    color: var(--primary);
}

.knowledge-page .nav-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

#selectCategoryHint {
    background: #eef2ff !important;
    border: 1px solid #c7d2fe !important;
    color: #4338ca !important;
    border-radius: var(--radius) !important;
}

.kb-layout {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--border) !important;
}

.kb-sidebar .tree-header {
    background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
    font-weight: 600;
}

.knowledge-tree .tree-item {
    border-radius: 8px;
    margin: 2px 0;
    padding: 0.5rem 0.65rem !important;
}

.knowledge-tree .tree-item:hover {
    background: #eef2ff !important;
}

.knowledge-tree .tree-item.active {
    background: #e0e7ff !important;
    color: var(--primary-dark) !important;
    font-weight: 600;
}

/* 模态框 */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

/* 管理页表格区 */
.admin-documents .card,
.admin-documents table {
    border-radius: var(--radius-lg);
}

.admin-documents .table thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
}

.admin-documents .table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
}

.admin-documents .table tbody tr:hover {
    background: #f8fafc;
}

/* ========== 骨架屏 ========== */
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #e8ecf1 0%,
        #f4f6f9 45%,
        #e8ecf1 90%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
    display: block;
}

.skeleton-line {
    margin-bottom: 0.5rem;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

.skeleton-tab {
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
}

.business-nav.skeleton-loading {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.skeleton-tree {
    padding: 0.5rem 0.75rem 1rem;
}

.skeleton-tree-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0;
}

.skeleton-tree-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
}

.skeleton-path {
    height: 36px;
    border-radius: 8px;
    width: 75%;
}

.skeleton-title {
    height: 28px;
    width: 55%;
    border-radius: 8px;
}

.skeleton-section-title {
    height: 18px;
    width: 120px;
}

.skeleton-section {
    padding: 0.25rem 0;
}

.skeleton-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skeleton-chip {
    border-radius: 20px !important;
    margin-bottom: 0 !important;
}

.skeleton-kb-detail {
    padding: 0.25rem 0;
}

.skeleton-doc-list {
    padding: 0.25rem 0;
}

.skeleton-doc-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.skeleton-doc-row:last-child {
    border-bottom: none;
}

.skeleton-doc-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    flex-shrink: 0;
}

.skeleton-doc-body {
    flex: 1;
    min-width: 0;
}

.skeleton-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.skeleton-doc-meta .skeleton-line {
    margin-bottom: 0;
}

.skeleton-doc-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.skeleton-btn {
    width: 64px;
    height: 34px;
    border-radius: 8px;
    margin-bottom: 0 !important;
}

.skeleton-table-row td {
    padding: 0.85rem 1rem !important;
}

.skeleton-case-detail .skeleton-line {
    margin-bottom: 0.65rem;
}
