/**
 * 收藏功能样式
 * 包含：收藏侧栏、收藏按钮、分类选择器、创建分类弹窗、拖拽排序、响应式设计
 */

/* ========================================
   1. 收藏侧栏
   ======================================== */

.favorites-sidebar {
    position: fixed;
    left: -380px;
    /* 侧栏从内容区域(工具栏所在容器)顶部开始, 略低于全局 Header
       Header 约 72px + 内容区上内边距约 24px => 96px */
    top: 96px;
    /* 底部预留一点空隙, 不贴到底部 */
    bottom: 24px;
    width: 380px;
    /* 使用 top + bottom 控制高度, 不再直接写死 height, 以便在不同页面保持统一留白 */
    height: auto;
    background: var(--card-bg, #1a1a1a);
    border-right: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    /* 让侧栏整体更像一个面板, 仅右上/右下做圆角, 左侧与页面边缘贴合 */
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050 !important; /* 确保在导航栏和其他元素之上 */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* 自定义滚动条样式（Webkit浏览器） */
.favorites-sidebar::-webkit-scrollbar {
    width: 6px;
}

.favorites-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.favorites-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.favorites-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.favorites-sidebar.active {
    left: 0;
}

/* 侧栏拉手（小图标按钮） */
.favorites-handle {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 36px;
    height: 72px;
    border-radius: 0 8px 8px 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: none;
    background: rgba(15, 17, 23, 0.9);
    color: #ffc107;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1045 !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.4);
    transition: all 0.25s ease;
}

.favorites-handle i {
    font-size: 18px;
}

.favorites-handle:hover {
    background: rgba(88, 166, 255, 0.2);
    color: #ffffff;
    transform: translateY(-50%) translateX(2px);
}

/* 亮色模式下的收藏拉手样式 */
[data-theme="light"] .favorites-handle {
    background: rgba(255, 255, 255, 0.96);
    border-color: var(--border-primary, #d0d7de);
    color: var(--accent-primary, #0969da);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

/* 亮色模式下 hover 效果 */
[data-theme="light"] .favorites-handle:hover {
    background: var(--accent-primary, #0969da);
    border-color: var(--accent-primary, #0969da);
    color: #ffffff;
    transform: translateY(-50%) translateX(2px);
}

/* 亮色模式下图标大小与颜色 */
[data-theme="light"] .favorites-handle i {
    font-size: 18px;
    color: inherit;
}

/* 当侧栏打开时，可以稍微隐藏拉手或改变样式 */
.favorites-sidebar.active ~ .favorites-handle {
    left: 380px;
}

/* 侧栏头部 */
.favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    background: var(--card-bg, #1a1a1a);
    position: sticky;
    top: 0;
    z-index: 10;
}

.favorites-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #fff);
}

.btn-close-sidebar {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-sidebar:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
}

/* 图库类型切换标签 */
.gallery-type-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    background: var(--card-bg, #1a1a1a);
    position: sticky;
    top: 72px;
    z-index: 9;
}

.gallery-type-tabs .tab-btn {
    flex: 1;
    padding: 14px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.gallery-type-tabs .tab-btn:hover {
    color: var(--text-primary, #fff);
}

.gallery-type-tabs .tab-btn.active {
    color: var(--primary-color, #007bff);
}

.gallery-type-tabs .tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color, #007bff);
}

/* 分类列表容器 */
.favorites-categories {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* 分类头部 */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 10px;
}

.category-header span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #fff);
}

.btn-add-category {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--primary-color, #007bff);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.btn-add-category:hover {
    background: var(--primary-hover, #0056b3);
    transform: scale(1.05);
}

/* 分类列表 */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.category-item.active {
    background: rgba(0, 123, 255, 0.15);
    border-color: var(--primary-color, #007bff);
}

/* 拖拽手柄 */
.category-item-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.4));
    cursor: grab;
    transition: color 0.2s;
    flex-shrink: 0;
}

.category-item-drag-handle:active {
    cursor: grabbing;
}

.category-item:hover .category-item-drag-handle {
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

.category-item-drag-handle i {
    font-size: 16px;
}

.category-item-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0; /* 允许内容收缩 */
}

.category-item-name {
    font-size: 14px;
    color: var(--text-primary, #fff);
    font-weight: 500;
}

.category-item-count {
    font-size: 12px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.category-item-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.category-item:hover .category-item-actions {
    opacity: 1;
}

.category-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.category-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary, #fff);
}

.category-action-btn.delete:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

/* ========================================
   拖拽排序样式 (Sortable.js)
   ======================================== */

/* 拖拽时的占位符 */
.sortable-ghost {
    opacity: 0.4;
    background: rgba(0, 123, 255, 0.1) !important;
    border-color: var(--primary-color, #007bff) !important;
}

/* 选中时的样式 */
.sortable-chosen {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
}

/* 拖拽时的样式 */
.sortable-drag {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: rotate(2deg);
}

/* 拖拽时禁用点击事件 */
.sortable-drag .category-item-content {
    pointer-events: none;
}

.sortable-drag .category-item-actions {
    pointer-events: none;
}

/* 加载状态 */
.category-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-color, #007bff);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 60px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.3));
    margin-bottom: 15px;
}

.empty-state p {
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    margin-bottom: 20px;
}

.btn-create-first {
    padding: 10px 20px;
    border: none;
    background: var(--primary-color, #007bff);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.btn-create-first:hover {
    background: var(--primary-hover, #0056b3);
    transform: translateY(-1px);
}

/* 侧栏遮罩层 - 新布局不需要遮罩层 */
.favorites-overlay {
    display: none !important;
}

/* ========================================
   2. 收藏按钮（瀑布流卡片）
   ======================================== */

/* 收藏按钮样式 - 集成到 image-action-btn 中 */
.image-action-btn.favorite-btn {
    /* 继承 image-action-btn 的基础样式 */
}

.image-action-btn.favorite-btn.favorited {
    color: #ffc107 !important;
    background: rgba(255, 193, 7, 0.2) !important;
}

.image-action-btn.favorite-btn.favorited i {
    /* 使用填充的星星图标 */
}

/* 独立收藏按钮样式（如果需要单独使用） */
.favorite-btn:not(.image-action-btn) {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.masonry-item:hover .favorite-btn:not(.image-action-btn),
.vr-card:hover .favorite-btn:not(.image-action-btn),
.minimal-image-card:hover .favorite-btn:not(.image-action-btn) {
    opacity: 1 !important;
}

/* 移动端样式 */
@media (max-width: 767px) {
    .favorite-btn:not(.image-action-btn) {
        opacity: 0.8 !important;
    }
}

.favorite-btn.favorited {
    color: #ffc107;
    opacity: 1;
    background: rgba(255, 193, 7, 0.25);
}

.favorite-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.favorite-btn.favorited:hover {
    background: rgba(255, 193, 7, 0.35);
}

/* 工具栏收藏按钮 */
.btn-favorites {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #fff);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-favorites:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-favorites i {
    font-size: 16px;
}

/* ========================================
   3. 收藏分类选择器弹窗
   ======================================== */

.favorite-category-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 提高层级, 确保在 lightbox 预览层(约 10000+) 之上 */
    z-index: 11000;
    display: none;
    align-items: center;
    justify-content: center;
}

.favorite-category-selector.active {
    display: flex;
}

.selector-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.selector-content {
    position: relative;
    background: var(--card-bg, #1a1a1a);
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
}

.selector-header h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 8px;
}

.selector-header .btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selector-header .btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
}

.selector-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.selector-body::-webkit-scrollbar {
    width: 6px;
}

.selector-body::-webkit-scrollbar-track {
    background: transparent;
}

.selector-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.selector-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.category-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.03);
}

.category-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.category-option.selected {
    background: rgba(0, 123, 255, 0.15);
    border-color: var(--primary-color, #007bff);
}

.category-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--primary-color, #007bff);
}

.category-option label {
    flex: 1;
    cursor: pointer;
    color: var(--text-primary, #fff);
    font-size: 14px;
    margin: 0;
}

.options-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

.selector-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
}

.selector-footer .btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.selector-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
}

.selector-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.selector-footer .btn-primary {
    background: var(--primary-color, #007bff);
    color: #fff;
}

.selector-footer .btn-primary:hover {
    background: var(--primary-hover, #0056b3);
    transform: translateY(-1px);
}

/* ========================================
   4. 创建分类弹窗
   ======================================== */

.create-category-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 比分类选择器略高, 同样压过预览层 */
    z-index: 11010;
    display: none;
    align-items: center;
    justify-content: center;
}

.create-category-modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1; /* 确保在内容之下 */
}

.create-category-modal .modal-content {
    position: relative;
    z-index: 2; /* 确保在 backdrop 之上 */
    background: var(--card-bg, #1a1a1a);
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto; /* 确保可以交互 */
}

.create-category-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    position: relative;
    z-index: 3; /* 确保头部在 backdrop 之上 */
    pointer-events: auto; /* 确保可以交互 */
}

.create-category-modal .modal-header h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 8px;
}

.create-category-modal .modal-header .btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.create-category-modal .modal-header .btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
}

.create-category-modal .modal-body {
    padding: 20px;
    position: relative;
    z-index: 3; /* 确保内容在 backdrop 之上 */
    pointer-events: auto; /* 确保可以交互 */
}

.create-category-modal .form-group {
    margin-bottom: 0;
}

.create-category-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary, #fff);
    font-size: 14px;
    font-weight: 500;
}

.create-category-modal .form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #fff);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    pointer-events: auto; /* 确保可以交互 */
    position: relative; /* 确保 z-index 生效 */
    z-index: 10; /* 确保在最上层 */
}

.create-category-modal .form-control:focus {
    outline: none;
    border-color: var(--primary-color, #007bff);
    background: rgba(255, 255, 255, 0.08);
    z-index: 11; /* 聚焦时更高 */
}

.create-category-modal .form-text {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

.create-category-modal .modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    position: relative;
    z-index: 3; /* 确保底部在 backdrop 之上 */
    pointer-events: auto; /* 确保可以交互 */
}

.create-category-modal .modal-footer .btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.create-category-modal .modal-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
}

.create-category-modal .modal-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.create-category-modal .modal-footer .btn-primary {
    background: var(--primary-color, #007bff);
    color: #fff;
}

.create-category-modal .modal-footer .btn-primary:hover {
    background: var(--primary-hover, #0056b3);
    transform: translateY(-1px);
}

/* ========================================
   5. 灯箱收藏按钮
   ======================================== */

.lightbox-favorite-btn {
    position: relative;
    overflow: hidden;
}

.lightbox-favorite-btn i {
    transition: all 0.3s;
}

.lightbox-favorite-btn.favorited {
    background: rgba(255, 193, 7, 0.2) !important;
    border-color: #ffc107 !important;
    color: #ffc107 !important;
}

.lightbox-favorite-btn.favorited i {
    color: #ffc107;
}

.lightbox-favorite-btn:hover:not(.favorited) {
    background: rgba(255, 193, 7, 0.1) !important;
    border-color: #ffc107 !important;
    color: #ffc107 !important;
}

.lightbox-favorite-btn.favorited:hover {
    background: rgba(255, 193, 7, 0.3) !important;
    transform: translateY(-1px);
}

/* ========================================
   6. 响应式设计
   ======================================== */

@media (max-width: 768px) {
    .favorites-sidebar {
        width: 100%;
        left: -100%;
    }
    
    .favorites-header {
        padding: 15px;
    }
    
    .favorites-header h5 {
        font-size: 16px;
    }
    
    .btn-favorites span {
        display: none;
    }
    
    .btn-favorites {
        padding: 8px 12px;
    }
    
    .gallery-type-tabs {
        top: 60px;
    }
    
    .gallery-type-tabs .tab-btn {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .favorites-categories {
        padding: 12px;
    }
    
    .category-header {
        padding: 8px 0;
    }
    
    .category-item {
        padding: 10px 12px;
    }
    
    .category-item-drag-handle {
        width: 20px;
        height: 20px;
    }
    
    .category-item-drag-handle i {
        font-size: 14px;
    }
    
    .category-item-name {
        font-size: 13px;
    }
    
    .category-item-count {
        font-size: 11px;
        padding: 1px 6px;
    }
    
    .category-action-btn {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    
    .selector-content,
    .create-category-modal .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .selector-header,
    .create-category-modal .modal-header {
        padding: 15px;
    }
    
    .selector-body,
    .create-category-modal .modal-body {
        padding: 15px;
    }
    
    .selector-footer,
    .create-category-modal .modal-footer {
        padding: 15px;
    }
    
    .category-option {
        padding: 10px 12px;
    }
    
    .favorite-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
        top: 8px;
        right: 8px;
    }
    
    .lightbox-favorite-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .favorites-sidebar {
        width: 100%;
    }
    
    .gallery-type-tabs .tab-btn {
        font-size: 12px;
        padding: 10px 6px;
    }
    
    .category-item {
        padding: 8px 10px;
        margin-bottom: 6px;
    }
    
    .category-item-name {
        font-size: 12px;
    }
    
    .category-item-count {
        font-size: 10px;
        padding: 1px 5px;
    }
    
    .category-item-drag-handle {
        width: 18px;
        height: 18px;
    }
    
    .category-item-drag-handle i {
        font-size: 12px;
    }
    
    .category-action-btn {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .btn-add-category {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .selector-content,
    .create-category-modal .modal-content {
        width: 98%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .selector-header h6,
    .create-category-modal .modal-header h6 {
        font-size: 14px;
    }
    
    .category-option {
        padding: 8px 10px;
    }
    
    .category-option label {
        font-size: 13px;
    }
    
    .empty-state {
        padding: 30px 15px;
    }
    
    .empty-state i {
        font-size: 50px;
    }
    
    .empty-state p {
        font-size: 13px;
    }
    
    .btn-create-first {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ========================================
   7. 动画和过渡效果
   ======================================== */

/* 收藏按钮动画 */
@keyframes favoritePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.favorite-btn:active {
    animation: favoritePulse 0.3s ease;
}

/* 分类项进入动画 */
.category-item {
    animation: categoryItemFadeIn 0.3s ease;
}

@keyframes categoryItemFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 侧栏滑入动画 */
.favorites-sidebar {
    animation: sidebarSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes sidebarSlideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* 遮罩层淡入动画 */
.favorites-overlay {
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   8. 无障碍访问优化
   ======================================== */

/* 焦点可见性 */
.favorite-btn:focus,
.btn-favorites:focus,
.category-action-btn:focus,
.btn-add-category:focus,
.selector-footer .btn:focus,
.create-category-modal .modal-footer .btn:focus {
    outline: 2px solid var(--primary-color, #007bff);
    outline-offset: 2px;
}

/* 键盘导航支持 */
.category-item:focus-within {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .favorite-btn {
        border: 2px solid #fff;
    }
    
    .category-item {
        border-width: 2px;
    }
    
    .favorites-sidebar {
        border-right-width: 2px;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

