#comfyPage {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* 保持透明背景，由父容器决定背景色 */
    background: transparent;
    color: #f0f0f0;
    font-family: Arial, sans-serif;
}
#comfyPage .panel-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ============================================================
   uxp-panel 容器：每个面板是独立窗口，撑满整个面板区域
   关键！没有这个样式，独立窗口无法正常显示
   使用 .standalone-panel 类限定范围，避免影响嵌入面板
   ============================================================ */
uxp-panel.standalone-panel {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    width: 100% !important;
    overflow: hidden !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: #1a1a2e !important;
}

/* ============================================================
   嵌入式 uxp-panel：隐藏，不占用空间
   ============================================================ */
uxp-panel.embedded-panel {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ============================================================
   独立 ComfyUI 窗口容器
   ============================================================ */
.standalone-comfyui-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    position: relative;
    /* 独立面板应该有深色背景 */
    background: #1a1a2e;
    color: #f0f0f0;
}

.standalone-webview-area {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
}

/* 独立头部状态栏 - 避免与 #comfyPage .bg 冲突 */
.standalone-header-bar {
    background: rgba(26, 26, 46, 0.8);
    padding: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.standalone-header-bar .standalone-header-row {
    display: flex;
    align-items: center;
}

.standalone-header-bar .row-item {
    display: flex;
    align-items: center;
}

.standalone-header-bar .discrip {
    color: #5d5dff;
    font-size: 14px;
}

.standalone-header-bar .controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 10px;
}

.standalone-header-bar .status-item {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.standalone-header-bar .refresh-btn,
.standalone-header-bar .toggle-btn {
    background: transparent;
    border: 1px solid #5d5dff;
    color: #5d5dff;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.standalone-header-bar .refresh-btn:hover,
.standalone-header-bar .toggle-btn:hover {
    background: rgba(93, 93, 255, 0.1);
    box-shadow: 0 0 5px rgba(93, 93, 255, 0.5);
}

.standalone-comfyui-container .row {
    display: flex;
    align-items: center;
}

.standalone-comfyui-container .row-item {
    display: flex;
    align-items: center;
}

.standalone-comfyui-container .discrip {
    color: #5d5dff;
    font-size: 14px;
}

.standalone-comfyui-container .controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 10px;
}

.standalone-comfyui-container .status-item {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.standalone-comfyui-container .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.standalone-comfyui-container .status-connected {
    background-color: #4CAF50;
    box-shadow: 0 0 5px #4CAF50;
}

.standalone-comfyui-container .status-disconnected {
    background-color: #F44336;
    box-shadow: 0 0 5px #F44336;
}

.standalone-comfyui-container .refresh-btn {
    background: transparent;
    border: 1px solid #5d5dff;
    color: #5d5dff;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.standalone-comfyui-container .refresh-btn:hover:not(:disabled) {
    background: rgba(93, 93, 255, 0.1);
    box-shadow: 0 0 5px rgba(93, 93, 255, 0.5);
}

.standalone-comfyui-container .refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.standalone-comfyui-container .toggle-btn {
    background: transparent;
    border: 1px solid #5d5dff;
    color: #5d5dff;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.standalone-comfyui-container .toggle-btn:hover:not(.disabled) {
    background: rgba(93, 93, 255, 0.1);
    box-shadow: 0 0 5px rgba(93, 93, 255, 0.5);
}

.standalone-comfyui-container .toggle-btn.disabled {
    border-color: #F44336;
    color: #F44336;
    background: transparent;
}

.standalone-comfyui-container webview {
    flex: 1;
    border: none;
    width: 100%;
    min-height: 0;
}

/* webview 内部的禁用覆盖层 */
.standalone-comfyui-container webview .disabled-view-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

webview {
    flex: 1;
    border: none;
    width: 100%;
}
body.panel-mode #comfyPage .editor-only {
    display: none;
}
body.editor-mode #comfyPage .panel-only {
    display: none;
}
body.web-panel-mode #comfyPage .panel-only,
body.web-panel-mode #comfyPage .editor-only {
    display: none;
}

/* ============================================================
   主面板按钮样式（使用特定 ID 避免影响独立面板）
   ============================================================ */
#panel-refresh-btn {
    background: transparent;
    border: 1px solid #5d5dff;
    color: #5d5dff;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}
#panel-refresh-btn:hover:not(:disabled) {
    background: rgba(93, 93, 255, 0.1);
    box-shadow: 0 0 5px rgba(93, 93, 255, 0.5);
}
#panel-refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#panel-toggle-btn {
    background: transparent;
    border: 1px solid #05d9e8;
    color: #05d9e8;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}
#panel-toggle-btn:hover:not(.disabled) {
    background: rgba(5, 217, 232, 0.1);
    box-shadow: 0 0 5px rgba(5, 217, 232, 0.5);
}
#panel-toggle-btn.disabled {
    border-color: #F44336;
    color: #F44336;
    background: transparent;
}
#panel-toggle-btn.disabled:hover {
    background: rgba(244, 67, 54, 0.1);
    box-shadow: 0 0 5px rgba(244, 67, 54, 0.5);
}

#panel-ws-indicator,
#panel-view-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

#panel-ws-indicator.status-connected,
#panel-view-indicator.status-connected {
    background-color: #4CAF50;
    box-shadow: 0 0 5px #4CAF50;
}

#panel-ws-indicator.status-disconnected,
#panel-view-indicator.status-disconnected {
    background-color: #F44336;
    box-shadow: 0 0 5px #F44336;
}

#comfyPage .disabled-view-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.9);
    color: var(--neon-pink);
    font-size: 14px;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

/* 独立面板的禁用覆盖层 */
.standalone-webview-area .disabled-view-container,
#standalone-disabled-container {
    display: none;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    color: var(--neon-pink);
    font-size: 14px;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 100;
    pointer-events: none;
}

/* webview 容器内的禁用覆盖层 - 只占 webview 区域 */
.standalone-comfyui-container > .disabled-view-container {
    position: absolute;
    flex: 1;
    min-height: 0;
} 
