/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 字体设置 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 日间主题 */
body.light-theme {
    background-color: #f5f7fa;
    color: #333;
}

/* 夜间主题 */
body.dark-theme {
    background-color: #1e1e2e;
    color: #e0e0e0;
}

/* 顶部导航栏 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

body.dark-theme .header {
    background-color: #2d2d3a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0;
    padding: 0 2rem;
    width: 100%;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c3e50;
    transition: color 0.3s ease;
}

body.dark-theme .logo h1 {
    color: #ecf0f1;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-container {
    position: relative;
}

#search-input {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 1rem;
    width: 300px;
    transition: all 0.3s ease;
}

body.dark-theme #search-input {
    background-color: #3a3a4a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

#search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 1rem;
    transition: color 0.3s ease;
}

body.dark-theme .search-btn {
    color: #aaa;
}

.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

body.dark-theme .theme-btn {
    color: #aaa;
}

.theme-btn:hover {
    background-color: #f0f0f0;
}

body.dark-theme .theme-btn:hover {
    background-color: #3a3a4a;
}

/* 主内容区 */
.main-container {
    display: flex;
    max-width: 1600px;
    margin: 2rem 0;
    gap: 2rem;
    padding: 0;
    width: 100%;
}

/* 左侧目录导航 */
.sidebar {
    width: 280px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: calc(100vh - 120px);
    position: sticky;
    top: 100px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

body.dark-theme .sidebar {
    background-color: #2d2d3a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

body.dark-theme .sidebar-header {
    background-color: #3a3a4a;
    border-bottom-color: #4a4a5a;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    transition: color 0.3s ease;
}

body.dark-theme .sidebar-header h2 {
    color: #ecf0f1;
}

.directory-nav {
    padding: 1rem 0;
    overflow-y: auto;
    height: calc(100% - 70px);
}

.directory-item {
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.directory-item:hover {
    background-color: #f5f5f5;
}

body.dark-theme .directory-item:hover {
    background-color: #3a3a4a;
}

.directory-item.active {
    background-color: #e3f2fd;
    border-left-color: #3498db;
    font-weight: 500;
}

body.dark-theme .directory-item.active {
    background-color: #2a3a4a;
    border-left-color: #2980b9;
}

/* 目录项样式 */
.directory-item {
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
    position: relative;
}

.directory-item-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.directory-item-text {
    flex: 1;
    padding-right: 0.5rem;
}

.directory-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 0.8rem;
    padding: 0.2rem;
    border-radius: 3px;
    transition: all 0.3s ease;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.directory-toggle-btn:hover {
    background-color: #f0f0f0;
}

body.dark-theme .directory-toggle-btn {
    color: #aaa;
}

body.dark-theme .directory-toggle-btn:hover {
    background-color: #3a3a4a;
}

.directory-toggle-btn.expanded::before {
    content: '−';
}

.directory-toggle-btn.collapsed::before {
    content: '+';
}

.directory-children {
    margin-left: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.directory-children.collapsed {
    display: none;
}

.directory-children.expanded {
    display: block;
}

/* 目录层级样式 */
.directory-level-1 {
    font-size: 1rem;
    font-weight: 600;
}

.directory-level-2 {
    padding-left: 1rem !important;
    font-size: 0.95rem;
    color: #555;
}

body.dark-theme .directory-level-2 {
    color: #ccc;
}

.directory-level-3 {
    padding-left: 2rem !important;
    font-size: 0.9rem;
    color: #666;
}

body.dark-theme .directory-level-3 {
    color: #bbb;
}

.directory-level-4 {
    padding-left: 3rem !important;
    font-size: 0.9rem;
    color: #777;
}

body.dark-theme .directory-level-4 {
    color: #aaa;
}

.directory-level-5 {
    padding-left: 4rem !important;
    font-size: 0.9rem;
    color: #888;
}

body.dark-theme .directory-level-5 {
    color: #999;
}

/* 右侧内容区域 */
.content-area {
    flex: 1;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    transition: all 0.3s ease;
    max-width: none;
}

body.dark-theme .content-area {
    background-color: #2d2d3a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

body.dark-theme .content-header {
    border-bottom-color: #4a4a5a;
}

#content-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    transition: color 0.3s ease;
}

body.dark-theme #content-title {
    color: #ecf0f1;
}

/* 按钮样式 */
.btn {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn {
    background-color: #3498db;
    color: white;
}

.primary-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.danger-btn {
    background-color: #e74c3c;
    color: white;
}

.danger-btn:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.secondary-btn {
    background-color: #95a5a6;
    color: white;
}

.secondary-btn:hover {
    background-color: #7f8c8d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

/* 筛选区域 */
.content-filter {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    transition: color 0.3s ease;
}

body.dark-theme .filter-group label {
    color: #aaa;
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

body.dark-theme .filter-group select,
body.dark-theme .filter-group input[type="date"] {
    background-color: #3a3a4a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 内容卡片区域 */
.content-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.no-content {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
    font-size: 1.1rem;
}

body.dark-theme .no-content {
    color: #666;
}

.no-content i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 内容卡片 */
.card {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

body.dark-theme .card {
    background-color: #3a3a4a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

body.dark-theme .card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

body.dark-theme .card-title {
    color: #ecf0f1;
}

.card-time {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

body.dark-theme .card-time {
    color: #666;
}

.card-content {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

body.dark-theme .card-content {
    color: #ccc;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: #e3f2fd;
    color: #1976d2;
    transition: all 0.3s ease;
}

body.dark-theme .tag {
    background-color: #2a3a4a;
    color: #64b5f6;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #999;
    transition: color 0.3s ease;
}

body.dark-theme .card-footer {
    color: #666;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    transition: all 0.3s ease;
}

body.dark-theme .modal-content {
    background-color: #2d2d3a;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

body.dark-theme .modal-header {
    border-bottom-color: #4a4a5a;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    transition: color 0.3s ease;
}

body.dark-theme .modal-header h3 {
    color: #ecf0f1;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #999;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background-color: #f5f5f5;
    color: #666;
}

body.dark-theme .close-btn:hover {
    background-color: #3a3a4a;
    color: #ccc;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    transition: color 0.3s ease;
}

body.dark-theme .form-group label {
    color: #e0e0e0;
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

body.dark-theme .form-control {
    background-color: #3a3a4a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 富文本编辑器 */
.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.8rem;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    flex-wrap: wrap;
}

body.dark-theme .editor-toolbar {
    background-color: #3a3a4a;
    border-color: #4a4a5a;
}

.editor-btn {
    background: none;
    border: 1px solid transparent;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

body.dark-theme .editor-btn {
    color: #aaa;
}

.editor-btn:hover {
    background-color: #e0e0e0;
    border-color: #ddd;
}

body.dark-theme .editor-btn:hover {
    background-color: #4a4a5a;
    border-color: #5a5a6a;
}

.editor-btn.active {
    background-color: #e3f2fd;
    border-color: #3498db;
    color: #3498db;
}

body.dark-theme .editor-btn.active {
    background-color: #2a3a4a;
    border-color: #2980b9;
    color: #2980b9;
}

.rich-editor {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
    font-size: 1rem;
    line-height: 1.6;
    transition: all 0.3s ease;
}

body.dark-theme .rich-editor {
    background-color: #3a3a4a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

.rich-editor:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #eee;
}

body.dark-theme .modal-footer {
    border-top-color: #4a4a5a;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .content-cards {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        margin-bottom: 1.5rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .search-container {
        width: 100%;
    }
    
    #search-input {
        width: 100%;
    }
    
    .content-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .content-filter {
        flex-direction: column;
        gap: 1rem;
    }
    
    .content-cards {
        grid-template-columns: 1fr;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

body.dark-theme ::-webkit-scrollbar-track {
    background: #2d2d3a;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background: #555;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* 刷新提示动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}