/* 在线抠图工具样式 */

/* 顶部工具栏 */
.top-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-1px);
}

.toolbar-btn.btn-export {
    background: rgba(76,175,80,0.9);
    border-color: rgba(76,175,80,1);
}

.toolbar-btn.btn-export:hover {
    background: rgba(76,175,80,1);
}

.image-url-input {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 6px;
    width: 200px;
    font-size: 13px;
}

.image-url-input::placeholder {
    color: rgba(255,255,255,0.7);
}

/* 主容器 */
.matting-container {
    display: flex;
    gap: 15px;
    min-height: 650px;
}

/* 左侧面板 */
.left-panel {
    width: 240px;
    flex-shrink: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-header {
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

/* 工具区块 */
.tool-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}

.section-title {
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 10px;
    font-weight: 500;
}

/* 工具按钮 */
.tool-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.tool-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}

.tool-icon {
    font-size: 18px;
    margin-bottom: 4px;
}

.tool-name {
    font-size: 11px;
}

/* 参数设置 */
.param-group {
    margin-bottom: 12px;
}

.param-group:last-child {
    margin-bottom: 0;
}

.param-group label {
    display: block;
    font-size: 12px;
    color: #4a5568;
    margin-bottom: 6px;
}

.param-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.param-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.param-hint {
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
}

/* 快捷操作 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.action-btn {
    padding: 8px 6px;
    font-size: 11px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

/* 背景选项 */
.bg-options {
    display: flex;
    gap: 8px;
}

.bg-btn {
    width: 36px;
    height: 36px;
    padding: 4px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bg-btn:hover {
    border-color: #cbd5e0;
}

.bg-btn.active {
    border-color: #667eea;
    box-shadow: 0 0 8px rgba(102,126,234,0.3);
}

.bg-preview {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

.transparent-bg {
    background: repeating-conic-gradient(#808080 0% 25%, #c0c0c0 0% 50%) 50% / 12px 12px;
}

/* 中间画布区域 */
.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.canvas-info {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #4a5568;
}

.canvas-controls {
    display: flex;
    gap: 5px;
}

.ctrl-btn {
    padding: 5px 10px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.ctrl-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

/* 画布容器 */
.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#e8e8e8 0% 25%, #f5f5f5 0% 50%) 50% / 20px 20px;
    transition: box-shadow 0.2s ease;
    min-height: 450px;
}

.canvas-wrapper.drag-over {
    box-shadow: inset 0 0 30px rgba(102, 126, 234, 0.4);
}

.canvas-wrapper canvas {
    position: absolute;
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

#overlayCanvas {
    pointer-events: none;
}

/* 画笔光标 */
.brush-cursor {
    position: absolute;
    border: 2px solid #667eea;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.canvas-wrapper:hover .brush-cursor.visible {
    opacity: 1;
}

/* 上传占位符 */
.upload-placeholder {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #718096;
    text-align: center;
    padding: 40px;
}

.placeholder-icon {
    font-size: 56px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.upload-placeholder p {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 5px 0;
}

.upload-placeholder .upload-hint {
    font-size: 13px;
    color: #a0aec0;
}

.usage-guide {
    margin-top: 20px;
    padding: 15px 20px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 8px;
    border: 1px dashed rgba(102, 126, 234, 0.3);
}

.guide-title {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
}

.guide-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    color: #4a5568;
}

.guide-steps span {
    white-space: nowrap;
}

/* 加载遮罩 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    background: #fff;
    font-size: 12px;
    color: #718096;
    border-top: 1px solid #e2e8f0;
}

/* 右侧面板 */
.right-panel {
    width: 260px;
    flex-shrink: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: 650px;
}

/* 信息区块 */
.info-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}

/* 颜色预览 */
.color-preview-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: #e2e8f0;
    border: 2px solid #cbd5e0;
}

.color-values {
    flex: 1;
}

.color-value-item {
    display: flex;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 4px;
}

.color-value-item .label {
    color: #718096;
    width: 35px;
}

.color-value-item .value {
    color: #2d3748;
    font-family: 'Consolas', monospace;
}

/* 统计信息 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.stat-item {
    text-align: center;
    padding: 6px 4px;
    background: #f7fafc;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: #718096;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

/* 历史记录 */
.history-list {
    max-height: 120px;
    overflow-y: auto;
}

.history-empty {
    font-size: 12px;
    color: #a0aec0;
    text-align: center;
    padding: 15px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 12px;
    color: #4a5568;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.history-item:hover {
    background: #edf2f7;
}

.history-item.active {
    background: rgba(102,126,234,0.15);
    color: #667eea;
}

/* AI区块 */
.ai-section .ai-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-section textarea {
    width: 100%;
    max-width: 220px;
    padding: 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #2d3748;
    font-size: 12px;
    resize: none;
}

.ai-section textarea::placeholder {
    color: #a0aec0;
}

.ai-section textarea:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.ai-section select {
    width: 100%;
    padding: 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #2d3748;
    font-size: 12px;
}

.ai-section select:focus {
    border-color: #667eea;
    outline: none;
}

.btn-ai {
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.ai-result {
    margin-top: 10px;
    padding: 12px;
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    font-size: 12px;
    color: #4a5568;
    line-height: 1.6;
    display: none;
}

.ai-result.show {
    display: block;
}

/* 预览弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.preview-modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.preview-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.preview-modal .modal-header h3 {
    color: #fff;
    font-size: 16px;
    margin: 0;
}

.btn-close {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

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

.preview-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    flex: 1;
    overflow: auto;
    background: #f8fafc;
}

.preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pane-title {
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 15px;
    font-weight: 500;
}

.preview-pane canvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    background: repeating-conic-gradient(#2a2a2a 0% 25%, #3a3a3a 0% 50%) 50% / 15px 15px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.modal-footer .toolbar-btn {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
}

.modal-footer .toolbar-btn:hover {
    background: #edf2f7;
}

.modal-footer .toolbar-btn.btn-export {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
}

.modal-footer .toolbar-btn.btn-export:hover {
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

/* 全屏模式 */
.list-panel.contents.matting-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: #f8fafc;
    overflow: auto;
    padding: 15px;
    margin: 0 !important;
    border-radius: 0;
}

.matting-fullscreen .matting-container {
    min-height: calc(100vh - 100px);
}

.matting-fullscreen .right-panel,
.matting-fullscreen .left-panel {
    max-height: calc(100vh - 130px);
}

.matting-fullscreen .center-panel {
    max-height: calc(100vh - 130px);
}

.matting-fullscreen .canvas-wrapper {
    max-height: calc(100vh - 200px);
}

/* 响应式适配 */
@media (max-width: 1200px) {
    .matting-container {
        flex-wrap: wrap;
    }
    
    .left-panel, .right-panel {
        width: 100%;
        max-height: none;
    }
    
    .center-panel {
        min-height: 400px;
    }
    
    .tool-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .top-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-group {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .image-url-input {
        width: 100%;
    }
    
    .preview-content {
        flex-direction: column;
    }
}

/* 自定义滚动条 */
.history-list::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover,
.right-panel::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}
