* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* 登录/注册页面 */
.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

.auth-container .version-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 400px;
}

.auth-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 32px;
}

.auth-form h2 {
    margin-bottom: 20px;
    color: #333;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.auth-form > button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-form > button:hover {
    background: #5568d3;
}

.switch-form {
    text-align: center;
    margin-top: 15px;
    color: #666;
}

.switch-form a {
    color: #667eea;
    text-decoration: none;
}

/* 版本号 */
.version-footer {
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-container .version-footer {
    color: #999;
    background: #f5f5f5;
    border-top: 1px solid #eee;
}

/* ICP备案号 */
.icp-beian {
    display: block;
    font-size: 11px;
}

.icp-beian .icp-icon {
    width: 12px;
    height: 12px;
    vertical-align: -2px;
    margin-right: 3px;
}

.icp-beian a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.icp-beian a:hover {
    color: #667eea;
    text-decoration: underline;
}

.auth-container .icp-beian a {
    color: rgba(255, 255, 255, 0.4);
}

.auth-container .icp-beian a:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* 主应用页面 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 8px;
}

.header-left h1 {
    font-size: 20px;
    color: #667eea;
    white-space: nowrap;
}

.header-center {
    display: flex;
    gap: 10px;
}

.header-center input {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 340px;
    font-size: 13px;
}

/* ==================== 搜索 Chip 容器 ==================== */

.search-chip-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 340px;
    min-height: 34px;
    background: white;
    cursor: text;
    transition: border-color 0.15s;
}

.search-chip-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.12);
}

.search-chip-container input {
    border: none !important;
    outline: none !important;
    padding: 4px 4px !important;
    width: auto !important;
    min-width: 120px;
    flex: 1;
    font-size: 13px;
    box-shadow: none !important;
    background: transparent;
}

/* 搜索 chip 标签 */
.search-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
    animation: chipIn 0.15s ease-out;
}

@keyframes chipIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.search-chip.chip-tag {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.search-chip.chip-desc {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.search-chip.chip-all {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.search-chip.chip-title {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.search-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    transition: background 0.15s;
    border: none;
    padding: 0;
    color: inherit;
}

.search-chip-remove:hover {
    background: rgba(0,0,0,0.25);
}

.header-center button,
.header-right > button {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.header-right {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* 用户菜单容器 */
.user-menu {
    position: relative;
}

/* 当前用户名显示 */
.current-username {
    font-size: 13px;
    color: #667eea;
    font-weight: 500;
    padding: 4px 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.current-username:hover {
    background: rgba(102, 126, 234, 0.2);
}

.current-username::after {
    content: '▾';
    margin-left: 4px;
    font-size: 10px;
}

/* 用户头像图标 */
.user-avatar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* 用户下拉菜单 */
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 160px;
    padding: 6px 0;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #e8ecff;
    color: #667eea;
}

.dropdown-item.danger {
    color: #f44336;
}

.dropdown-item.danger:hover {
    background: #fde8e8;
    color: #d32f2f;
}

.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

.status-indicator {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.status-indicator.online {
    background: #4caf50;
    color: white;
}

.status-indicator.offline {
    background: #f44336;
    color: white;
}

.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #ddd;
    padding: 12px 14px;
    overflow-y: auto;
}

.sidebar-section h3 {
    margin-bottom: 15px;
    color: #333;
}

/* 侧栏头部：文件夹标题 + 全部折叠/展开按钮 */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sidebar-header h3 {
    margin-bottom: 0;
    font-size: 16px;
}

.sidebar-actions {
    display: flex;
    gap: 4px;
}

.sidebar-action-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: all 0.15s;
    padding: 0;
}

.sidebar-action-btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.folder-list {
    list-style: none;
    margin-bottom: 12px;
}

.folder-item {
    padding: 7px 10px;
    margin-bottom: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
}

.folder-item:hover {
    background: #f0f0f0;
}

.folder-item.active {
    background: #667eea;
    color: white;
}

/* 标签按钮 */
.tag-view-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: all 0.2s;
}

.tag-view-btn:hover {
    background: #e8ecff;
    border-color: #667eea;
    color: #667eea;
}

.tag-view-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.tag-count-badge {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    min-width: 18px;
    text-align: center;
}

.tag-view-btn.active .tag-count-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* 侧栏分隔线 */
.sidebar-divider {
    height: 1px;
    background: #eee;
    margin: 10px 0;
}

.add-folder-btn {
    width: 100%;
    padding: 7px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.main-content {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.content-header h2 {
    color: #333;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.add-bookmark-btn {
    padding: 7px 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.bookmarks-grid {
    margin-bottom: 16px;
}

.bookmark-card {
    background: white;
    padding: 14px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.bookmark-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 网站图标 */
.bookmark-card .favicon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
}

.bookmark-card h3 {
    margin-bottom: 6px;
    color: #667eea;
    font-size: 14px;
}

.bookmark-card .url {
    color: #666;
    font-size: 12px;
    margin-bottom: 6px;
    word-break: break-all;
}

.bookmark-card .description {
    color: #999;
    font-size: 13px;
    margin-bottom: 10px;
}

.bookmark-card .tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.bookmark-card .folder {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-card .tag {
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #666;
}

.bookmark-card .actions {
    display: none;
    gap: 6px;
}

.bookmark-card:hover .actions {
    display: flex;
}

.bookmark-card .actions button {
    flex: 1;
    padding: 5px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.bookmark-card .edit-btn {
    background: #ffc107;
    color: white;
}

.bookmark-card .delete-btn {
    background: #f44336;
    color: white;
}

/* 操作区包裹：点击计数 + 操作按钮 */
.bookmark-card .bm-actions-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    min-height: 28px;
}

/* 点击计数徽章 */
.bookmark-card .click-count {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.bookmark-card:hover .click-count {
    display: none;
}

/* 日期显示 */
.bookmark-card .bm-date {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.bookmark-card .bm-date .bm-created {
    color: #999;
}

.bookmark-card .bm-date .bm-modified {
    color: #e67e22;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.pagination button {
    padding: 5px 10px;
    min-width: 32px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* 密码显示/隐藏切换 */
.password-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.password-wrapper input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    margin-bottom: 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    opacity: 0.6;
    line-height: 1;
}

.password-toggle-btn:hover {
    opacity: 1;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.form-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.form-actions button:first-child {
    background: #999;
    color: white;
}

.form-actions button:last-child {
    background: #667eea;
    color: white;
}

/* 撤回通知 */
.undo-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10000;
    animation: slideUp 0.3s ease-out;
    max-width: 90%;
}

.undo-notification.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.undo-notification span {
    font-size: 14px;
    flex: 1;
}

.undo-btn {
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.undo-btn:hover {
    background: #5568d3;
}

.close-btn {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* ==================== 侧栏拖拽调整 ==================== */
.sidebar {
    position: relative;
    min-width: 180px;
    max-width: 500px;
}

.sidebar-resize-handle {
    width: 5px;
    background: #e0e0e0;
    cursor: col-resize;
    transition: background 0.2s;
    flex-shrink: 0;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: #667eea;
}

body.resizing {
    cursor: col-resize !important;
    user-select: none;
}

body.resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

/* ==================== 文件夹树展开/收缩 ==================== */
.folder-item {
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}

.folder-toggle {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    color: #999;
    flex-shrink: 0;
    border-radius: 3px;
    transition: all 0.15s;
}

.folder-toggle:hover {
    background: rgba(0,0,0,0.1);
}

.folder-item.active .folder-toggle {
    color: rgba(255,255,255,0.8);
}

.folder-toggle.collapsed::before {
    content: '▶';
}

.folder-toggle.expanded::before {
    content: '▼';
}

.folder-toggle.leaf {
    visibility: hidden;
}

.folder-item.collapsed-parent > .folder-children {
    display: none;
}

.folder-children {
    list-style: none;
}

.folder-name-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-count {
    font-size: 11px;
    color: #aaa;
    flex-shrink: 0;
    margin-left: 4px;
}

.folder-item.active .folder-count {
    color: rgba(255,255,255,0.7);
}

/* ==================== 内容区头部 ==================== */
/* ==================== 排序按钮 ==================== */
.sort-controls {
    display: flex;
    gap: 4px;
}

.sort-btn {
    padding: 4px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    color: #666;
    font-size: 13px;
    transition: all 0.15s;
    white-space: nowrap;
}

.sort-btn:hover {
    background: #f0f0f0;
}

.sort-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* ==================== 内容区头部 ==================== */
.content-header-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.view-toggle {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.view-btn {
    padding: 4px 10px;
    background: white;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    transition: all 0.15s;
}

.view-btn:hover {
    background: #f0f0f0;
}

.view-btn.active {
    background: #667eea;
    color: white;
}

/* ==================== 列表视图 ==================== */
.bookmarks-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.bookmarks-grid.view-list .bookmark-card {
    display: grid;
    grid-template-columns: 20px minmax(0, 2fr) 110px 90px 175px 70px;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 0;
    border-bottom: 1px solid #eee;
    box-shadow: none;
    transition: background 0.15s;
}

/* 多选模式下列表视图增加 checkbox 列 */
.bookmarks-grid.view-list .bookmark-card:has(.bm-checkbox) {
    grid-template-columns: 22px 20px minmax(0, 2fr) 110px 90px 175px 70px;
}

.bookmarks-grid.view-list .bookmark-card:first-child {
    border-radius: 8px 8px 0 0;
}

.bookmarks-grid.view-list .bookmark-card:last-child {
    border-radius: 0 0 8px 8px;
    border-bottom: none;
}

.bookmarks-grid.view-list .bookmark-card:only-child {
    border-radius: 8px;
}

.bookmarks-grid.view-list .bookmark-card:hover {
    transform: none;
    box-shadow: none;
    background: #f8f9ff;
}

.bookmarks-grid.view-list .bookmark-card h3 {
    margin: 0;
    font-size: 14px;
    position: relative;
}

.bookmarks-grid.view-list .bookmark-card h3 a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmarks-grid.view-list .bookmark-card h3:hover::after {
    content: attr(data-title);
    position: absolute;
    top: 100%;
    left: 0;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: normal;
    white-space: normal;
    max-width: 400px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    pointer-events: none;
    line-height: 1.4;
    word-break: break-all;
}

.bookmarks-grid.view-list .bookmark-card .favicon {
    width: 16px;
    height: 16px;
}

.bookmarks-grid.view-list .bookmark-card .url {
    margin: 0;
    font-size: 12px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmarks-grid.view-list .bookmark-card .description,
.bookmarks-grid.view-list .bookmark-card .tags {
    display: none;
}

.bookmarks-grid.view-list .bookmark-card .folder {
    font-size: 11px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.bookmarks-grid.view-list .bookmark-card .bm-date {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    display: block;
}

.bookmarks-grid.view-list .bookmark-card .bm-date .bm-created {
    display: inline;
}

.bookmarks-grid.view-list .bookmark-card .bm-date .bm-modified {
    display: none;
}

.bookmarks-grid.view-list .bookmark-card .bm-date:has(.bm-modified) .bm-created {
    display: none;
}

.bookmarks-grid.view-list .bookmark-card .bm-date:has(.bm-modified) .bm-modified {
    display: inline;
}

.bookmarks-grid.view-list .bookmark-card .bm-actions-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: auto;
    margin: 0;
}

.bookmarks-grid.view-list .bookmark-card .actions {
    display: none;
    gap: 4px;
    flex: none;
}

.bookmarks-grid.view-list .bookmark-card:hover .actions {
    display: flex;
}

.bookmarks-grid.view-list .bookmark-card:hover .click-count {
    display: none;
}

.bookmarks-grid.view-list .bookmark-card .actions button {
    flex: none;
    padding: 3px 8px;
    font-size: 12px;
}

/* ==================== 卡片视图 ==================== */
.bookmarks-grid.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.bookmarks-grid.view-grid .bookmark-card .bm-date {
    display: flex;
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
}

.bookmarks-grid.view-grid .bookmark-card {
    display: flex;
    flex-wrap: wrap;
    gap: 0 6px;
    align-items: flex-start;
}

.bookmarks-grid.view-grid .bookmark-card .favicon {
    flex-shrink: 0;
    margin-top: 3px;
}

.bookmarks-grid.view-grid .bookmark-card h3 {
    flex: 1;
    min-width: 0;
}

.bookmarks-grid.view-grid .bookmark-card .url,
.bookmarks-grid.view-grid .bookmark-card .description,
.bookmarks-grid.view-grid .bookmark-card .tags,
.bookmarks-grid.view-grid .bookmark-card .bm-date,
.bookmarks-grid.view-grid .bookmark-card .bm-actions-wrap {
    width: 100%;
}

/* ==================== 拖拽排序样式 ==================== */
.bookmark-card.dragging {
    opacity: 0.4;
    border: 2px dashed #667eea;
}

.bookmark-card.drag-over {
    border-top: 3px solid #667eea;
}

.folder-item.dragging {
    opacity: 0.4;
}

.folder-item.drag-over {
    background: #e8ecff !important;
    outline: 2px dashed #667eea;
    outline-offset: -2px;
}

.bookmark-card h3 a {
    color: #667eea;
    text-decoration: none;
}

.bookmark-card h3 a:hover {
    text-decoration: underline;
}

.bookmark-card {
    cursor: grab;
}

.bookmark-card:active {
    cursor: grabbing;
}

.folder-item[draggable="true"] {
    cursor: grab;
}

.folder-item[draggable="true"]:active {
    cursor: grabbing;
}

/* 嵌套文件夹的「拖出」按钮 */
.folder-unnest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 4px;
    font-size: 12px;
    color: #999;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.folder-unnest:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.folder-item.active .folder-unnest {
    color: rgba(255, 255, 255, 0.7);
}

.folder-item.active .folder-unnest:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* 侧栏空白区域拖放指示 */
.sidebar.drag-over-sidebar {
    background: #f0f3ff !important;
    outline: 2px dashed #667eea;
    outline-offset: -4px;
}

.sidebar-section {
    position: relative;
    min-height: 60px;
}

#sidebar-tag-view {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#sidebar-tag-view .tag-list-sidebar {
    flex: 1;
    overflow-y: auto;
}

/* ==================== 标签页样式 ==================== */

.view-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ==================== 标签侧栏视图样式 ==================== */

.tag-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tag-sidebar-header h3 {
    margin: 0;
    flex: 1;
    text-align: center;
}

.tag-back-btn,
.tag-search-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.tag-back-btn:hover,
.tag-search-btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.tag-back-btn.active,
.tag-search-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* 搜索框 */
.tag-search-box {
    margin-bottom: 10px;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { max-height: 0; opacity: 0; }
    to { max-height: 50px; opacity: 1; }
}

.tag-search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.tag-search-box input:focus {
    border-color: #667eea;
}

/* 标签侧栏列表 */
.tag-list-sidebar {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.tag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    margin-bottom: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
}

.tag-item:hover {
    background: #f0f0f0;
}

.tag-item.active {
    background: #667eea;
    color: white;
}

.tag-item-count {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    min-width: 18px;
    text-align: center;
}

.tag-item.active .tag-item-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tag-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* ==================== 文件夹悬浮操作按钮 ==================== */

.folder-hover-actions {
    display: none;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.folder-item:hover .folder-hover-actions {
    display: flex;
}

.folder-item.active .folder-hover-actions {
    display: flex;
}

.folder-item:hover .folder-count {
    display: none;
}

.folder-hover-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: #888;
    transition: all 0.15s;
    padding: 0;
}

.folder-hover-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.folder-item.active .folder-hover-btn {
    color: rgba(255, 255, 255, 0.7);
}

.folder-item.active .folder-hover-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ==================== 文件夹颜色标记 ==================== */

.folder-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ==================== 颜色选择器 ==================== */

.color-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.color-option:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-option.selected {
    border-color: #333;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #333;
}

.color-option.no-color {
    background: #f0f0f0;
    color: #999;
    border: 2px solid #ddd;
}

.color-option.no-color:hover {
    background: #e0e0e0;
}

/* ==================== 编辑文件夹额外操作 ==================== */

.edit-folder-extra-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.edit-folder-export-btn {
    flex: 1;
    padding: 10px 14px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.edit-folder-export-btn:hover {
    background: #1976d2;
}

.edit-folder-delete-btn {
    flex: 1;
    padding: 10px 14px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.edit-folder-delete-btn:hover {
    background: #d32f2f;
}

/* ==================== 多选模式样式 ==================== */

/* 多选操作栏 */
.multi-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.multi-select-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.multi-select-all-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.multi-select-all-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.selected-count {
    font-size: 13px;
    color: #e65100;
    font-weight: 500;
}

.multi-select-bar-right {
    display: flex;
    gap: 8px;
}

.multi-action-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.multi-action-btn.move-btn {
    background: #2196f3;
    color: white;
}

.multi-action-btn.move-btn:hover {
    background: #1976d2;
}

.multi-action-btn.delete-btn {
    background: #f44336;
    color: white;
}

.multi-action-btn.delete-btn:hover {
    background: #d32f2f;
}

.multi-action-btn.cancel-btn {
    background: #9e9e9e;
    color: white;
}

.multi-action-btn.cancel-btn:hover {
    background: #757575;
}

/* 书签卡片多选 checkbox */
.bm-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.bm-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #667eea;
}

/* 选中状态卡片 */
.bookmark-card.selected {
    outline: 2px solid #667eea;
    outline-offset: -2px;
    background: #f0f3ff !important;
}

.bookmark-card.selected:hover {
    background: #e8ecff !important;
}

/* 欢迎占位符 */
.welcome-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    color: #aaa;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.welcome-text {
    font-size: 16px;
    color: #888;
}

