:root {
    --primary: #4f46e5;
    --primary-hover: #6366f1;
    --primary-dark: #4338ca;
    --secondary: #0d9488;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #e2e8f0;
    --sidebar-text-hover: #ffffff;
    --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
    --card-hover-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    margin: 0;
    display: flex;
    min-height: 100vh;
    height: auto;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

/* 侧边栏 - 高级深色 */
#sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
    height: 100vh;
    transition: width 0.25s ease, padding 0.25s ease;
}

#sidebar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    z-index: 1;
}

#sidebar h3 {
    margin: 0 0 24px 0;
    font-size: 18px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    position: relative;
    z-index: 2;
    letter-spacing: 0.02em;
}

#sidebar h3::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #6366f1, transparent);
    border-radius: 1px;
    opacity: 0.8;
}

/* 小屏幕下收缩侧边栏 */
@media (max-width: 768px) {
    #sidebar {
        width: 80px;
        /* 增加收缩宽度以容纳两个汉字 */
        padding: 16px 8px;
        overflow-x: hidden;
    }

    #sidebar h3 {
        font-size: 0;
        /* 隐藏标题文字 */
        padding: 0;
    }

    #sidebar h3::after {
        display: none;
        /* 隐藏装饰线 */
    }

    .nav-item {
        padding: 12px 4px;
        /* 调整内边距以适应更宽的侧边栏 */
        font-size: 12px;
        /* 增大字体以提高可读性 */
        flex-direction: column;
        /* 改为垂直布局 */
        align-items: center;
        /* 居中对齐 */
        justify-content: center;
        /* 居中对齐 */
        text-align: center;
        /* 文字居中 */
        height: 50px;
        /* 固定高度 */
    }

    .nav-item span:first-child {
        display: block;
        /* 显示分类名称 */
        white-space: nowrap;
        /* 不换行 */
        overflow: visible;
        /* 显示完整文本，不再隐藏溢出 */
        text-overflow: clip;
        /* 不显示省略号 */
        max-width: 100%;
        /* 最大宽度 */
        line-height: 1.2;
        /* 调整行高 */
    }

    .nav-item .stats {
        display: none;
        /* 隐藏统计信息 */
    }

    #sidebar button.btn-primary {
        display: none;
        /* 在收缩状态下隐藏上传按钮 */
    }
}



.nav-item {
    padding: 12px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    font-size: 14px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text);
    text-align: left;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-light);
}

.selected-count {
    background: #e0e7ff;
    color: #4f46e5;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.nav-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.nav-item:hover::before {
    left: 100%;
}

.nav-item.active {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
    font-weight: 600;
}

/* 主界面 */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
    min-height: 0;
    /* 确保flex容器正确计算高度 */
    height: 100vh;
    /* 占满整个视口高度 */
}

/* 隐藏滚动条但保留滚动功能 */
#main::-webkit-scrollbar {
    width: 0px;
    /* 完全隐藏滚动条 */
}

#main::-webkit-scrollbar-track {
    background: transparent;
}

#main::-webkit-scrollbar-thumb {
    background: transparent;
}

#main::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* 图片画廊的滚动条 */
#gallery::-webkit-scrollbar {
    width: 0px;
    /* 完全隐藏滚动条 */
    height: 0px;
}

#gallery::-webkit-scrollbar-track {
    background: transparent;
}

#gallery::-webkit-scrollbar-thumb {
    background: transparent;
}

#gallery::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* 侧边栏滚动条 */
#sidebar::-webkit-scrollbar {
    width: 0px;
    /* 完全隐藏滚动条 */
}

#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* 全局隐藏滚动条但保留滚动功能 */
*::-webkit-scrollbar {
    width: 0px;
    /* 完全隐藏滚动条 */
    height: 0px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: transparent;
}

*::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* Firefox和IE/Edge浏览器的滚动条隐藏 */
* {
    -ms-overflow-style: none;
    /* 隐藏IE/Edge的滚动条 */
    scrollbar-width: none;
    /* 隐藏Firefox的滚动条 */
}

/* 针对特定容器的滚动条隐藏 */
#main,
#gallery,
#sidebar,
#zoom-list,
#detail-tags-container,
.items-list,
.responsive-menu-panel,
.zoom-sidebar,
.compare-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#main::-webkit-scrollbar,
#gallery::-webkit-scrollbar,
#sidebar::-webkit-scrollbar,
#zoom-list::-webkit-scrollbar,
#detail-tags-container::-webkit-scrollbar,
.items-list::-webkit-scrollbar,
.responsive-menu-panel::-webkit-scrollbar,
.zoom-sidebar::-webkit-scrollbar,
.compare-container::-webkit-scrollbar {
    width: 0px;
    height: 0px;
}

header {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 2px 8px rgba(15, 23, 42, 0.04);
    position: relative;
    overflow: visible;
    flex-shrink: 0;
    z-index: 100;
    gap: 16px;
    flex-wrap: wrap;
}

header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5, #6366f1, #818cf8);
    opacity: 0.9;
}

#sub-category-container:empty {
    display: none;
}

#sub-category-container:not(:empty) {
    position: relative;
    flex-shrink: 0;
    margin: 0;
}

/* 标签筛选条 - 重新设计 */
.sub-category-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid var(--border);
    min-height: 48px;
    box-sizing: border-box;
}

.sub-category-label {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
}

.sub-category-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sub-category-tags::-webkit-scrollbar {
    display: none;
}

.sub-category-chip {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.sub-category-chip:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.sub-category-chip.is-active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: transparent;
    color: white;
}

.sub-category-chip.is-active:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
    color: white;
}

header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    position: relative;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* 搜索框容器 */
.search-container {
    position: relative;
    display: inline-block;
    width: 180px;
}

.search-container input[type="text"] {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    height: 42px;
    line-height: 1;
}

.search-container input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    background: white;
}

.search-container::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    opacity: 0.5;
    pointer-events: none;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
    position: relative;
    flex-wrap: wrap;
    flex: 0 1 auto;
    justify-content: flex-end;
    min-width: 0;
    max-width: 100%;
}

/* 工具栏在较小屏幕上的优化 */
@media (max-width: 1024px) {
    header {
        align-items: flex-start;
    }

    header h2 {
        flex-basis: 100%;
    }

    .toolbar {
        gap: 6px;
        width: 100%;
        justify-content: flex-start;
    }

    .search-container {
        min-width: 220px;
        flex: 1 1 240px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 70px;
    }
}

@media (max-width: 768px) {
    header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        column-gap: 12px;
        row-gap: 0;
    }

    header h2 {
        font-size: 20px;
        grid-column: 1;
        grid-row: 1;
        flex-basis: auto;
    }

    .toolbar {
        gap: 4px;
        width: auto;
        grid-column: 2;
        grid-row: 1;
        flex: 1 1 auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        min-width: 0;
    }

    .search-container {
        width: auto;
        min-width: 0;
    }

    .btn {
        padding: 7px 10px;
        font-size: 12px;
        min-width: 60px;
    }
}

/* 响应式菜单按钮 */
.menu-toggle-btn {
    display: none;
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 16px;
    color: #475569;
    transition: all 0.3s ease;
}

.menu-toggle-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: white;
    min-width: 180px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.05);
    z-index: 2000;
    border-radius: var(--radius-md);
    overflow: hidden;
    top: 100%;
    margin-top: 8px;
}

.dropdown-content .btn {
    width: 100%;
    text-align: left;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    justify-content: flex-start;
    padding-left: 16px;
    min-height: 44px;
    /* 增加高度以提高可点击区域 */
    padding: 12px 16px;
    /* 增加内边距 */
    background: white;
    color: #475569;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.dropdown-content .btn:hover {
    background: #f8fafc;
    color: #1e293b;
    padding-left: 20px;
    /* 悬停时向右移动一点，提供视觉反馈 */
}

.dropdown-content .btn:last-child {
    border-bottom: none;
}

.dropdown-content .btn i,
.dropdown-content .btn span {
    margin-right: 10px;
    /* 为图标留出空间 */
}

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

.btn-more {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    min-width: 60px;
    border: 1px solid #cbd5e1;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-height: 42px;
    /* 与其他按钮保持一致的高度 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.btn-more:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #94a3b8;
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

/* 响应式菜单面板：与 .dropdown-content 样式保持一致 */
.responsive-menu-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 180px;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    margin-top: 8px;
}

/* 在小屏幕上，当需要显示时使用 flex */
.responsive-menu-panel.show {
    display: flex !important;
}

@media (max-width: 768px) {
    .responsive-menu-panel {
        display: none;
    }

    .responsive-menu-panel.show {
        display: flex;
    }
}

/* 在大屏幕上，当需要显示时使用 flex */
@media (min-width: 769px) {
    .responsive-menu-panel.show {
        display: flex;
    }
}

.responsive-menu-panel .btn {
    width: 100%;
    text-align: left;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    justify-content: flex-start;
    padding: 12px 16px;
    padding-left: 16px;
    min-height: 44px;
    background: white;
    color: #475569;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    margin: 0;
}

.responsive-menu-panel .btn:hover {
    background: #f8fafc;
    color: #1e293b;
    padding-left: 20px;
}

.responsive-menu-panel .btn:last-child {
    border-bottom: none;
}

.responsive-menu-panel .btn i,
.responsive-menu-panel .btn span {
    margin-right: 10px;
}

/* 响应式设计：当屏幕宽度小于一定值时，隐藏工具栏按钮，显示菜单按钮 */
@media (max-width: 768px) {
    .toolbar .btn:not(.menu-toggle-btn):not(.btn-more) {
        display: none;
    }

    .toolbar .btn-more {
        display: none;
    }

    .toolbar .menu-toggle-btn {
        display: flex;
        align-items: center;
    }

    /* 搜索框在小屏幕模式下保持可见，与菜单按钮同行显示 */
    .search-container {
        display: block !important;
        margin-bottom: 0;
        margin-right: 0;
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }

    .search-container input {
        width: 100%;
    }

    /* 确保工具栏容器支持内联元素 */
    .toolbar {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        width: auto;
        min-width: 0;
    }

    /* 菜单按钮与搜索框同行 */
    .menu-toggle-btn {
        display: inline-flex !important;
        margin-left: 8px;
        vertical-align: top;
        flex: 0 0 auto;
    }
}

/* 默认隐藏移动端全选按钮，在大屏幕上不需要 */
.mobile-select-btn {
    display: none;
}

/* 在中等屏幕上，只隐藏工具栏直接子按钮（不隐藏下拉框内的选项） */
@media (min-width: 769px) and (max-width: 1024px) {
    .toolbar>.btn:not(.menu-toggle-btn):not(.btn-more):not(.btn-secondary):not(.btn-primary):not(.btn-ai) {
        display: none;
    }

    .dropdown-content .btn {
        font-size: 12px;
        min-height: 40px;
        /* 在中等屏幕上稍微调整高度 */
        padding: 8px 12px;
    }
}

@media (min-width: 769px) {
    header.header-compact {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        column-gap: 16px;
        row-gap: 8px;
    }

    header.header-compact h2 {
        grid-column: 1;
        grid-row: 1;
        align-self: center;
    }

    header.header-compact .toolbar {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-start;
        display: grid;
        grid-template-columns: repeat(4, max-content);
        grid-auto-rows: minmax(42px, auto);
        column-gap: 8px;
        row-gap: 8px;
        width: 100%;
        align-items: center;
    }

    header.header-compact .search-container {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
    }

    header.header-compact .toolbar > .btn,
    header.header-compact .toolbar > .dropdown {
        grid-row: 2;
    }
}

.btn {
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    min-width: 80px;
    box-sizing: border-box;
}

.btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.4s;
    z-index: -1;
}

.btn:hover {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.btn-compare {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-compare:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--primary);
}

.btn-print {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-print:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

.btn-console {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    color: white;
}

.btn-console:hover {
    background: linear-gradient(135deg, #be185d 0%, #9d174d 100%);
}

.btn-export {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-export:hover {
    background: linear-gradient(135deg, #0da271 0%, #047857 100%);
    transform: translateY(-1px);
}

.btn-import {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-import:hover {
    background: linear-gradient(135deg, #256bed 0%, #1d4ed8 100%);
    transform: translateY(-1px);
}

.btn-test {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-test:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
}

.btn-ai {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
}

/* 确认对话框样式优化 */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.dialog-content {
    background: white;
    border-radius: 16px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: dialogSlideIn 0.3s ease-out;
}

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

.dialog-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.dialog-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.dialog-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.dialog-close:hover {
    background: #f1f5f9;
    color: #475569;
}

.dialog-body {
    padding: 24px;
}

.dialog-body p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #475569;
}

.dialog-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dialog-footer .btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.dialog-footer .btn-secondary {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.dialog-footer .btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.dialog-footer .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.dialog-footer .btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* 整合知识管理中心标签页样式 */
.tab-navigation {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.tab-navigation::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
}

.tab-link {
    flex: 1;
    padding: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.tab-link .tab-icon {
    font-size: 16px;
}

.tab-link.active {
    color: #4f46e5;
    border-bottom: 3px solid #4f46e5;
    background: white;
    font-weight: 600;
}

.tab-link:hover:not(.active) {
    color: #4f46e5;
    background: #f1f5f9;
}

.tab-content {
    transition: all 0.3s ease;
}

/* AI分析界面样式 */
.ai-analysis-container {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.ai-analysis-header button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.ai-image-section {
    background: #f8fafc;
}

.ai-result-section {
    background: white;
}

.ai-chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.ai-image-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.ai-image-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.ai-image-card img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
}

.ai-image-card .ai-image-info {
    font-size: 14px;
    color: #64748b;
}

.ai-message {
    align-self: flex-start;
}

.ai-message .ai-message-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.ai-message .ai-message-header .ai-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

.ai-message .ai-message-header .ai-name {
    font-size: 12px;
    font-weight: 600;
    color: #4f46e5;
}

.ai-message .ai-message-content {
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
}

.user-message {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 12px 12px 0 12px;
    padding: 16px;
    max-width: 80%;
    align-self: flex-end;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-message .user-message-content {
    font-size: 14px;
    line-height: 1.5;
    color: white;
}

.ai-user {
    align-self: flex-end;
}

.ai-assistant {
    align-self: flex-start;
}

.ai-input-section input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.ai-input-section button:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-analysis-body {
        flex-direction: column;
    }

    .ai-image-section {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        max-height: 300px;
    }

    .ai-result-section {
        flex: 1;
    }
}


/* 图片网格 - 高级卡片布局 */
#gallery {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: minmax(min-content, max-content);
    gap: 12px;
    align-content: flex-start;
    background: var(--bg);
    position: relative;
    min-height: 0;
    min-width: 0;
    flex-basis: auto;
    -ms-overflow-style: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.9) rgba(226, 232, 240, 0.65);
}

#gallery::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

#gallery::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.65);
    border-radius: 999px;
}

#gallery::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.9);
    border-radius: 999px;
    border: 2px solid rgba(226, 232, 240, 0.65);
}

#gallery::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.95);
}

#gallery::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(79, 70, 229, 0.03) 0%, transparent 55%);
    pointer-events: none;
}

/* ========== 图片卡片 .img-card 重新设计 ========== */
.img-card {
    background: var(--card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    cursor: pointer;
    height: 220px;
    align-self: start;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.25s ease, border-color 0.2s;
}

.img-card:hover {
    box-shadow: var(--card-shadow);
    border-color: var(--border);
}

.img-card.selected {
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.img-card.selected .checkbox {
    accent-color: var(--primary);
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
}

.img-card.selected .checkbox:checked {
    accent-color: var(--primary);
}

/* 缩略图区域 */
.img-card-thumb {
    position: relative;
    width: 100%;
    height: 132px;
    flex-shrink: 0;
    overflow: hidden;
    background: #f1f5f9;
}

.img-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

.img-card-thumb img.is-loaded {
    opacity: 1;
}

/* 角标 DSC / TGA */
.mode-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 6px;
    z-index: 1;
    backdrop-filter: blur(6px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.mode-badge.dsc {
    background: rgba(59, 130, 246, 0.92);
    color: white;
}

.mode-badge.tga {
    background: rgba(239, 68, 68, 0.92);
    color: white;
}

/* 信息区 */
.img-info {
    flex: 1;
    min-height: 0;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fafbfc;
    border-top: 1px solid var(--border);
}

.img-card-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.img-card-meta {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.2;
    margin: 0;
}

.img-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    max-height: 28px;
    overflow: hidden;
}

.tag-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: transform 0.12s;
}

.tag-badge:hover {
    transform: scale(1.04);
}

.checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
    z-index: 2;
    border-radius: 4px;
}



/* 对比弹窗 */
#compare-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    display: none;
    z-index: 100;
    flex-direction: column;
}

.compare-header {
    padding: 20px 28px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.compare-controls {
    display: flex;
    gap: 10px;
}

.compare-header>div:first-child {
    display: flex;
    flex-direction: column;
}

.compare-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.compare-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.compare-grid {
    flex: 1;
    display: grid;
    gap: 10px;
    /* 减少图片之间的间隔 */
    width: 100%;
    height: 100%;
}

/* 4张图片布局：2x2 */
.compare-grid.layout-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* 确保对比容器充分利用空间 */
.compare-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    /* 减少内边距，但仍保留少量空间 */
    overflow: hidden;
}

/* 3张图片布局：上面1张，下面2张 */
.compare-grid.layout-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.compare-grid.layout-3 .compare-item:first-child {
    grid-column: 1 / -1;
}

/* 2张图片布局：1x2 */
.compare-grid.layout-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

/* 1张图片布局 */
.compare-grid.layout-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.compare-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0;
    /* 移除内边距，让图片占用更多空间 */
    overflow: hidden;
    min-height: 0;
    position: relative;
}

.compare-item img {
    max-width: 100%;
    max-height: calc(100% - 25px);
    /* 进一步减少预留空间，让图片更大 */
    width: auto;
    height: auto;
    object-fit: contain;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.1s ease;
    cursor: grab;
}

.compare-item img:active {
    cursor: grabbing;
}

.compare-item p {
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
    /* 进一步减少间距 */
    font-size: 11px;
    /* 减小字体 */
    font-weight: 500;
    white-space: nowrap;
    /* 防止换行 */
    overflow: hidden;
    /* 隐藏超出部分 */
    text-overflow: ellipsis;
    /* 显示省略号 */
}


/* 放大查看层 */
#zoom-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
}

#zoom-overlay.hidden {
    display: none;
}

.zoom-content {
    max-width: 94vw;
    max-height: 90vh;
    display: flex;
    gap: 16px;
}

.zoom-sidebar {
    width: 120px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 8px;
    box-sizing: border-box;
}

.zoom-thumb {
    border-radius: 6px;
    padding: 2px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
    color: #e5e7eb;
    font-size: 11px;
}

.zoom-thumb img {
    width: 100%;
    display: block;
    border-radius: 4px;
}

.zoom-thumb span {
    display: block;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zoom-thumb.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.2);
}

.zoom-main {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.zoom-main img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.zoom-title {
    margin-top: 10px;
    color: #e5e7eb;
    font-size: 14px;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

/* ========== 图片详情弹窗 - 优化 UI ========== */
#detail-overlay.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    display: none;
    z-index: 150;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
}

#detail-overlay.hidden {
    display: none;
}

.detail-content {
    background: var(--card);
    border-radius: var(--radius-lg);
    width: 520px;
    max-width: 90vw;
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.detail-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.detail-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.detail-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: #fafbfc;
}

.detail-image-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.detail-image-container {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #f1f5f9;
}

.detail-image {
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: contain;
    display: block;
}

.detail-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-form-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.detail-form-row .detail-form-group {
    flex: 1;
    min-width: 140px;
}

.detail-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
}

.detail-input,
.detail-select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s;
}

.detail-input:focus,
.detail-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.detail-input[readonly] {
    background: #f1f5f9;
    color: var(--text);
    cursor: default;
}

.detail-tags-row {
    display: flex;
    gap: 8px;
}

.detail-tags-input {
    flex: 1;
    min-width: 0;
}

.detail-tags-add-btn {
    flex-shrink: 0;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.detail-tags-add-btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.detail-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
}

.detail-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.detail-tag-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
    transition: color 0.2s;
}

.detail-tag-remove:hover {
    color: white;
}

.detail-footer {
    padding: 14px 20px;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.info-label {
    color: #64748b;
    font-size: 14px;
}

.info-value {
    color: #1e293b;
    font-size: 14px;
    font-weight: 500;
}

/* Toast 通知样式 */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-left: 4px solid #667eea;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    color: #1e293b;
    font-size: 14px;
    line-height: 1.5;
}

@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;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease-in forwards;
}

#detail-zoom-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: zoom-out;
    backdrop-filter: blur(5px);
}

#detail-zoomed-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    cursor: grab;
}

/* 拖拽上传样式 */
#gallery.drag-over {
    background-color: rgba(102, 126, 234, 0.1) !important;
    border: 2px dashed #667eea !important;
    transition: all 0.2s ease;
}

/* 分类管理样式增强 */
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    background: white;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.category-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.category-info {
    flex: 1;
}

.category-actions {
    display: flex;
    gap: 8px;
}

.category-btn {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.category-btn.rename {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.category-btn.rename:hover {
    background: #e2e8f0;
}

.category-btn.delete {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.category-btn.delete:hover {
    background: #fecaca;
}

.category-stats {
    color: #94a3b8;
    font-size: 12px;
    margin-left: 30px;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.tab-btn {
    flex: 1;
    padding: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.tab-btn:hover:not(.active) {
    color: #4f46e5;
    background: #f1f5f9;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* 全新分类管理模块样式 - 现代化设计 */
.modal-overlay-new {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content-new {
    width: 800px;
    max-width: 95vw;
    max-height: 85vh;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.modal-header-new {
    padding: 32px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

/* 放大视图AI解析功能 - 左右布局 */
.zoom-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    padding: 20px;
    gap: 20px;
}

.zoom-left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.zoom-right-panel {
    width: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow-y: auto;
}

.zoom-ai-section {
    width: 100%;
}

#zoom-ai-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 20px;
    width: 100%;
}

#zoom-ai-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
}

#zoom-ai-btn:disabled {
    background: #6b7280;
    cursor: not-allowed;
    transform: none;
}

.zoom-ai-result {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    color: white;
    font-size: 14px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    line-height: 1.6;
}

.zoom-ai-result.loading {
    text-align: center;
    padding: 40px;
}

/* 调整放大视图图片样式 */
#zoom-image {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
}

.zoom-title {
    color: white;
    margin-top: 15px;
    font-size: 16px;
    text-align: center;
}

.modal-header-new::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    transform: rotate(30deg);
}

.modal-header-new h3 {
    margin: 0 0 4px 0;
    font-size: 22px;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.modal-header-new p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.modal-title-section {
    flex: 1;
    position: relative;
    z-index: 2;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.tab-navigation {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.tab-navigation::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
}

.tab-link {
    flex: 1;
    padding: 18px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    z-index: 1;
}

.tab-link.active {
    color: #4f46e5;
    border-bottom: 3px solid #4f46e5;
    background: white;
    font-weight: 600;
}

.tab-link:hover:not(.active) {
    color: #4f46e5;
    background: #f1f5f9;
}

.tab-link::after {
    content: attr(data-label);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #94a3b8;
    opacity: 0;
    transition: all 0.3s;
}

.tab-link:hover::after {
    opacity: 1;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: #f9fafb;
}

.tab-pane-new {
    display: none;
}

.tab-pane-new.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.section-header h4 {
    margin: 0;
    color: #1e293b;
    font-size: 18px;
    font-weight: 600;
    position: relative;
}

.section-header h4::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 2px;
}

.actions {
    display: flex;
    gap: 12px;
    flex: 1;
    min-width: 300px;
}

.input-field {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.input-field:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

/* 分类管理模块按钮样式 - 为了保持兼容性，使用特定前缀避免冲突 */
.modal-content-new .btn-primary,
#category-management-modal .btn-primary {
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    min-width: 80px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    box-sizing: border-box;
}

.modal-content-new .btn-primary::before,
#category-management-modal .btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.modal-content-new .btn-primary:hover,
#category-management-modal .btn-primary:hover {
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.3);
}

.modal-content-new .btn-primary:hover::before,
#category-management-modal .btn-primary:hover::before {
    left: 100%;
}

.modal-content-new .btn-secondary,
#category-management-modal .btn-secondary {
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    min-width: 80px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-color: #cbd5e1;
    box-sizing: border-box;
}

.modal-content-new .btn-secondary::before,
#category-management-modal .btn-secondary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.modal-content-new .btn-secondary:hover,
#category-management-modal .btn-secondary:hover {
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.3);
}

.modal-content-new .btn-secondary:hover::before,
#category-management-modal .btn-secondary:hover::before {
    left: 100%;
}

.modal-content-new .btn-danger,
#category-management-modal .btn-danger {
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    min-width: 80px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-sizing: border-box;
}

.modal-content-new .btn-danger::before,
#category-management-modal .btn-danger::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.modal-content-new .btn-danger:hover,
#category-management-modal .btn-danger:hover {
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.3);
}

.modal-content-new .btn-danger:hover::before,
#category-management-modal .btn-danger:hover::before {
    left: 100%;
}

.items-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.items-list::-webkit-scrollbar {
    width: 8px;
}

.items-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.items-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.items-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin-bottom: 16px;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.item-row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.item-row:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.item-row:hover::before {
    transform: scaleX(1);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 16px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-meta {
    color: #94a3b8;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.item-actions {
    display: flex;
    gap: 10px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.item-row:hover .item-actions {
    opacity: 1;
    transform: translateX(0);
}

.action-btn {
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rename-btn {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.rename-btn:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.delete-btn {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
    border: 1px solid #fecaca;
}

.delete-btn:hover {
    background: linear-gradient(135deg, #fee2e2 0%, #fed7d7 100%);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-state p {
    margin: 0;
    font-size: 16px;
}

.empty-state::before {
    content: "📭";
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
}

/* 对话框样式 */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.dialog-content {
    background: white;
    border-radius: 20px;
    width: 480px;
    max-width: 95vw;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    transform: scale(0.95);
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes scaleIn {
    to {
        transform: scale(1);
    }
}

.dialog-header {
    padding: 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-header h4 {
    margin: 0;
    color: #1e293b;
    font-size: 18px;
    font-weight: 600;
}

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

.dialog-close:hover {
    background: #f1f5f9;
    color: #475569;
}

.dialog-body {
    padding: 32px;
}

.dialog-body p {
    margin: 0 0 16px 0;
    color: #334155;
    line-height: 1.6;
    font-size: 15px;
}

.dialog-footer {
    padding: 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.dialog-footer .btn-secondary,
.dialog-footer .btn-danger,
.dialog-footer .btn-primary {
    min-width: 80px;
}

/* 推荐模型样式 */
.recommended-models {
    margin-top: 24px;
}

.recommended-models label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
}

.model-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.model-chip {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    color: #334155;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.model-chip:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.model-chip.active {
    border-color: #6366f1;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

/* 模型信息样式 */
.model-info {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
    line-height: 1.4;
}

.vision-hint {
    font-size: 12px;
    color: #6366f1;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.model-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
}

.model-status.checking {
    background: rgba(250, 204, 21, 0.1);
    color: #f59e0b;
}

.model-status.available {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.model-status.unavailable {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.model-status-icon {
    font-size: 16px;
}

.model-status-text {
    flex: 1;
}

.model-status-detail {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 4px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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