
body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

.dark .glass-panel {
    background: rgba(24, 24, 27, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* 画板网格 */
#artboard-container {
    background-color: #f4f4f5;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center;
    transition: background-color 0.3s;
}

.dark #artboard-container {
    background-color: #09090b;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

/* 拖拽图层 */
.draggable-layer {
    position: absolute;
    cursor: grab;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 0 0 0 transparent;
    transition: box-shadow 0.2s ease;
}

.draggable-layer:active {
    cursor: grabbing;
}

.draggable-layer.selected {
    box-shadow: 0 0 0 2px #0ea5e9; 
}

/* 操作手柄 */
.selection-handle {
    position: absolute;
    display: none;
    width: 12px;
    height: 12px;
    background-color: #fff;
    border: 2px solid #0ea5e9;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translate(-50%, -50%);
    transition: transform 0.1s;
}

.selection-handle:hover {
    transform: translate(-50%, -50%) scale(1.2);
    background-color: #0ea5e9;
    border-color: white;
}

.resize-handle { cursor: nwse-resize; }

.rotate-handle {
    width: 24px;
    height: 24px;
    background-color: white;
    border: 1px solid #e4e4e7;
    color: #3f3f46;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.rotate-handle::after {
    content: '⟳';
    font-size: 14px;
    line-height: 1;
}
.dark .rotate-handle {
    background-color: #27272a;
    border-color: #3f3f46;
    color: #e4e4e7;
}

#handle-tl, #handle-br { cursor: nwse-resize; }
#handle-tr, #handle-bl { cursor: nesw-resize; }

.fade-in-up {
    animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translate(0, 10px); }
    to { opacity: 1; transform: translate(0, 0); }
}

.card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #e4e4e7;
    padding: 1rem;
}

.dark .card {
    background-color: #27272a;
    border-color: #3f3f46;
}

.btn-primary {
    background-color: #4f46e5;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s;
    cursor: pointer;
    border: none;
}

.btn-primary:hover {
    background-color: #4338ca;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #f4f4f5;
    color: #18181b;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s;
    cursor: pointer;
    border: none;
}

.dark .btn-secondary {
    background-color: #3f3f46;
    color: #fafafa;
}

.btn-secondary:hover {
    background-color: #e4e4e7;
}

.dark .btn-secondary:hover {
    background-color: #52525b;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.tab-btn, .sub-tab-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    color: #71717a;
    background: transparent;
    border: none;
    cursor: pointer;
}

.tab-btn:hover, .sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #18181b;
}

.dark .tab-btn:hover, .dark .sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fafafa;
}

.tab-btn.active, .sub-tab-btn.active {
    background: white;
    color: #4f46e5;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .tab-btn.active, .dark .sub-tab-btn.active {
    background: #27272a;
    color: #818cf8;
}

/* 新增：面板收缩动画 */
.panel-transition {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-hidden {
    opacity: 0;
    transform: translate(-20px, -50%) scale(0.95);
    pointer-events: none;
    visibility: hidden;
}

.panel-visible {
    opacity: 1;
    transform: translate(0, -50%) scale(1);
    pointer-events: auto;
    visibility: visible;
}

.expand-btn-hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}
.expand-btn-visible {
    opacity: 1;
    transform: translate(0, -50%) scale(1);
    pointer-events: auto;
}

.expand-btn-visible:hover {
    transform: translate(0, -50%) scale(1.05);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
    border-color: rgba(14, 165, 233, 0.4);
}
.dark .expand-btn-visible:hover {
    background-color: rgba(39, 39, 42, 0.95);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.2);
}

/* 画布容器样式 */
#tab-canvas .flex-1 {
    overflow: auto !important;
    position: relative;
}

#tab-canvas .flex-1.glass-panel {
    max-height: calc(100vh - 180px);
}

/* 确保画布内容可滚动 */
#tab-canvas .flex-1::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

#tab-canvas .flex-1::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

#tab-canvas .flex-1::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}

#tab-canvas .flex-1::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}



#workflow-nodes {
    min-width: 10000px !important;
    min-height: 10000px !important;
    width: 10000px;
    height: 10000px;
    position: absolute;
    top: 0;
    left: 0;
}

#workflow-connections {
    min-width: 10000px !important;
    min-height: 10000px !important;
    width: 10000px;
    height: 10000px;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

#workflow-nodes:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}
/* ==================== 画布全屏（修复版）==================== */
body:has(#tab-canvas:not(.hidden)) {
    overflow: hidden;
}

body:has(#tab-canvas:not(.hidden)) header,
body:has(#tab-canvas:not(.hidden)) main > .glass-panel {
    display: none !important;
}

#tab-canvas:not(.hidden) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: #18181b !important;
}

#tab-canvas:not(.hidden) > div {
    height: 100vh !important;
}

#tab-canvas:not(.hidden) aside {
    position: fixed;
    left: 16px;
    top: 16px;
    width: 200px;
    max-height: calc(100vh - 32px);
    z-index: 10000;
}

#exit-canvas-btn:hover {
    background: rgba(239, 68, 68, 1);
}

