/**
 * 工�?流�?編輯?�浮?��?窗樣�?
 */

/* ==================== ?��??�制?�?�樣�?==================== */

.generation-controls {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    padding: 6px;
    margin-top: 12px;
    border: 2px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    width: 100%;
    display: block;
}

/* 標�??�??*/
.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e9ecef;
}

.controls-header h4 {
    font-size: 1.3em;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.controls-header h4 i {
    color: #4db8a8;
    font-size: 1.2em;
}

.current-task-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(77, 184, 168, 0.3);
}

.current-task-badge i {
    font-size: 1.1em;
}

/* 工�?流�??�卡??*/
.workflow-status-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.workflow-status-card:hover {
    border-color: #4db8a8;
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.1);
}

.status-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    flex-shrink: 0;
}

.status-icon.success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.status-icon.warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.status-icon.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.status-info {
    flex: 1;
}

.status-label {
    font-size: 0.85em;
    color: #6c757d;
    margin-bottom: 4px;
    font-weight: 500;
}

.status-workflow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.status-workflow i {
    color: #4db8a8;
}

.status-hint {
    font-size: 0.85em;
    color: #95a5a6;
    font-style: italic;
}

/* ?�數設�??�?��??�寬?��?佈�?�?*/
.parameters-section {
    background: white;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
    display: block;
    width: 100%;
}

/* ?�數?�塊�?題容??- ?�含標�??��??��???*/
.params-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

/* ?�數?�塊主標�? - 左�?角�?題樣�?*/
.params-section-title {
    font-size: 1.15em;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.params-section-title i {
    color: #4db8a8;
    font-size: 1.1em;
}

/* 展�?/?��??��? */
.toggle-params-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(77, 184, 168, 0.3);
}

.toggle-params-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.4);
}

.toggle-params-btn:active {
    transform: translateY(0);
}

.toggle-params-btn i {
    font-size: 0.9em;
    transition: transform 0.3s ease;
}

.toggle-params-btn:hover i {
    transform: translateY(2px);
}

/* ?�數容器 - ?�寬顯示，�?設�?度�???*/
.parameters-container {
    width: 100%;
    max-width: 100%;
    display: block;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.4s ease;
    position: relative;
}

/* 展�??�??- 移除高度?�制 */
.parameters-container.expanded {
    max-height: none;
}

/* ?�數?�表 - 往左擴�?*/
.param-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
}

/* ?��? section-title 保�?以防?��??�方使用 */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f3f5;
}

.section-title i {
    color: #4db8a8;
}

/* 移除?��? parameters-container �??衝�? */
/* .parameters-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
} */

.parameters-container::-webkit-scrollbar {
    width: 6px;
}

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

.parameters-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.parameters-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.loading-state,
.no-parameters {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6c757d;
    text-align: center;
}

.loading-state i {
    font-size: 2em;
    color: #4db8a8;
    margin-bottom: 12px;
}

.no-parameters i {
    font-size: 3em;
    color: #dee2e6;
    margin-bottom: 12px;
}

.loading-state p,
.no-parameters p {
    margin: 0 0 8px 0;
    font-size: 0.95em;
}

.no-parameters small {
    font-size: 0.85em;
    color: #95a5a6;
}

/* ?�數?�表�?? - 緊�??��? */
.param-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* 減�??��??��? */
    padding: 4px 0;
}

.param-group {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

.param-group-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1em;
    color: #2c3e50;
    border-bottom: 1px solid #dee2e6;
}

.param-group-header i {
    color: #4db8a8;
    font-size: 1.1em;
}

.param-count {
    margin-left: auto;
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 500;
    background: #dee2e6;
    padding: 3px 10px;
    border-radius: 12px;
}

.param-group-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.param-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 14px;
    transition: all 0.3s ease;
    width: 100%;
}

.param-item:hover {
    border-color: #4db8a8;
    background: #f0f4ff;
    transform: translateX(3px);
}

.param-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.param-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95em;
}

.param-node {
    font-size: 0.85em;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #e9ecef;
    padding: 2px 8px;
    /* 減�??��? */
    border-radius: 4px;
    /* 減�??��? */
}

.param-node i {
    font-size: 0.9em;
}

.param-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-input {
    width: 100%;
    padding: 10px 14px;
    /* 增�??��? */
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95em;
    /* 稍微增大字�? */
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.param-input:focus {
    outline: none;
    border-color: #4db8a8;
    background: white;
    box-shadow: 0 0 0 4px rgba(77, 184, 168, 0.1);
}

.param-textarea {
    resize: vertical;
    min-height: 80px;
    /* 增�??�本?��?�?*/
    font-family: 'Consolas', monospace;
    line-height: 1.6;
}

.param-number,
.param-float {
    max-width: 200px;
    /* 使用 max-width ?��??�固定寬�?*/
}

.param-default {
    font-size: 0.85em;
    color: #95a5a6;
    padding-left: 4px;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

.param-default .default-text {
    flex: 1;
}

.param-default .show-more-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.param-default .show-more-btn:hover {
    background-color: rgba(52, 152, 219, 0.1);
    text-decoration: underline;
}

/* ?��??��??�??*/
.controls-footer {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.controls-footer button {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.controls-footer button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.controls-footer button:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #66438b 100%);
}

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

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

.btn-info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #2c81ba 0%, #21618c 100%);
}

/* 生成進度卡片 (舊版 - 保留兼容) */
.generation-progress-card {
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
}

/* ⭐ 生成狀態卡片 (新版 - 旋轉圈圈) */
.generation-status-card {
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    border-radius: 12px;
    padding: 24px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
}

.generation-spinner {
    font-size: 3rem;
    color: white;
}

.generation-spinner .fa-spin {
    animation: fa-spin 1s linear infinite;
}

.generation-message {
    font-size: 1.2rem;
    font-weight: 600;
}

.generation-time {
    font-size: 0.9rem;
    opacity: 0.9;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-label {
    font-weight: 600;
    font-size: 1em;
}

.progress-percent {
    font-weight: 700;
    font-size: 1.2em;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: white;
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

/* ==================== 工�?流查?�器�?? ==================== */

/* 浮�?視�??�景?�罩 */
.workflow-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.workflow-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* 工�?流查?�器主�? */
.workflow-viewer-modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease-out;
    overflow: hidden;
}

/* ?�部 */
.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.task-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
}

.header-info h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
}

.task-label {
    margin: 4px 0 0 0;
    font-size: 0.9em;
    opacity: 0.9;
}

.viewer-close-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

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

/* ?�容?�??*/
.viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    background: #f8f9fa;
}

.viewer-body::-webkit-scrollbar {
    width: 8px;
}

.viewer-body::-webkit-scrollbar-track {
    background: #f1f3f5;
}

.viewer-body::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.viewer-body::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ?��??�用�?? */
.info-card,
.upload-node-card,
.stats-card,
.nodes-list-card,
.json-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f3f5;
}

.card-header i {
    color: #4db8a8;
    font-size: 1.2em;
}

.hint-badge {
    margin-left: auto;
    font-size: 0.8em;
    background: #e9ecef;
    color: #6c757d;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

/* 信息網格 */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 0.85em;
    color: #6c757d;
    font-weight: 500;
}

.info-value {
    font-size: 1.05em;
    font-weight: 600;
    color: #2c3e50;
}

/* 上傳節點選?�器 */
.node-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.node-selector-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.node-selector-item:hover {
    border-color: #4db8a8;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.1);
}

.node-selector-item.selected {
    border-color: #4db8a8;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.2);
}

.node-checkbox {
    font-size: 1.5em;
    color: #cbd5e0;
    transition: all 0.3s ease;
}

.node-selector-item.selected .node-checkbox {
    color: #4db8a8;
}

.node-info {
    flex: 1;
}

.node-id {
    font-size: 0.85em;
    color: #6c757d;
    margin-bottom: 2px;
}

.node-type {
    font-size: 1em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
}

.node-title {
    font-size: 0.85em;
    color: #95a5a6;
    font-style: italic;
}

.upload-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    font-size: 0.9em;
    color: #856404;
}

.upload-hint i {
    color: #f39c12;
}

/* 節點�??�統計網??*/
.node-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.node-type-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #4db8a8;
    border-radius: 8px;
}

.type-name {
    font-size: 0.95em;
    font-weight: 600;
    color: #2c3e50;
}

.type-count {
    font-size: 0.85em;
    color: #6c757d;
}

/* 節點�?�?*/
.nodes-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.nodes-list::-webkit-scrollbar {
    width: 6px;
}

.nodes-list::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 3px;
}

.nodes-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.node-detail-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.node-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.node-id-badge {
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.node-type-badge {
    background: #e9ecef;
    color: #495057;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.node-title-text {
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
}

/* 節點可見性�??��???*/
.node-visibility-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.node-visibility-btn.visible {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.node-visibility-btn.visible:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.node-visibility-btn.hidden {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3);
}

.node-visibility-btn.hidden:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.node-visibility-btn i {
    font-size: 1em;
}

.node-visibility-btn span {
    font-size: 0.9em;
}

.node-inputs {
    margin-top: 12px;
}

.inputs-label {
    font-size: 0.85em;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 8px;
}

.inputs-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-item {
    display: flex;
    gap: 8px;
    font-size: 0.9em;
    padding: 6px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.input-key {
    font-weight: 600;
    color: #495057;
    min-width: 100px;
}

.input-value {
    color: #6c757d;
    word-break: break-all;
}

/* JSON 顯示 */
.copy-json-btn {
    margin-left: auto;
    padding: 6px 12px;
    background: #4db8a8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.copy-json-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(77, 184, 168, 0.3);
}

.json-display {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    max-height: 400px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    line-height: 1.5;
    margin: 0;
}

.json-display::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-display::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.json-display::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

/* 底部?��? */
.viewer-footer {
    display: flex;
    gap: 12px;
    padding: 20px 28px;
    background: white;
    border-top: 2px solid #e9ecef;
}

.viewer-footer button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ?�畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

/* 浮�?視�?主�? */
.workflow-modal {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease-out;
    overflow: hidden;
}

/* 視�?標�?�?*/
.workflow-modal-header {
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.workflow-modal-title {
    font-size: 1.5em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.workflow-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    transition: all 0.3s;
}

.workflow-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* 視�??�容?� */
.workflow-modal-content {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* ?��?滾�?�?*/
.workflow-modal-content::-webkit-scrollbar {
    width: 8px;
}

.workflow-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.workflow-modal-content::-webkit-scrollbar-thumb {
    background: #4db8a8;
    border-radius: 10px;
}

.workflow-modal-content::-webkit-scrollbar-thumb:hover {
    background: #3a9d8f;
}

/* ?�濾?��? */
.workflow-filter-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.workflow-filter-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #4db8a8;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.workflow-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.filter-option:hover {
    border-color: #4db8a8;
    background: #f0f3ff;
}

.filter-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4db8a8;
}

.filter-option.active {
    background: #4db8a8;
    border-color: #4db8a8;
    color: white;
}

.filter-option.active input[type="checkbox"] {
    accent-color: white;
}

/* 輸入?�數?�表 */
.workflow-inputs-list {
    display: grid;
    gap: 20px;
}

.workflow-input-group {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #4db8a8;
    transition: all 0.3s;
}

.workflow-input-group:hover {
    background: #f0f3ff;
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.1);
}

.workflow-input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.workflow-input-label {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.workflow-input-type-badge {
    background: #4db8a8;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}

.workflow-input-type-badge.type-prompt {
    background: #4db8a8;
}

.workflow-input-type-badge.type-image {
    background: #3a9d8f;
}

.workflow-input-type-badge.type-video {
    background: #f39c12;
}

.workflow-input-type-badge.type-number {
    background: #27ae60;
}

.workflow-input-type-badge.type-model {
    background: #e74c3c;
}

.workflow-input-type-badge.type-text {
    background: #3498db;
}

/* 輸入?�制??*/
.workflow-input-control {
    width: 100%;
}

.workflow-input-control input[type="text"],
.workflow-input-control input[type="number"],
.workflow-input-control textarea,
.workflow-input-control select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s;
    background: white;
}

.workflow-input-control textarea {
    min-height: 100px;
    resize: vertical;
    font-family: 'Microsoft JhengHei', sans-serif;
}

.workflow-input-control input:focus,
.workflow-input-control textarea:focus,
.workflow-input-control select:focus {
    outline: none;
    border-color: #4db8a8;
    box-shadow: 0 0 0 3px rgba(77, 184, 168, 0.1);
}

.workflow-input-control input[type="file"] {
    padding: 10px;
    border: 2px dashed #4db8a8;
    border-radius: 8px;
    cursor: pointer;
    background: #f0f3ff;
}

.workflow-input-control input[type="file"]:hover {
    background: #e6ebff;
}

/* 輸入?�示 */
.workflow-input-hint {
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 視�?底部?��?�?*/
.workflow-modal-footer {
    background: #f8f9fa;
    padding: 20px 25px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.workflow-modal-footer button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.workflow-modal-footer .btn-cancel {
    background: #e0e0e0;
    color: #333;
}

.workflow-modal-footer .btn-cancel:hover {
    background: #d0d0d0;
}

.workflow-modal-footer .btn-reset {
    background: #f39c12;
    color: white;
}

.workflow-modal-footer .btn-reset:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.workflow-modal-footer .btn-apply {
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
}

.workflow-modal-footer .btn-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.3);
}

/* 空�???*/
.workflow-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.workflow-empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.workflow-empty-state-text {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.workflow-empty-state-hint {
    font-size: 0.9em;
}

/* ?�畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

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

/* ?��?式設�?*/
@media (max-width: 768px) {
    .workflow-modal {
        width: 95%;
        max-height: 90vh;
    }

    .workflow-modal-header {
        padding: 15px 20px;
    }

    .workflow-modal-title {
        font-size: 1.2em;
    }

    .workflow-modal-content {
        padding: 20px;
    }

    .workflow-filter-options {
        flex-direction: column;
    }

    .workflow-modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }

    .workflow-modal-footer button {
        width: 100%;
        justify-content: center;
    }
}

/* ?��?徽�? */
.input-count-badge {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9em;
    margin-left: 10px;
}

/* 載入?�??*/
.workflow-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #4db8a8;
}

.workflow-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f3ff;
    border-top-color: #4db8a8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.workflow-loading-text {
    margin-top: 20px;
    font-size: 1.1em;
    color: #666;
}

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

/* 節點信?�顯�?*/
.workflow-node-info {
    background: #f0f3ff;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #4db8a8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.workflow-node-id {
    font-family: 'Consolas', 'Monaco', monospace;
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

/* 工�?流查?�器?��?�?? */
.workflow-viewer-modal {
    max-width: 900px;
    max-height: 90vh;
}

/* ?�數?�濾?�樣�?*/
.parameter-filter-header {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.filter-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.parameter-type-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.parameter-type-filter {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
}

.parameter-type-filter.has-params {
    border-color: #4db8a8;
    background: #f8f9ff;
}

.parameter-type-filter.no-params {
    opacity: 0.5;
    cursor: not-allowed;
}

.parameter-type-filter input[type="checkbox"] {
    margin: 0;
}

.parameter-type-filter:hover:not(.no-params) {
    border-color: #4db8a8;
    background: #f0f2ff;
}

/* ?�數?�容?�??- ?�寬平面顯示 */
.parameters-content {
    width: 100%;
    max-height: 600px;
    overflow-y: auto;
    box-sizing: border-box;
}

.parameters-content.viewer-parameters {
    max-height: none;
}

/* ========== ?�數?��?�??已廢�?- ?�為平面顯示 ========== */
/*
.parameter-group {
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.parameter-group.collapsed .parameter-group-content {
    display: none;
}

.parameter-group-header {
    background: #4db8a8;
    color: white;
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.parameter-group-header:hover {
    background: #5a67d8;
}

.parameter-group-header i.fa-chevron-down {
    transition: transform 0.2s;
}

.parameter-group.collapsed .parameter-group-header i.fa-chevron-down {
    transform: rotate(-90deg);
}

.parameter-group-content {
    background: white;
}
*/

.parameter-item-viewer {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}

.parameter-item-viewer:last-child {
    border-bottom: none;
}

.parameter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.parameter-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 1.1em;
}

.parameter-source {
    background: #e2e8f0;
    color: #4a5568;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

.parameter-details {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.parameter-key,
.parameter-type {
    font-size: 0.9em;
    color: #718096;
}

.parameter-value-display {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
}

.parameter-value-display pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #2d3748;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ?��??��???*/
.no-parameters-message {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.no-parameters-message i {
    font-size: 2em;
    margin-bottom: 10px;
    color: #cbd5e0;
}

.no-parameters-message p {
    margin: 10px 0 5px 0;
    font-size: 1.1em;
}

.no-parameters-message small {
    color: #a0aec0;
}

/* 節點�??�樣式改??*/
.node-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: box-shadow 0.2s;
}

.node-item:hover {
    box-shadow: 0 2px 8px rgba(77, 184, 168, 0.1);
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.node-id {
    font-weight: 600;
    color: #2d3748;
}

.node-type {
    background: #4db8a8;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

.node-title {
    color: #718096;
    font-size: 0.9em;
}

/* ?�編輯�??�樣�?*/
.editable-parameters {
    max-height: 500px;
}

.parameter-item-editable {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.parameter-item-editable:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.parameter-item-editable:last-child {
    border-bottom: none;
}

.parameter-input-container {
    margin-top: 12px;
}

.parameter-input {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s;
    background: white;
    box-sizing: border-box;
}

.parameter-input:focus {
    outline: none;
    border-color: #4db8a8;
    box-shadow: 0 0 0 3px rgba(77, 184, 168, 0.1);
}

.parameter-input.has-custom-value {
    border-color: #48bb78;
    background: #f0fff4;
}

.parameter-input.has-custom-value:focus {
    border-color: #38a169;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

.parameter-textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95em;
    line-height: 1.6;
    width: 100%;
    box-sizing: border-box;
}

.parameter-number,
.parameter-float {
    text-align: right;
}

.parameter-help {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 0.85em;
    color: #718096;
}

.parameter-help i {
    color: #a0aec0;
}

.parameter-default {
    background: #edf2f7;
    color: #4a5568;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* ?�濾?�統計改??*/
.filter-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.parameter-type-filter {
    user-select: none;
}

.parameter-type-filter.has-params:hover {
    border-color: #4db8a8;
    background: #f0f2ff;
    transform: translateY(-1px);
}

.parameter-type-filter input[type="checkbox"] {
    margin-right: 5px;
}

/* ?�畫?��?*/
.parameter-group {
    transition: all 0.3s ease;
}

.parameter-group.collapsed .parameter-group-content {
    display: none;
}

.parameter-group-header {
    user-select: none;
}

/* ?��?式設�?*/
@media (max-width: 768px) {
    .workflow-viewer-modal {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .parameter-type-filters {
        flex-direction: column;
    }

    .parameter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .parameter-details {
        flex-direction: column;
        gap: 5px;
    }

    .parameter-item-editable {
        padding: 15px 10px;
    }

    .parameter-input {
        padding: 8px 10px;
        font-size: 16px;
        /* ?�止 iOS 縮放 */
    }

    .parameter-textarea {
        min-height: 60px;
    }
}

/* �?移除?�新輸出?��?�??（已棄用�?/

/* 種�??�輸?��? */
.seed-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.seed-random-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    user-select: none;
}

.seed-random-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-custom {
    display: inline-block;
    font-weight: 500;
}

.parameter-seed {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.parameter-seed:disabled {
    background: #e9ecef;
    cursor: not-allowed;
    opacity: 0.6;
}

.parameter-seed:focus {
    border-color: #4db8a8;
    outline: none;
    box-shadow: 0 0 0 3px rgba(77, 184, 168, 0.1);
}

.seed-generate-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.seed-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.4);
}

.seed-generate-btn:active {
    transform: translateY(0);
}

.seed-generate-btn i {
    font-size: 16px;
}

/* ?��??��?輸入組樣�?*/
.image-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9ff 0%, #fff5f8 100%);
    border: 2px dashed #4db8a8;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.image-input-group:hover {
    border-color: #3a9d8f;
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.15);
}

.image-count-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #495057;
}

.image-count-label span {
    white-space: nowrap;
}

.image-count-input {
    flex: 1;
    max-width: 120px;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 600;
    color: #4db8a8;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
}

.image-count-input:focus {
    border-color: #4db8a8;
    outline: none;
    box-shadow: 0 0 0 3px rgba(77, 184, 168, 0.1);
}

.image-count-input:hover {
    border-color: #4db8a8;
}

.image-description {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(77, 184, 168, 0.1);
    border-radius: 6px;
    font-size: 13px;
    color: #4db8a8;
}

.image-description i {
    font-size: 14px;
}

/* ?�數?�濾?��?題樣式�?�?*/
.parameter-filter-header {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
    border: 1px solid #e0e5ff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(77, 184, 168, 0.08);
}

.filter-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e5ff;
}

.filter-title i {
    color: #4db8a8;
    font-size: 18px;
}

.parameter-type-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.parameter-type-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.parameter-type-filter:hover {
    border-color: #4db8a8;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(77, 184, 168, 0.15);
}

.parameter-type-filter input[type='checkbox'] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4db8a8;
}

.parameter-type-filter input[type='checkbox']:checked {
    accent-color: #3a9d8f;
}

.parameter-type-filter.has-params {
    border-color: #4db8a8;
    background: #f8f9ff;
    color: #4db8a8;
}

.parameter-type-filter.has-params input[type='checkbox']:checked+* {
    color: #3a9d8f;
}

.parameter-type-filter.no-params {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #e9ecef;
    background: #f8f9fa;
}

.parameter-type-filter.no-params:hover {
    transform: none;
    box-shadow: none;
}

.parameter-type-filter i {
    font-size: 14px;
}

/* ========================================
   ComfyUI 設�??�面�??
   ======================================== */

.comfyui-settings {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.comfyui-settings .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #dee2e6;
}

.comfyui-settings .section-header h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.5rem;
    color: #495057;
}

.comfyui-settings .section-header h4 i {
    color: #4db8a8;
    font-size: 1.3rem;
}

/* ??��?�?��?示器 */
.comfyui-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
    animation: pulse 2s infinite;
}

.status-indicator.offline {
    background: #dc3545;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
}

.status-indicator.online {
    background: #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

.status-indicator.connecting {
    background: #ffc107;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.status-text {
    font-weight: 500;
    color: #495057;
    font-size: 0.95rem;
}

/* ??��?�置表單 */
.connection-config {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.form-group label i {
    color: #4db8a8;
    font-size: 0.9rem;
}

.form-control {
    padding: 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
    color: #495057;
}

.form-control:focus {
    outline: none;
    border-color: #4db8a8;
    box-shadow: 0 0 0 3px rgba(77, 184, 168, 0.1);
}

.form-control:hover {
    border-color: #cbd5e0;
}

/* URL ?�覽 */
.url-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 8px;
}

.url-preview code {
    flex: 1;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    color: #4db8a8;
    font-weight: 600;
    background: transparent;
    padding: 0;
}

.btn-icon {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6c757d;
}

.btn-icon:hover {
    background: #4db8a8;
    color: white;
    border-color: #4db8a8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.3);
}

.btn-icon i {
    font-size: 0.9rem;
}

/* ??��?��??��? */
.connection-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* 工�?流�???*/
.workflow-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e9ecef;
}

.workflow-section .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.workflow-section .section-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
}

/* 工�?流�?置卡?�網??*/
.workflow-configs {
    margin-top: 1.5rem;
}

.task-type-configs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* 工�?流�?置卡??*/
.task-config-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.task-config-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4db8a8, #3a9d8f);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.task-config-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #4db8a8;
}

.task-config-card:hover::before {
    transform: scaleX(1);
}

.task-config-card .card-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(77, 184, 168, 0.3);
}

.task-config-card .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.task-config-card h5 {
    margin: 0;
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 600;
}

.config-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border-radius: 8px;
    background: #f8f9fa;
}

.config-status.not-configured {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
}

.config-status.configured {
    background: #d4edda;
    border-left: 3px solid #28a745;
}

.status-badge {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
}

.not-configured .status-badge {
    background: #ffc107;
    color: #856404;
}

.configured .status-badge {
    background: #28a745;
    color: white;
}

.file-name {
    font-size: 0.85rem;
    color: #6c757d;
    font-family: 'Consolas', monospace;
    word-break: break-all;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

/* ?��?�??統�? */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #65408b 100%);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-outline {
    background: white;
    color: #4db8a8;
    border: 2px solid #4db8a8;
}

.btn-outline:hover {
    background: #4db8a8;
    color: white;
}

/* 設�??��??�??*/
.settings-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e9ecef;
}

/* ?��?式設�?*/
@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }

    .task-type-configs {
        grid-template-columns: 1fr;
    }

    .task-config-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .task-config-card .card-content {
        align-items: center;
    }

    .task-config-card .card-actions {
        justify-content: center;
    }

    .connection-actions,
    .settings-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===================================
   AI ?��?設�? - ?��?任�?類�?�??
   =================================== */

/* ?��?任�?類�?顯示 */
.current-task-display {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.task-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.task-badge i {
    font-size: 20px;
    color: #4db8a8;
}

.task-badge span {
    font-weight: 600;
    color: #2d3748;
    font-size: 15px;
}

.task-hint {
    font-size: 13px;
    color: #718096;
    font-style: italic;
}

/* 任�?類�??��???- 移除（�??��?要�? */
.task-type-selector {
    display: none;
}

/* 工�?流�??�橫�?*/
.workflow-status-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: fadeInDown 0.4s ease-out;
}

.workflow-status-banner.info {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    border: 2px solid #0984e3;
    color: white;
}

.workflow-status-banner.success {
    background: linear-gradient(135deg, #55efc4 0%, #00b894 100%);
    border: 2px solid #00b894;
    color: white;
}

.workflow-status-banner.warning {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border: 2px solid #fdcb6e;
    color: #2d3748;
}

.workflow-status-banner.error {
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    border: 2px solid #d63031;
    color: white;
}

.workflow-status-banner .status-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.workflow-status-banner .status-content {
    flex: 1;
}

.workflow-status-banner .status-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
}

.workflow-status-banner .status-desc {
    font-size: 13px;
    opacity: 0.9;
}

/* 載入?�示??*/
.loading-indicator {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.loading-indicator i {
    font-size: 36px;
    color: #cbd5e0;
    margin-bottom: 15px;
    display: block;
}

.loading-indicator p {
    font-size: 14px;
    margin: 0;
}

/* ?�數?��?*/
.parameters-section {
    animation: fadeInUp 0.4s ease-out;
}

.parameters-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.parameters-section .section-header h5 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.parameters-section .workflow-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.parameters-section .workflow-badge i {
    font-size: 14px;
}

.parameters-section .workflow-parameters {
    background: white;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ?��??��??� */
.action-buttons {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    animation: fadeIn 0.5s ease-out;
}

.action-buttons button {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-buttons .generate-btn {
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
}

.action-buttons .generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(77, 184, 168, 0.4);
}

.action-buttons .stop-btn {
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    color: white;
}

.action-buttons .stop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(214, 48, 49, 0.4);
}

.action-buttons .check-btn {
    background: linear-gradient(135deg, #55efc4 0%, #00b894 100%);
    color: white;
}

.action-buttons .check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 184, 148, 0.4);
}

/* ?��??�??*/
.generation-status {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    animation: fadeIn 0.3s ease-out;
}

.generation-status .status-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
}

.generation-status .status-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.generation-status .progress-info {
    color: #4db8a8;
    font-weight: 600;
}

/* ?��?式設�?*/
@media (max-width: 768px) {
    .current-task-display {
        flex-direction: column;
        text-align: center;
    }

    .task-badge {
        justify-content: center;
    }

    .workflow-status-banner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .workflow-status-banner .status-icon {
        font-size: 24px;
    }

    .parameters-section .section-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }
}

/* ?�畫?��? */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* ===================================
   ?�數表單�??
   =================================== */

.parameters-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.parameter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: #2d3748;
}

.param-name {
    font-size: 14px;
    color: #2d3748;
}

.param-node {
    font-size: 12px;
    color: #718096;
    background: #edf2f7;
    padding: 4px 10px;
    border-radius: 12px;
}

.param-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
    background: white;
}

.param-input:focus {
    outline: none;
    border-color: #4db8a8;
    box-shadow: 0 0 0 3px rgba(77, 184, 168, 0.1);
}

.param-input:hover {
    border-color: #cbd5e0;
}

textarea.param-input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

input[type="checkbox"].param-input {
    width: auto;
    margin: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: #2d3748;
}

.no-parameters {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.no-parameters i {
    font-size: 48px;
    color: #cbd5e0;
    margin-bottom: 15px;
}

.no-parameters p {
    font-size: 15px;
    margin: 0;
}

/* ?�度條樣�?*/
.gen-progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.gen-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4db8a8 0%, #3a9d8f 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* ==================== ?��?：種子值隨機控?��?�?? ==================== */

/* ?��??�徽�?*/
.random-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 8px;
    box-shadow: 0 2px 6px rgba(245, 87, 108, 0.3);
}

/* 種�??�控?��? */
.seed-control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* ?��???checkbox 標籤 */
.random-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.random-checkbox-label:hover {
    background: #edf2f7;
}

.random-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #f5576c;
}

.random-checkbox-label span {
    font-size: 0.9em;
    font-weight: 500;
    color: #2d3748;
}

/* 種�??�輸?��? */
.seed-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.seed-input:focus {
    outline: none;
    border-color: #f5576c;
    box-shadow: 0 0 0 3px rgba(245, 87, 108, 0.1);
}

.seed-input:disabled {
    background: #edf2f7;
    color: #a0aec0;
    cursor: not-allowed;
}

/* ?��??��??��???*/
.generate-random-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

.generate-random-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.generate-random-btn:active {
    transform: translateY(0);
}

/* ==================== ?��?：顯示更多�??�樣�?==================== */

.show-more-btn {
    margin-top: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(77, 184, 168, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.show-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(77, 184, 168, 0.4);
}

.show-more-btn:active {
    transform: translateY(0);
}

/* ?��??�?��?輸入框樣�?*/
input[data-expanded="true"],
textarea[data-expanded="true"] {
    border-color: #4db8a8;
    background: #f7fafc;
}