/* ============================================
   ZENFLOW - Custom Styles
   Theme Support: Dark & Light Mode
   ============================================ */

/* ============================================
   CSS Variables - Dark Theme (Default)
   ============================================ */
:root {
    /* Node Colors */
    --node-start-color: #22c55e;
    --node-input-color: #3b82f6;
    --node-process-color: #8b5cf6;
    --node-output-color: #f97316;

    /* Connection Colors */
    --connection-color: #8b5cf6;
    --connection-hover: #a78bfa;

    /* Sizing */
    --dot-size: 14px;
    --node-width: 220px;
    --node-border-radius: 12px;
    --grid-size: 20px;

    /* Dark Theme Colors */
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --bg-hover: #4b5563;

    --text-primary: #ffffff;
    --text-secondary: #e5e7eb;
    --text-tertiary: #9ca3af;
    --text-muted: #6b7280;

    --border-color: #374151;
    --border-light: #4b5563;

    --canvas-bg: #111827;
    --grid-color: #1f2937;

    --header-bg: #1f2937;
    --sidebar-bg: #1f2937;
    --node-bg: #1f2937;
    --input-bg: #374151;
    --modal-bg: #1f2937;
    --overlay-bg: rgba(0, 0, 0, 0.8);

    --shadow-color: rgba(0, 0, 0, 0.4);
    --shadow-heavy: rgba(0, 0, 0, 0.5);
}

/* ============================================
   CSS Variables - Light Theme
   ============================================ */
[data-theme="light"] {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e7eb;
    --bg-hover: #d1d5db;

    --text-primary: #111827;
    --text-secondary: #374151;
    --text-tertiary: #6b7280;
    --text-muted: #9ca3af;

    --border-color: #d1d5db;
    --border-light: #e5e7eb;

    --canvas-bg: #e5e7eb;
    --grid-color: #d1d5db;

    --header-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --node-bg: #ffffff;
    --input-bg: #f3f4f6;
    --modal-bg: #ffffff;
    --overlay-bg: rgba(0, 0, 0, 0.5);

    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.15);
}

/* ============================================
   Canvas Grid Background
   ============================================ */
.canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    pointer-events: none;
}

/* ============================================
   Node Base Styles
   ============================================ */
.workflow-node {
    position: absolute;
    width: var(--node-width);
    background: var(--node-bg);
    border-radius: var(--node-border-radius);
    box-shadow: 0 4px 20px var(--shadow-color);
    cursor: move;
    user-select: none;
    transition: box-shadow 0.2s, transform 0.1s, background 0.3s;
    z-index: 10;
    border: 1px solid var(--border-color);
}

.workflow-node:hover {
    box-shadow: 0 8px 30px var(--shadow-heavy);
}

.workflow-node.selected {
    box-shadow: 0 0 0 2px var(--connection-color), 0 8px 30px rgba(139, 92, 246, 0.3);
}

.workflow-node.dragging {
    opacity: 0.9;
    transform: scale(1.02);
    z-index: 100;
}

/* ============================================
   Node Header Styles
   ============================================ */
.node-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--node-border-radius) var(--node-border-radius) 0 0;
    font-weight: 600;
    font-size: 14px;
}

.node-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.node-icon svg {
    width: 16px;
    height: 16px;
    stroke: white;
}

.node-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.node-delete {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}

.workflow-node:hover .node-delete {
    opacity: 1;
}

.node-delete:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* ============================================
   Node Type Specific Styles
   ============================================ */

/* Start Node */
.workflow-node[data-type="start"] .node-header {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(34, 197, 94, 0.1));
    border-bottom: 1px solid rgba(34, 197, 94, 0.3);
}

.workflow-node[data-type="start"] .node-icon {
    background: var(--node-start-color);
}

.workflow-node[data-type="start"] .output-dot {
    background: var(--node-start-color);
}

/* Input Image Node */
.workflow-node[data-type="input_image"] .node-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(59, 130, 246, 0.1));
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
}

.workflow-node[data-type="input_image"] .node-icon {
    background: var(--node-input-color);
}

.workflow-node[data-type="input_image"] .input-dot {
    background: var(--node-input-color);
}

.workflow-node[data-type="input_image"] .output-dot {
    background: var(--node-input-color);
}

/* Process API Node */
.workflow-node[data-type="process_api"] .node-header {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(139, 92, 246, 0.1));
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
}

.workflow-node[data-type="process_api"] .node-icon {
    background: var(--node-process-color);
}

.workflow-node[data-type="process_api"] .input-dot {
    background: var(--node-process-color);
}

.workflow-node[data-type="process_api"] .output-dot {
    background: var(--node-process-color);
}

/* Image to Image Node */
.workflow-node[data-type="process_img2img"] .node-header {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(236, 72, 153, 0.1));
    border-bottom: 1px solid rgba(236, 72, 153, 0.3);
}

.workflow-node[data-type="process_img2img"] .node-icon {
    background: #ec4899;
}

.workflow-node[data-type="process_img2img"] .input-dot {
    background: #ec4899;
}

.workflow-node[data-type="process_img2img"] .output-dot {
    background: #ec4899;
}

/* Output Preview Node */
.workflow-node[data-type="output_preview"] .node-header {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.3), rgba(249, 115, 22, 0.1));
    border-bottom: 1px solid rgba(249, 115, 22, 0.3);
}

.workflow-node[data-type="output_preview"] .node-icon {
    background: var(--node-output-color);
}

.workflow-node[data-type="output_preview"] .input-dot {
    background: var(--node-output-color);
}

/* ============================================
   Node Body Styles
   ============================================ */
.node-body {
    padding: 14px;
    min-height: 40px;
}

.node-body-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 8px 0;
}

/* ============================================
   Node Input/Output Dots (Connection Points)
   ============================================ */
.connection-dots {
    position: absolute;
    top: 60px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.connection-dots.input-dots {
    left: calc(-1 * var(--dot-size) / 2);
}

.connection-dots.output-dots {
    right: calc(-1 * var(--dot-size) / 2);
}

.connection-dot {
    width: var(--dot-size);
    height: var(--dot-size);
    border-radius: 50%;
    border: 2px solid #374151;
    cursor: crosshair;
    transition: all 0.2s;
    position: relative;
}

.connection-dot::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: transparent;
}

.connection-dot:hover {
    transform: scale(1.3);
    border-color: transparent;
    box-shadow: 0 0 10px currentColor;
}

.connection-dot.connecting {
    animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }
}

.input-dot {
    background: #374151;
}

.output-dot {
    background: #374151;
}

/* ============================================
   Connection Lines (SVG)
   ============================================ */
.connection-line {
    stroke: var(--connection-color);
    stroke-width: 2;
    fill: none;
    pointer-events: stroke;
    cursor: pointer;
    transition: stroke 0.2s, stroke-width 0.2s;
}

.connection-line:hover {
    stroke: var(--connection-hover);
    stroke-width: 3;
}

.connection-line.temp {
    stroke-dasharray: 8, 4;
    animation: dash-animation 0.5s linear infinite;
    pointer-events: none;
}

@keyframes dash-animation {
    to {
        stroke-dashoffset: -12;
    }
}

.connection-line.active {
    stroke: #22c55e;
    filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.5));
}

/* ============================================
   File Input Styles
   ============================================ */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
}

.file-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-tertiary);
}

.file-input-label:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.file-input-label.has-file {
    border-color: #22c55e;
    border-style: solid;
    background: rgba(34, 197, 94, 0.1);
}

.file-input-label svg {
    width: 32px;
    height: 32px;
    stroke: var(--text-muted);
    margin-bottom: 8px;
}

.file-input-label.has-file svg {
    stroke: #22c55e;
}

.file-input-label span {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
}

.file-input-label.has-file span {
    color: #22c55e;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-preview {
    margin-top: 10px;
    border-radius: 6px;
    overflow: hidden;
    max-height: 100px;
}

.file-preview img {
    width: 100%;
    height: auto;
    max-height: 100px;
    object-fit: cover;
}

.file-name {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 6px;
    word-break: break-all;
    text-align: center;
}

/* ============================================
   Input Mode Tabs (File / URL)
   ============================================ */
.input-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.input-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s;
}

.input-tab:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.input-tab.active {
    background: var(--connection-color);
    border-color: var(--connection-color);
    color: white;
}

.input-mode-content {
    position: relative;
}

.input-mode-file,
.input-mode-url {
    display: none;
}

.input-mode-file.active,
.input-mode-url.active {
    display: block;
}

/* URL Input Wrapper */
.url-input-wrapper {
    padding: 8px 0;
}

.url-load-btn {
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 500;
    background: var(--node-input-color);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.url-load-btn:hover {
    background: #2563eb;
}

.url-load-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.url-load-btn.loading {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.url-preview {
    margin-top: 10px;
    border-radius: 6px;
    overflow: hidden;
    max-height: 100px;
}

.url-preview img {
    width: 100%;
    height: auto;
    max-height: 100px;
    object-fit: cover;
    border-radius: 6px;
}

.url-status {
    font-size: 11px;
    margin-top: 6px;
    text-align: center;
}

.url-status.success {
    color: #22c55e;
}

.url-status.error {
    color: #ef4444;
}

.url-status.loading {
    color: var(--text-tertiary);
}

/* ============================================
   API URL Input Styles
   ============================================ */
.api-input-group {
    margin-bottom: 10px;
}

.api-input-group label {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.api-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s, background 0.3s;
}

.api-input:focus {
    border-color: var(--connection-color);
}

.api-input::placeholder {
    color: var(--text-muted);
}

/* ============================================
   Output Preview Styles
   ============================================ */
.output-preview-container {
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(55, 65, 81, 0.3);
    border-radius: 8px;
    padding: 12px;
}

.output-preview-container.has-result {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.output-preview-container .placeholder {
    color: #6b7280;
    font-size: 12px;
    text-align: center;
}

.output-preview-container .placeholder svg {
    width: 32px;
    height: 32px;
    stroke: #4b5563;
    margin-bottom: 8px;
}

.output-preview-container img,
.output-preview-container video {
    max-width: 100%;
    max-height: 120px;
    border-radius: 4px;
}

/* ============================================
   Node Status Indicators
   ============================================ */
.node-status {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s;
}

.workflow-node.status-running .node-status {
    opacity: 1;
    background: #fbbf24;
    animation: pulse-status 1s infinite;
}

.workflow-node.status-completed .node-status {
    opacity: 1;
    background: #22c55e;
}

.workflow-node.status-error .node-status {
    opacity: 1;
    background: #ef4444;
}

@keyframes pulse-status {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* ============================================
   Loading Spinner
   ============================================ */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #374151;
    border-top-color: var(--connection-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Log Panel Styles
   ============================================ */
#logPanel.open {
    height: 200px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.log-entry.info {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
}

.log-entry.success {
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid #22c55e;
}

.log-entry.error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

.log-entry.warning {
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid #fbbf24;
}

.log-time {
    color: #6b7280;
    font-size: 11px;
    white-space: nowrap;
}

.log-message {
    flex: 1;
    word-break: break-word;
}

/* ============================================
   Result Modal Styles
   ============================================ */
#resultContent img,
#resultContent video {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 10px;
}

.result-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 14px;
    padding: 16px;
    background: #374151;
    border-radius: 8px;
    margin-bottom: 16px;
}

.result-info dt {
    color: #9ca3af;
}

.result-info dd {
    color: white;
    word-break: break-all;
}

/* ============================================
   Custom Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ============================================
   Node Template Drag Ghost
   ============================================ */
.node-template.dragging {
    opacity: 0.5;
}

/* ============================================
   Tooltip Styles
   ============================================ */
.tooltip {
    position: absolute;
    background: #1f2937;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s;
}

.tooltip.visible {
    opacity: 1;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

/* --- Tablet & below (≤ 768px / md breakpoint) --- */
@media (max-width: 768px) {
    /* Sidebar: off-canvas by default, slide-in as overlay */
    #sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        width: 260px;
    }

    #sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.5);
    }

    /* Canvas & log panel: full width */
    #canvasContainer {
        left: 0 !important;
    }

    #logPanel {
        left: 0 !important;
    }

    /* Smaller nodes */
    :root {
        --node-width: 200px;
    }

    /* Result modal: nearly fullscreen */
    #resultModal .modal-content,
    #loadModal .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh;
        margin: 5vh auto;
    }

    /* Fullscreen image gallery: touch-friendly */
    #fullscreenImageModal {
        padding: 10px;
    }

    #fullscreenImageModal img {
        max-height: 80vh;
    }

    /* Admin: table scroll wrapper */
    .table-responsive-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive-wrapper table {
        min-width: 600px;
    }

    /* Context menu: don't overflow screen */
    .context-menu {
        max-width: calc(100vw - 20px);
    }
}

/* --- Small mobile (≤ 480px) --- */
@media (max-width: 480px) {
    :root {
        --node-width: 170px;
    }

    /* Even more compact header */
    header {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Sidebar slightly narrower */
    #sidebar {
        width: 240px;
    }

    /* Modals: true fullscreen */
    #resultModal .modal-content,
    #loadModal .modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    /* Node palette items: more compact */
    .node-palette-item {
        padding: 8px;
        gap: 8px;
    }

    /* Log panel: taller for readability */
    #logPanel.open {
        height: 250px;
    }

    .log-entry {
        font-size: 11px;
        padding: 6px 8px;
    }
}

/* ============================================
   Selection Box (Future Feature)
   ============================================ */
.selection-box {
    position: absolute;
    border: 1px dashed var(--connection-color);
    background: rgba(139, 92, 246, 0.1);
    pointer-events: none;
    z-index: 5;
}

/* ============================================
   Context Menu Styles
   ============================================ */
.context-menu {
    position: fixed;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 6px 0;
    min-width: 160px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #e5e7eb;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: #374151;
}

.context-menu-item.danger {
    color: #ef4444;
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.context-menu-item svg {
    width: 16px;
    height: 16px;
}

.context-menu-separator {
    height: 1px;
    background: #374151;
    margin: 6px 0;
}

/* ============================================
   Minimap (Future Feature Placeholder)
   ============================================ */
.minimap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 180px;
    height: 120px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    overflow: hidden;
    z-index: 40;
    display: none;
    /* Hidden for MVP */
}

/* ============================================
   Animation Utilities
   ============================================ */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scale-in {
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   Print Styles (Hidden)
   ============================================ */
@media print {
    body * {
        visibility: hidden;
    }

    #canvas,
    #canvas * {
        visibility: visible;
    }
}

/* Textarea for prompt */
textarea.api-input {
    width: 100%;
    padding: 8px 10px;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

textarea.api-input:focus {
    border-color: #8b5cf6;
}

textarea.api-input::placeholder {
    color: #6b7280;
}

/* Video in output preview */
.output-preview-container video {
    max-width: 100%;
    max-height: 120px;
    border-radius: 4px;
}

/* Result modal video */
#resultContent video {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
}

/* ============================================
   Theme Toggle Button
   ============================================ */
.theme-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    padding: 2px;
}

.theme-toggle:hover {
    border-color: var(--connection-color);
}

.theme-toggle-slider {
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--connection-color);
    border-radius: 50%;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    left: 2px;
}

[data-theme="light"] .theme-toggle-slider {
    transform: translateX(20px);
    background: #f59e0b;
}

.theme-toggle-icon {
    width: 12px;
    height: 12px;
    fill: white;
}

/* Icons visibility */
.theme-toggle .icon-moon {
    display: block;
}

.theme-toggle .icon-sun {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

/* Theme label */
.theme-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-right: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Global Theme Transitions
   ============================================ */
body,
.workflow-node,
.node-header,
.node-body,
#sidebar,
#logPanel,
#resultModal,
.context-menu,
.api-input,
.file-input-label {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   Theme Aware Components
   ============================================ */
.node-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: grab;
    transition: background-color 0.2s, color 0.2s;
    color: var(--text-primary);
    border: 1px solid transparent;
}

.node-palette-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.node-palette-item .node-desc {
    color: var(--text-muted);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: background-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.info-box {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
}

.info-box h3 {
    color: var(--text-primary);
}

.info-box ul {
    color: var(--text-muted);
}
/* ============================================
   User Menu Overrides for Light Mode
   ============================================ */
#userDropdown {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

#userDropdown > div {
    border-color: var(--border-color) !important;
}

#userDropdown a {
    color: var(--text-primary) !important;
}

#userDropdown a:hover, 
#userDropdown button:hover {
    background-color: var(--bg-hover) !important;
}

#userName {
    color: var(--text-primary) !important;
}

#userRole {
    color: var(--text-muted) !important;
}


/* ============================================
   Load Modal Overrides for Light Mode
   ============================================ */
#loadModal .modal-content {
    background-color: var(--modal-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
}

.workflow-item {
    background-color: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color);
}

.workflow-item:hover {
    background-color: var(--bg-hover) !important;
}

.workflow-item h3 {
    color: var(--text-primary) !important;
}

.workflow-item p {
    color: var(--text-secondary) !important;
}

