/* 主工具栏样式 - 固定在页面顶部 */
.toolbar {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

.toolbar-btn {
    /*margin-right: 10px;
    margin-bottom: 5px;*/
    padding: 6px 12px;
    background-color: transparent;
    /*border: 1px solid #d0d0d0;
    border-radius: 4px;*/
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s;
    position: relative;
}
/*.toolbar-btn:hover {
    background-color: #f0f0f0;
}*/

/*.toolbar-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}*/

.toolbar-btn i {
    margin-right: 2px;
}
.toolbar-btn:disabled {
    background-color: transparent;
    color: #aaa;
    cursor: not-allowed;
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.toolbar-right button {
    display: flex;
    align-items: center;
    gap: 2px;
}

.download-btn {
    margin-right: 10px;
    padding: 6px 12px;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

/*.download-btn:hover {
    background-color: #45a049;
}*/

/* 功能工具栏容器 - 固定在页面顶部，与主工具栏在同一位置 */
.function-toolbar-container {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    z-index: 1000;
    display: none;
}

/* 主容器样式 - 添加顶部边距以避开固定工具栏 */
.main-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    flex-grow: 1;
    min-height: calc(100vh - 240px);
    /* 新增：为了让子元素绝对定位相对于此容器 */
    position: relative;
    /* 新增：防止画布超出时出现滚动条 */
    overflow: hidden;
}

/* 图片容器样式 */
.image-container {
    position: relative;
    /*background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);*/
    max-width: 100%;
    margin: 0 auto;
}

/* 主图样式 */
.main-image {
    max-width: 100%;
    max-height: 60vh;
    display: block;
    transition: opacity 0.3s;
    /* 新增：硬件加速，防止动画抖动 */
    will-change: transform;
    /* 确保图片在容器中居中 */
    margin: 0 auto;
}

/* 全局加载遮罩样式 */
.global-loading-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    display: none;
}

.global-loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.global-loading-text {
    color: white;
    font-size: 18px;
    font-weight: bold;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* AI水印 */
.ai-watermark {
    position: absolute;
    top: 30px;
    left: 30px;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    z-index: 5;
}

/* 导航按钮 */
.prev-btn,
.next-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    z-index: 5;
}

.prev-btn {
    left: 30px;
}

.next-btn {
    right: 30px;
}

.prev-btn:hover,
.next-btn:hover {
    background-color: white;
}

.prev-btn:disabled,
.next-btn:disabled {
    background-color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    color: #aaa;
}

/* 缩略图容器样式 */
.thumbnails-wrapper {
    position: relative;
    max-width: 90%;
    width: fit-content;
    margin: 0 auto; /* 保持原有边距 */
    height: 80px; /* 固定高度，确保遮罩高度正确 */
    /*overflow: hidden;*/ /* 隐藏超出 wrapper 的部分 */
    border-radius: 8px;
}
/* 左右两侧的白色渐变遮罩 */
.thumbnails-wrapper::before,
.thumbnails-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 25px; /* 渐变宽度 16px */
    z-index: 5;
    pointer-events: none; /* 让点击事件穿透遮罩 */
}

.thumbnails-wrapper::before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
    border-radius: 8px 0 0 8px;
}
.thumbnails-wrapper::after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
    border-radius: 0 8px 8px 0;
}

.thumbnails-container {
    display: flex;
    align-items: center;
    /* justify-content: center; */ /* 取消居中，改为靠左自然排列，方便滚动计算 */
    gap: 2px; /* 图片间隔 2px */
    padding: 10px; /* 内边距 */
    background-color: white;
    border-radius: 8px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox 隐藏滚动条 */
    height: 100%;

    /* 核心：让容器内容自然撑开 */
    /*width: max-content;*/
    width: 100%;
    min-width: 100%; /* 至少占满 wrapper */
    margin: 0 auto;
    scroll-behavior: smooth; /* 增加原生平滑滚动支持 */
}

/* 隐藏 Webkit (Chrome/Safari) 滚动条 */
.thumbnails-container::-webkit-scrollbar {
    display: none;
}

.thumbnails-container::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.thumbnails-container::-webkit-scrollbar-thumb {
    background-color: #4CAF50;
    border-radius: 3px;
}

/* 缩略图箭头按钮 */
.thumbnail-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px; /* 圆角 8px */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
    opacity: 0; /* 默认隐藏，由JS控制显示 */
    pointer-events: none;
}

.thumbnail-arrow.visible {
    opacity: 1;
    pointer-events: auto;
}

.thumbnail-arrow:hover {
    background-color: #f9f9f9;
}

.thumbnail-arrow.left { left: -10px; }
.thumbnail-arrow.right { right: -10px; }

.thumbnail-arrow span {
    font-size: 20px;
    color: #333;
    font-weight: bold;
}

/* 箭头内部线条图标 */
.nav-arrow-icon {
    width: 8px;
    height: 8px;
    border-top: 2px solid #333;
    border-right: 2px solid #333;
    display: block;
}

.nav-arrow-icon.left {
    transform: rotate(-135deg); /* 向左 */
    margin-left: 4px; /* 视觉居中修正 */
}

.nav-arrow-icon.right {
    transform: rotate(45deg); /* 向右 */
    margin-right: 4px; /* 视觉居中修正 */
}

/*.thumbnail-arrow:hover .nav-arrow-icon {
    border-color: #4CAF50;
}*/

/* 缩略图样式 */
.thumbnail-wrapper {
    /*width: 80px;*/
    width: max-content;
    max-width: 80px;
    height: 60px;
    border-radius: 6px; /* 圆角 6px */
    cursor: pointer;
    /*border: 2px solid transparent;*/
    object-fit: cover;
    flex-shrink: 0;
    opacity: 0.5; /* 未选中半透明 */
    transition: all 0.2s ease;
}
.thumbnail-wrapper .thumbnail {
    border-radius: 6px;
}
.thumbnail-wrapper:hover {
    opacity: 0.8;
}

.thumbnail-wrapper.active {
    opacity: 1; /* 选中不透明 */
}

.smart-edit-toolbar,
.matting-toolbar,
.photo-restore-toolbar,
.inpaint-toolbar,
.erase-toolbar,
.expand-toolbar {
    display: none; /* 初始隐藏 */
    align-items: center;
    justify-content: center; /* 核心：内容居中 */
    height: 100%;
    width: 100%;
    padding: 0 20px;
    position: relative; /* 为绝对定位的返回按钮做参照 */
}

/* 智能编辑工具栏样式 - 修改为在功能工具栏容器内显示 */
.smart-edit-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    height: 100%;
    display: none;
}

/* 抠图工具栏样式 */
.matting-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    height: 100%;
    display: none;
}

/* 老照片修复工具栏样式 */
.photo-restore-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    height: 100%;
    display: none;
}

.toolbar-btn-small {
    background: none;
    border: none;
    cursor: pointer;
    /*font-size: 18px;*/
    color: #333;
    padding: 5px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/*.toolbar-btn-small:hover {
    color: #4CAF50;
    transform: scale(1.1);
}*/

/* 抠图模式选择 */
.matting-mode-selector,
.restore-mode-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.matting-mode-btn,
.restore-mode-btn {
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s;
}

.matting-mode-btn:hover,
.restore-mode-btn:hover {
    background-color: #e0e0e0;
}

.matting-mode-btn.active,
.restore-mode-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 智能编辑输入区域 */
.smart-edit-input-area {
    display: none;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 60%;
    margin: 0 auto;
    position: relative; /* 为按钮定位 */
    border: 1px solid #ddd;
    overflow: hidden;
}

.input-close-btn {
    padding: 10px 25px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.input-close-btn:hover {
    background-color: #45a049;
}

.edit-textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: none; /* 移除边框 */
    font-size: 14px;
    /*resize: vertical;*/
    padding-right: 60px; /* 防止文字被按钮遮挡 */
    padding-bottom: 50px;
    resize: none;
}

.edit-textarea:focus {
    outline: none;
    /*border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);*/
}

.edit-textarea::placeholder {
    color: #999;
}

/* 发送按钮 (圆形 + 向上箭头) */
.send-edit-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    padding: 0;
}
.send-edit-btn:hover { background-color: var(--primary-color); }
.send-edit-btn:disabled { background-color: #e0e0e0; cursor: not-allowed; }
.send-edit-btn svg {color: #fff;}

.input-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.confirm-edit-btn {
    padding: 10px 25px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.confirm-edit-btn:hover {
    background-color: #45a049;
}

.confirm-edit-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* 区域重绘专用工具栏样式 */
.inpaint-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    height: 100%;
    display: none;
}

/* 滑条组容器 */
.brush-control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brush-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.brush-size-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 200px; /* 限制最大宽度 */
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0; /* 默认灰色，JS会动态覆盖为渐变 */
    outline: none;
    cursor: pointer;
}

.brush-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.1s;
    margin-top: -2px; /* 垂直居中修正，视浏览器可能需要微调，或者去掉 */
}
/* Firefox 兼容 */
.brush-size-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

.brush-size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.brush-size-indicator {
    width: 8px;
    height: 8px;
    background: #fff;
    border: 1px solid #333;
    border-radius: 50%;
    flex-shrink: 0;
}

.brush-size-indicator.large {
    width: 16px;
    height: 16px;
    border: 2px solid #333;
}

/* 竖线分割符 */
.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: #e0e0e0;
    margin: 0 20px;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.clear-btn {
    padding: 8px 16px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.clear-btn:hover {
    background-color: #da190b;
}

/* 撤销重做按钮优化 */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #333;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}
.icon-btn:hover:not(:disabled) { background-color: #f0f0f0; }
.icon-btn:disabled { color: #ccc; cursor: not-allowed; }

/* 清空纯文字按钮 */
.clear-text-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #333; /* 黑色字体 */
    padding: 6px 12px;
    font-weight: normal;
}
.clear-text-btn:hover { opacity: 0.7; }

/* 擦除工具栏样式 */
.erase-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    height: 100%;
    display: none;
}

/* 扩图工具栏样式 */
.expand-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    height: 100%;
    display: none;
    /*overflow-x: auto;*/
}

.ratio-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.ratio-btn {
    padding: 6px 10px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: all 0.2s;
    white-space: nowrap;
}

.ratio-btn:hover {
    background-color: #e0e0e0;
}

.ratio-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 主图缩放样式 */
.main-image.expand-scaled {
    transform: scale(0.6);
    transform-origin: center center;
    transition: transform 0.3s ease;
}

/* 画布容器 */
.canvas-container {
    position: absolute;
    /*top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;*/
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    cursor: none !important; /* 重要：禁止显示鼠标指针 */
    display: none;
}

#editorCanvas, #eraseCanvas {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    touch-action: none;
}

/* 扩图画布容器 */
.expand-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 提高 z-index 确保覆盖在 image-container 之上 */
    z-index: 100;
    display: none;
    cursor: default;
    /* 背景色设置为灰色，遮挡下面的所有内容 */
    background-color: #f5f5f5;
    align-items: center;
    justify-content: center;
}

#expandCanvas {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* 扩图信息显示 */
.expand-info {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 25;
    pointer-events: none;
    display: none;
}

/* 扩图尺寸信息 */
.expand-size-info {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 25;
    pointer-events: none;
    opacity: 0.8;
    display: none;
}

/* 底部操作栏 */
.bottom-actions {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 15px;
    /*background-color: white;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);*/
    /* 固定定位关键代码 */
    position: absolute;
    bottom: -80px;
    left: 0;
    width: 100%;
    z-index: 1002;
}

.generate-expand-btn,
.generate-erase-btn,
.generate-matting-btn,
.generate-restore-btn {
    padding: 10px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.generate-expand-btn:hover,
.generate-erase-btn:hover,
.generate-matting-btn:hover,
.generate-restore-btn:hover {
    background-color: #1568cb;
}

.generate-erase-btn:disabled,
.generate-matting-btn:disabled,
.generate-restore-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* 智能编辑按钮提示模块样式 */
.tooltip-module {
    position: absolute;
    width: 400px;
    height: 180px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
    padding:10px;
}

.tooltip-module.show {
    opacity: 1;
    visibility: visible;
}

/* 提示模块定位 */
.toolbar-btn[data-action="smart-edit"] .tooltip-module {
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
}

/* 提示模块内容样式 */
.tooltip-content {
    display: flex;
    height: 100%;
    align-items: center;
    flex-direction: column;
}

.tooltip-text {
    flex: 1;
    font-size: 14px;
    color: #666;
    padding-right: 20px;
}

.tooltip-image {
    width: 100%;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
}

/* 自定义鼠标指针样式 - 修复版本 */
.custom-cursor {
    position: fixed;
    pointer-events: none;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    display: none;
    background-color: transparent;
}

/* 区域重绘输入区域 */
.inpaint-input-area {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 200; /* 确保层级高于画布和光标 */
    width: 240px;
    transition: all 0.3s ease;
    /*border: 1px solid #e0e0e0;*/
    pointer-events: auto;
    cursor: default; /* 恢复默认鼠标 */
}

.inpaint-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 输入框和按钮容器 - 设置为flex布局 */
.inpaint-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    position: relative;
}

.inpaint-input {
    flex: 1;
    line-height: 20px;
    min-height: 35px;
    max-height: 200px;
    /*padding: 12px 16px;
    border: 1px solid #ddd;*/
    border-radius: 6px;
    font-size: 14px;
    resize: none; /* 禁止手动调整大小 */
    font-family: Arial, sans-serif;
    pointer-events: auto;
    cursor: text;
    background-color: #fff;
    /*line-height: 1.5;*/
    overflow-y: hidden; /* 隐藏垂直滚动条，让内容自然撑高 */
    transition: height 0.2s ease;
    box-sizing: border-box;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.inpaint-input:focus {
    outline: none;
    /*border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);*/
}

.inpaint-input::placeholder {
    color: #999;
}

.send-inpaint-btn {
    width: 25px;
    height: 25px;
    min-height: 25px;
    max-height: 25px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.send-inpaint-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

.send-inpaint-btn:active {
    transform: translateY(0);
}

.send-inpaint-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* 隐藏输入框的默认滚动条 */
.inpaint-input::-webkit-scrollbar {
    display: none;
}

/* 图片缩放动画样式 */
.main-image {
    transform-origin: center center;
    will-change: transform;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 隐藏的放大效果 - 放大到120%但瞬间完成，用户看不到 */
.main-image.hidden-zoom-in {
    transform: scale(1.2);
    opacity: 0;
    transition: none;
}

/* 可见的缩小效果 */
.main-image.zoom-out {
    transform: scale(1);
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 0.3s ease-out;
}

/* 确保图片容器正确显示 */
.image-container {
    position: relative;
    overflow: hidden;
    /*background-color: #f9f9f9;*/
}

/* 优化主图显示 */
.main-image {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 水印样式微调 */
.ai-watermark {
    transition: opacity 0.3s ease;
}

/* 当图片动画时，水印保持稳定 */
.main-image.zoom-out ~ .ai-watermark {
    opacity: 0.8;
}

/* 返回按钮样式 (绝对定位 + 线条箭头) */
.back-btn-wrapper {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}
/* 线条风格左箭头 (<) */
.line-arrow-left {
    width: 12px;
    height: 12px;
    border-top: 2px solid #333;
    border-left: 2px solid #333;
    transform: rotate(-45deg);
    margin-left: 5px; /* 视觉微调 */
    transition: border-color 0.2s;
}

/*.toolbar-btn-small:hover .line-arrow-left {
    border-color: #4CAF50;
}*/



/* ————————————上传原图弹出的模态框—————————— */
#uploadModal.modal { /* display: none; */position: fixed;z-index: 1000;left: 0;top: 0;width: 100%;height: 100%;overflow: auto;background-color: rgba(0, 0, 0, 0.4);}
#uploadModal .modal-content {background-color: #fefefe;margin: 8% auto;border: none;border-radius: 10px;width: 60% !important;}
#uploadModal .close {color: #aaa;float: right;font-size: 28px;font-weight: bold;}
#uploadModal .close:hover,
#uploadModal .close:focus {color: black;text-decoration: none;cursor: pointer;}
#uploadModal .modal-title {display: flex;flex-direction: row;gap: 10px;}
#uploadModal .modal-title-select {padding: 10px 15px;cursor: pointer;}
#uploadModal .modal-title-select.active {color: var(--primary-color);border-bottom: 2px solid var(--primary-color);}
#uploadModal .modal-content-bottom {background-color: #f5f5f5;padding: 20px;border-radius: 0 0 10px 10px;}
#uploadModal .modal-content-top{display: flex; flex-direction: row; justify-content: space-between;padding: 5px 10px 0;box-shadow: 0 -1px #f0f0f0 inset;}
#uploadModal .modal-content-bottom-square {height: 60vh;border: dashed 1px var(--primary-color);border-radius: 10px;background-color: #fff;display: flex;text-align: center;align-items: center;justify-content: center;padding: 15px;position: relative;}
#uploadModal /* 上传原图按钮 */
#uploadModal .upload {display: flex;align-items: center;justify-content: center;}
#uploadModal .upload-button {display:flex;align-items:center;background: linear-gradient(to right, #646cfb, #c048fb);color: #fff;font-size: 18px;border: none;border-radius: 10px;padding: 12px 20px;cursor: pointer;margin-bottom: 10px;}
#uploadModal .upload-button:hover {opacity: 0.8;}
#uploadModal #shangchuan {background-image: url('/static/tool/img/upload.png');width: 20px;height: 20px;background-size: cover;margin-right: 8px;}

/* ==================== 新增上传相关样式 ==================== */

/* 1. 缩略图删除按钮相关 */
/* 新上传图片的容器，用于定位删除按钮 */
.thumbnail-wrapper {
    position: relative;
    display: inline-flex; /* 保持与原有img的排列一致 */
    flex-shrink: 0;
    margin-right: 2px;
}
/* 覆盖wrapper内的thumbnail样式，确保尺寸一致 */
.thumbnail-wrapper .thumbnail {
    margin: 0;
    /*border: 2px solid transparent;*/
}
/* 删除按钮样式 */
.thumbnail-delete-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background-color: #00000050;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    z-index: 10;
    /*border: 1px solid white;*/
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}
.thumbnail-delete-btn:hover {
    transform: scale(1.1);
    background-color: #d32f2f;
}

.thumbnail-wrapper .toggle_btn {
    color: #fff;
    position: absolute;
    top: auto;
    left: auto;
    align-items: center;
    height: 100%;
    width: 100%;
    justify-content: center;
    cursor: pointer;
    background-color: #00000030;
    border-radius: 6px;
    display: none;
}
.thumbnail-wrapper .toggle_btn.active {
    display: flex;
}

/* 2. 模态框 Tab 内容切换 */
.modal-tab-content {
    display: none; /* 默认隐藏所有内容 */
    height: 100%;
    width: 100%;
}
.modal-tab-content.active {
    display: block; /* 激活时显示 */
}

/* 3. 传过的图（历史记录）网格布局 */
.history-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px; /* 间隔5px */
    align-content: flex-start;
    height: 100%;
    overflow-y: auto;
    padding: 5px;
}

/* 历史图片项 */
.history-item {
    width: calc(20% - 4px); /* 每行5个 (100% / 5) - gap adjustment */
    height: 100px; /* 固定高度 */
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    overflow: hidden;
    transition: all 0.2s;

    /* 透明网格背景 */
    background-image:
            linear-gradient(45deg, #eee 25%, transparent 25%),
            linear-gradient(-45deg, #eee 25%, transparent 25%),
            linear-gradient(45deg, transparent 75%, #eee 75%),
            linear-gradient(-45deg, transparent 75%, #eee 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-color: #fff;
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 保持比例 */
    display: block;
}

.history-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(114, 60, 249, 0.3);
}

/* 隐藏文件输入框 */
#fileInputHidden {
    display: none;
}


/*入口界面样式 start*/
/* 主内容区域 */
#entryPage .main-content {
    max-width: 1560px;
    margin: -30px auto 0;
    padding: 3rem 1.5rem;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 页头区域 */
#entryPage .page-header {
    text-align: center;
    margin-bottom: 3rem;
}

#entryPage .page-title {
    font-size: 2.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.2;

    /* 添加渐变文字效果 */
    background: linear-gradient(90deg, #007BFF 0%, #FF6B6B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#entryPage .page-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    max-width: 770px;
    margin: 0 auto;
}

#entryPage .top_btn_box {
    display: flex;
    justify-content: flex-end;
    padding: 10px 30px 0;
}
#entryPage .top_btn_box .history-btn {
    display: flex;
    align-items: center;
    gap: 2px;
    color: #666;
    border: 1px solid #f0f0f0;
    padding: 2px 12px;
    border-radius: 100px;
}

#entryPage .top_btn_box .history-btn:hover {
    color: var(--primary-color);
}

/* 功能容器 - 专业水平布局 */
#entryPage .features-container {
    margin-bottom: 4rem;
}

/* 功能卡片水平布局 */
#entryPage .features-horizontal {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    /*overflow-x: auto;*/
    padding: 1rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#entryPage .features-horizontal::-webkit-scrollbar {
    display: none;
}

#entryPage .feature-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 1.8rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 180px;
    max-width: 200px;
    transition: all 0.3s ease;
    border: 1px solid #f1f3f4;
    position: relative;
    overflow: hidden;
}

#entryPage .feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: #e2e6ea;
}

#entryPage .feature-card:active {
    transform: translateY(-4px);
}

#entryPage .feature-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#entryPage .feature-icon i {
    font-size: 20px;
}

#entryPage .feature-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    text-align: center;
}

#entryPage .feature-desc {
    color: #6c757d;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.4;
}

/* 功能图标颜色 */
#entryPage .icon-smart-edit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#entryPage .icon-inpaint {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

#entryPage .icon-expand {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

#entryPage .icon-erase {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

#entryPage .icon-enhance {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

#entryPage .icon-matting {
    background: linear-gradient(135deg, #5ee7df 0%, #b490ca 100%);
}

#entryPage .icon-restore {
    background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
}

/* 上传模态框 */
#entryPage .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    /*backdrop-filter: blur(4px);*/
}

#entryPage .modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

#entryPage .modal {
    background-color: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateY(30px);
    transition: transform 0.4s ease;
}

#entryPage .modal-overlay.active .modal {
    transform: translateY(0);
}

#entryPage .modal-header {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-bottom: 1px solid #eaeaea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#entryPage .modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

#entryPage .modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#entryPage .modal-close:hover {
    background-color: #f1f3f4;
    color: #495057;
}

#entryPage .modal-body {
    padding: 2rem;
}

#entryPage .upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1.5rem;
}

#entryPage .upload-area:hover, .upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(76, 175, 80, 0.03);
}

#entryPage .upload-area-icon {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 1rem;
    transition: color 0.3s;
}

#entryPage .upload-area:hover .upload-area-icon {
    color: var(--primary-color);
}

#entryPage .upload-area-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

#entryPage .upload-area-subtext {
    color: #adb5bd;
    font-size: 0.9rem;
}

#entryPage .file-input {
    display: none;
}

#entryPage .preview-container {
    display: none;
    margin-top: 1.5rem;
    text-align: center;
}

#entryPage .preview-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    /*margin-bottom: 1rem;*/
    margin: 0 auto 1rem;
}

#entryPage .preview-info {
    text-align: left;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

#entryPage .preview-filename {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

#entryPage .preview-filesize {
    color: #6c757d;
    font-size: 0.85rem;
}

#entryPage .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

#entryPage .modal-btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

#entryPage .modal-btn-secondary {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

#entryPage .modal-btn-secondary:hover {
    background-color: #e9ecef;
}

#entryPage .modal-btn-primary {
    background-color: var(--primary-color);
    color: white;
}

#entryPage .modal-btn-primary:hover {
    background-color: var(--primary-color);
}

#entryPage .modal-btn-primary:disabled {
    background-color: #1980FA50;
    cursor: not-allowed;
}

/* 编辑界面 */
.editor-container {
    display: none;
    width: 100%;
    height: 100%;
    /*position: fixed;
    top: 0;
    left: 0;
    background-color: #fff;*/
    z-index: 10;
    position: relative;
}

/* 返回按钮 */
.back-button {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    background-color: #fff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1001;
    transition: all 0.2s;
}

.back-button:hover {
    background-color: #f8f9fa;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* 加载状态 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(76, 175, 80, 0.2);
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

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

/* 专业细节 */
#entryPage .feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, transparent, transparent);
    transition: background 0.3s;
}

#entryPage .feature-card:hover::before {
    /*background: linear-gradient(to right, #4CAF50, #45a049);*/
}

#entryPage .feature-card.selected {
    /*border-color: #4CAF50;*/
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.15);
}

#entryPage .feature-card.selected::before {
    /*background: linear-gradient(to right, #4CAF50, #45a049);*/
}
/*入口界面样式 end*/