* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
}
/* 顶部导航栏 */
.header {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header h1 {
    font-size: 20px;
    color: #333;
    margin: 0;
}
.login-btn {
    padding: 8px 16px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.login-btn:hover {
    background-color: #0056b3;
}
.logout-btn {
    padding: 8px 16px;
    background-color: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.logout-btn:hover {
    background-color: #545b62;
}
/* 主容器 */
.container {
    display: flex;
    height: calc(100vh - 50px);
}
/* 左侧分类导航 */
.sidebar {
    width: 250px;
    background-color: #fff;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    padding: 20px;
}
.sidebar h2 {
    margin-bottom: 20px;
    font-size: 18px;
    color: #333;
}
.category-list {
    list-style: none;
}
.category-item {
    margin-bottom: 10px;
}
.category-link {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #666;
    border-radius: 4px;
    transition: background-color 0.3s;
}
.category-link:hover, .category-link.active {
    background-color: #007bff;
    color: #fff;
}
.subcategory-list {
    margin-left: 20px;
    margin-top: 5px;
}
/* 右侧链接展示 */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}
.main-content h1 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}
.link-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    user-select: none;
}

/* 拖动时的样式 */
.link-card.dragging {
    opacity: 0.5;
    transform: scale(1.05);
    border: 2px dashed #007bff;
}

/* 拖动经过时的样式 */
.link-card.dragover {
    border: 2px solid #007bff;
    background-color: #f0f8ff;
}
.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.link-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    object-fit: contain;
}
.link-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    display: -moz-box;
    display: box;
    -webkit-line-clamp: 1;
    -moz-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    box-orient: vertical;
    min-height: 22px;
    line-height: 1.4;
}
.link-description {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    display: -moz-box;
    display: box;
    -webkit-line-clamp: 2;
    -moz-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    box-orient: vertical;
    min-height: 0;
    max-height: 34px;
}
.link-description:empty {
    display: none;
}
.link-url {
    font-size: 12px;
    color: #666;
    text-decoration: none;
    display: block;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    display: -moz-box;
    display: box;
    -webkit-line-clamp: 1;
    -moz-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    box-orient: vertical;
    line-height: 1.4;
}
.link-url:hover {
    text-decoration: underline;
}
/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}
.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}
.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close:hover {
    color: #000;
}
/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
    color: #333;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.form-group textarea {
    resize: vertical;
    min-height: 80px;
}
.form-group.checkbox {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}
.form-group.checkbox input {
    margin: 0;
    padding: 0;
    width: 4%;
}
.form-group.checkbox label {
    margin: 0 0 0 5px;
    font-weight: normal;
}
.submit-btn {
    padding: 10px 20px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}
.submit-btn:hover {
    background-color: #218838;
}
/* 悬浮添加按钮 */
.add-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    justify-content: center;
}
.add-btn:hover {
    background-color: #0056b3;
    transform: scale(1.1);
}
/* 错误信息 */
.error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 10px;
}
/* 分类选择选项缩进 */
.category-option {
    padding-left: 20px;
}

/* 分类树样式 */
.category-list {
    list-style: none;
}

.category-item {
    margin-bottom: 0;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 0;
}

.category-toggle {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    margin-right: 5px;
    user-select: none;
}

.category-toggle.has-children:hover {
    color: #007bff;
}

.toggle-icon {
    transition: transform 0.2s ease;
    font-size: 10px;
}

.category-link {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #666;
    border-radius: 4px;
    transition: background-color 0.3s;
    flex: 1;
    margin-left: 5px;
}

.subcategory-list {
    margin-left: 20px;
    margin-top: 0;
    transition: all 0.3s ease;
}

/* 层级样式 */
.level-0 > .category-header > .category-link {
    font-weight: bold;
}

/* 为所有层级的分类添加缩进样式 */
.category-item > .category-header {
    display: flex;
    align-items: center;
}

/* 只有有子分类的分类才显示toggle元素 */
.category-toggle.has-children {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
}
i
/* 没有子分类的toggle元素显示，但没有折叠图标 */
.category-toggle:not(.has-children) {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
}

/* 为每个层级添加不同的缩进 */
.level-0 > .category-header {
    padding-left: 0;
}

.level-1 > .category-header {
    padding-left: 20px;
}

.level-2 > .category-header {
    padding-left: 40px;
}

.level-3 > .category-header {
    padding-left: 60px;
}

.level-4 > .category-header {
    padding-left: 80px;
}

/* 空分类图标样式 */
.toggle-icon.empty-icon {
    width: 20px;
    text-align: center;
    font-size: 8px;
    color: #666;
    line-height: 20px;
    cursor: default;
}

.level-5 > .category-header {
    padding-left: 100px;
}

/* 分类链接样式 */
.category-item > .category-header > .category-link {
    flex: 1;
    padding-left: 10px;
}

/* 子分类列表样式 */
.subcategory-list {
    margin-left: 0;
}

/* 分类动画 */
.subcategory-list {
    overflow: hidden;
}

/* 清除默认样式 */
.category-list, .subcategory-list {
    padding-left: 0;
}

/* 文本框清空按钮样式 */
.form-group {
    position: relative;
}

.clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 18px;
    font-weight: bold;
    z-index: 10;
    display: none;
}

.clear-btn:hover {
    color: #333;
}

/* 输入框容器 */
.input-container {
    position: relative;
    width: 100%;
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 导入书签弹窗样式 */
#importBookmarkFormContainer p {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

#importBookmarkProgress {
    font-size: 14px;
    color: #333;
}