/* style.css */

/* Import Fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

/* --- CSS Custom Properties (Variables) --- */
:root {
    /* Base colors */
    --primary-color: #8A2BE2; /* Twitch Purple - vibrant and recognizable */
    --primary-light: #A450F0;
    --primary-dark: #6A1E9E;
    --secondary-color: #1DB954; /* Spotify Green - energetic contrast */
    --secondary-light: #40C771;
    --secondary-dark: #17A047;

    /* Text colors */
    --text-primary: #EAEAEA; /* Light grey for dark backgrounds */
    --text-secondary: #B0B0B8; /* Softer grey for less emphasis */
    --text-on-primary: #FFFFFF;
    --text-on-secondary: #FFFFFF;

    /* Background colors */
    --background-base: #18181B; /* Very dark grey, almost black */
    --background-surface: #1F1F23; /* Slightly lighter for surfaces like cards, sidebars */
    --background-dialog: #2A2A2E; /* For modals and pop-ups */
    --background-hover: #2E2E32; /* Hover state for interactive elements */
    --background-selected: #3A3A3E; /* Selected items */


    /* Border colors */
    --border-color: #3E3E42; /* Subtle borders */
    --border-interactive: #505054; /* For interactive elements */

    /* Status colors */
    --success-color: #00C853;
    --error-color: #FF3B30; /* Brighter red for errors */
    --warning-color: #FF9F0A; /* Brighter orange for warnings */
    --info-color: #0A84FF;   /* Brighter blue for info */

    /* Shadows - subtle for dark themes */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 3px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 6px 12px rgba(0, 0, 0, 0.3);

    /* Border radius */
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    /* Transitions */
    --transition-speed-fast: 0.15s;
    --transition-speed-normal: 0.25s;

    /* Node dimensions */
    --node-width: 220px;
    --node-min-height: 90px;
    --port-size: 16px;

    /* Flow editor specific node type colors */
    --trigger-color: #0A84FF;      /* Info Blue */
    --trigger-bg: rgba(10, 132, 255, 0.15);
    --action-color: #1A7D3A;       /* UPDATED: Darker Green */
    --action-bg: rgba(26, 125, 58, 0.2); /* Adjusted background for consistency if used */
    --logic-color: #B45309;        /* UPDATED: Darker Amber/Orange */
    --logic-bg: rgba(180, 83, 9, 0.2); /* Adjusted background for consistency if used */
    --state-color: #9333EA;         /* Purple for state management nodes */
    --state-bg: rgba(147, 51, 234, 0.2); /* State node background */

    /* Fonts */
    --font-primary: 'Inter', sans-serif;
    --font-monospace: 'Fira Code', monospace;
}

/* --- Base & Global Styles --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body, html {
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: var(--font-primary);
    background-color: var(--background-base);
    color: var(--text-primary);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75em;
    color: var(--text-primary);
}
h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1em;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-speed-fast) ease;
}

a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* --- General UI Elements --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6em 1.2em;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-speed-fast) ease,
                color var(--transition-speed-fast) ease,
                transform var(--transition-speed-fast) ease,
                box-shadow var(--transition-speed-fast) ease;
    cursor: pointer;
    border: 1px solid transparent;
    outline: none;
    background-color: var(--background-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background-color: var(--background-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-primary.disabled {
    background-color: var(--background-surface);
    color: var(--text-secondary);
    border-color: var(--border-interactive);
    cursor: default;
    opacity: 0.6;
}

.btn-primary.disabled:hover {
    background-color: var(--background-surface);
    transform: none;
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-on-secondary);
    border-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
}

.btn-ghost {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    box-shadow: none;
}

.btn-ghost:hover {
    background-color: var(--background-hover);
    border-color: var(--primary-light);
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.6em 0.8em;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-interactive);
    background-color: var(--background-base);
    color: var(--text-primary);
    transition: border-color var(--transition-speed-fast) ease, box-shadow var(--transition-speed-fast) ease;
}

/* Allow text selection on specific elements where it's needed */
input[type="text"],
input[type="number"],
input[type="url"],
input[type="email"],
input[type="password"],
textarea,
select,
.node-properties .property-label, /* Property labels */
.node-properties .property-input, /* Includes text inputs in properties */
.node-properties .property-help, /* Help text */
.node-properties h4, /* Node title in properties */
.node-title, /* Node titles on canvas */
.node-body, /* Node descriptions on canvas */
.flow-item-name, /* Flow names in the list */
#flow-name, /* Current flow name input */
.test-panel input, /* Inputs in test panel */
.test-panel textarea,
.test-panel label,
.test-results pre, /* Allow copying test results */
.test-results p,
.test-results h4 {
    user-select: auto; /* Or 'text' for more explicit control */
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color), 0.3);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23B0B0B8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8em center;
    background-size: 1em;
    padding-right: 2.5em; /* Make space for arrow */
}

input[type="checkbox"] {
    width: 1.15em;
    height: 1.15em;
    accent-color: var(--primary-color);
    margin-right: 0.5em;
    vertical-align: middle;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4em;
    display: inline-block;
    color: var(--text-secondary);
}

/* --- Flow Editor Layout --- */
.editor-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.editor-header {
    background-color: var(--background-surface);
    color: var(--text-primary);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.editor-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 0;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.editor-body {
    flex: 1;
    display: flex;
    overflow: hidden;
	user-select: none; /* Non-standard, but widely supported */
    -webkit-user-select: none; /* Safari/Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE/Edge */
}

#editor-container { /* Main container for the three panels */
    flex: 1;
    overflow: hidden;
}

/* --- Flow Editor Container (holds sidebar, canvas, properties) --- */
.flow-editor-container {
    display: flex;
    height: 100%;
    font-family: var(--font-primary);
    color: var(--text-primary);
}

.flow-sidebar {
    width: 260px;
    background-color: var(--background-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 15px;
    height: 100%; /* Ensure sidebar tries to fill parent height */
    overflow-y: auto; /* Unified scrolling for entire sidebar */
}

.flow-sidebar h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}
.flow-sidebar h3:first-child {
    margin-top: 0;
}


.flow-list-container {
    margin-bottom: 15px;
}

.flow-list {
    margin-bottom: 10px;
}

.flow-list-empty {
    border: 1px dashed var(--border-interactive);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    background-color: rgba(255, 255, 255, 0.02);
}

.flow-list-empty-title {
    font-weight: 600;
    color: var(--text-primary);
}

.flow-list-empty-copy {
    margin-top: 6px;
}

.flow-item {
    padding: 8px 12px;
    margin-bottom: 6px;
    background-color: var(--background-base);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid var(--border-interactive);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color var(--transition-speed-fast) ease, border-color var(--transition-speed-fast) ease;
}

.flow-item:hover {
    background-color: var(--background-hover);
    border-color: var(--primary-light);
}

.flow-item.selected-flow {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    border-color: var(--primary-dark);
}
.flow-item.selected-flow:hover {
    background-color: var(--primary-dark);
}
.flow-item.selected-flow .flow-item-name,
.flow-item.selected-flow .flow-item-delete,
.flow-item.selected-flow .flow-item-status {
    color: var(--text-on-primary);
}

.flow-item-name {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
    font-size: 0.9rem;
}

.flow-item-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.flow-item-status {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

.flow-item-status.active {
    color: var(--success-color);
}

.flow-item-status.inactive {
    color: var(--text-secondary);
}

.flow-item-delete {
    display: inline-flex; /* Use flex for centering */
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: color var(--transition-speed-fast) ease, background-color var(--transition-speed-fast) ease;
}

.flow-item-delete:hover {
    color: var(--error-color);
    background-color: rgba(var(--error-color), 0.1);
}

/* Node Palette */
.node-palette {
    padding-bottom: 50px; /* Add some padding at the bottom for scrolling comfort */
}

.node-list {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.node-item {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: grab;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-on-primary);
    transition: transform var(--transition-speed-fast) ease, box-shadow var(--transition-speed-fast) ease;
    border: 1px solid transparent;
	user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
.node-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.node-item.trigger {
    background-color: var(--trigger-color);
    border-color: var(--trigger-color);
}
.node-item.action {
    background-color: var(--action-color);
    border-color: var(--action-color);
}
.node-item.logic {
    background-color: var(--logic-color);
    border-color: var(--logic-color);
}
.node-item.state {
    background-color: var(--state-color);
    border-color: var(--state-color);
}

/* --- Action Group Collapsible Sections --- */
.action-group {
    margin-bottom: 4px;
}

.action-group-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: var(--radius-md);
    background-color: var(--background-base);
    border: 1px solid var(--border-color);
    transition: background-color var(--transition-speed-fast) ease;
    user-select: none;
}

.action-group-header:hover {
    background-color: var(--background-surface);
}

.action-group-toggle {
    font-size: 0.7rem;
    margin-right: 8px;
    color: var(--text-secondary);
    width: 10px;
}

.action-group-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.action-group-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0 4px 8px;
    margin-left: 8px;
    border-left: 2px solid var(--border-color);
}

/* --- Trigger Group Collapsible Sections --- */
.trigger-group {
    margin-bottom: 4px;
}

.trigger-group-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: var(--radius-md);
    background-color: var(--background-base);
    border: 1px solid var(--border-color);
    transition: background-color var(--transition-speed-fast) ease;
    user-select: none;
}

.trigger-group-header:hover {
    background-color: var(--background-surface);
}

.trigger-group-toggle {
    font-size: 0.7rem;
    margin-right: 8px;
    color: var(--text-secondary);
    width: 10px;
}

.trigger-group-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.trigger-group-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0 4px 8px;
    margin-left: 8px;
    border-left: 2px solid var(--border-color);
}


/* --- Flow Editor Main Area --- */
.flow-editor { /* Panel containing header (name, save) and canvas container */
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--background-base);
}

.flow-editor-header { /* Header above canvas with flow name, save button etc. */
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-surface);
}

.flow-help-banner {
    display: none;
    margin: 16px 20px 0;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(102, 126, 234, 0.4);
    background: rgba(99, 102, 241, 0.12);
    color: var(--text-primary);
    gap: 12px;
    align-items: center;
    position: relative;
    flex-wrap: wrap;
}

.flow-help-banner.visible {
    display: flex;
}

.flow-help-banner-text {
    flex: 1;
    min-width: 220px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.flow-help-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.flow-help-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 6px;
}

.flow-help-dismiss:hover {
    color: var(--text-primary);
}

#flow-name {
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    padding: 8px 10px;
    width: auto; /* Adjust as needed, or make it flex grow */
    min-width: 200px;
    max-width: 400px;
    background-color: var(--background-base);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-interactive);
    transition: box-shadow var(--transition-speed-fast) ease;
}

#flow-name:focus {
    outline: none;
    border-color: var(--primary-color);
}

#flow-name.unsaved::after {
    content: "*";
    color: var(--accent-warning);
    font-weight: bold;
    margin-left: 2px;
    position: absolute;
}

.flow-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.flow-active-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.flow-active-toggle input[type="checkbox"] { /* Visually hide the actual checkbox */
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.slider { /* Custom switch track */
    position: relative;
    display: inline-block;
    width: 40px; /* Slightly larger */
    height: 22px;
    background-color: var(--border-interactive);
    border-radius: 11px; /* Fully rounded */
    transition: background-color var(--transition-speed-fast) ease;
}

.slider:before { /* Custom switch thumb */
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform var(--transition-speed-fast) ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

/* Flow Canvas */
.flow-canvas-container {
    flex: 1;
    overflow: auto; /* Important for scrollbars */
    position: relative; /* For positioning canvas and nodes */
    background-color: var(--background-base);
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px); /* Grid background */
    background-size: 20px 20px; /* Grid size */
}

.flow-canvas {
    position: relative; /* Child nodes are positioned relative to this */
    min-height: 100%; /* Ensure it fills container */
    min-width: 100%;
    /* Large fixed size allows nodes to be placed far out, container scroll handles overflow */
    height: max(100%, 1000px);
    width: max(100%, 1400px);
}

/* --- Node Styles --- */
.node {
    position: absolute;
    width: var(--node-width);
    min-height: var(--node-min-height);
    background-color: var(--background-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    user-select: none;
    z-index: 10; /* Nodes above connections */
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--transition-speed-fast) ease, border-color var(--transition-speed-fast) ease;
}
.node:hover {
    box-shadow: var(--shadow-lg);
}

.node.selected {
    box-shadow: 0 0 0 2px var(--primary-color), var(--shadow-lg);
    border-color: var(--primary-color);
}

.node-header {
    padding: 10px 12px;
    border-top-left-radius: var(--radius-lg); /* Match parent */
    border-top-right-radius: var(--radius-lg); /* Match parent */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-on-primary); /* Assume light text on colored headers */
}

.node.trigger .node-header { background-color: var(--trigger-color); }
.node.action .node-header { background-color: var(--action-color); }
.node.logic .node-header { background-color: var(--logic-color); }
.node.state .node-header { background-color: var(--state-color); }
.node.unknown .node-header { background-color: var(--text-secondary); }


.node-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-delete {
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2); /* Darken for visibility on colored headers */
    color: white;
    font-size: 12px;
    transition: background-color var(--transition-speed-fast) ease;
}
.node-delete:hover {
    background-color: rgba(0,0,0,0.4);
}


.node-body {
    padding: 10px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-grow: 1; /* Allows body to fill space if header/footer fixed */
    word-wrap: break-word;
}

/* Connection Points */
.connection-point {
    position: absolute;
    width: var(--port-size); /* Will now be 16px */
    height: var(--port-size); /* Will now be 16px */
    background-color: var(--background-base);
    border: 2px solid var(--primary-dark); /* Border remains 2px, consider if this needs to scale too */
    border-radius: 50%;
    cursor: crosshair;
    z-index: 12; /* Above node body */
    transition: transform var(--transition-speed-fast) ease, background-color var(--transition-speed-fast) ease;
}
.connection-point:hover {
    transform: scale(1.2); /* Hover will make the larger dot even bigger */
    background-color: var(--primary-light);
}

.connection-point.input {
    top: calc(var(--port-size) / -2); /* Correctly positions the larger dot */
    left: 50%;
    transform: translateX(-50%);
}

.connection-point.output {
    bottom: calc(var(--port-size) / -2); /* Correctly positions the larger dot */
    left: 50%;
    transform: translateX(-50%);
}

.connection-point.output.async-output {
    border: 2px dashed #9b59b6; /* Purple dashed border for async outputs */
    background-color: rgba(155, 89, 182, 0.1); /* Light purple background */
}
.connection-point.output.async-output:hover {
    background-color: rgba(155, 89, 182, 0.3);
    border-color: #9b59b6;
}

/* Specific logic input point styles from HTML */
.connection-point.input.logic-input-single {
    border: 2px solid var(--logic-color);
}
.connection-point.input.logic-input-single:hover {
    background-color: var(--logic-color);
}

.connection-point.input.logic-input-multiple {
    border: 3px solid var(--warning-color);
    background-color: var(--logic-bg); /* Use the bg for better contrast */
    transform: translateX(-50%) scale(1.1);
}
.connection-point.input.logic-input-multiple:hover {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
}


/* SVG Connections */
.connection {
    position: absolute; /* Relative to flow-canvas */
    left:0;
    top:0;
    width: 100%; /* Spans entire canvas */
    height: 100%;
    pointer-events: none; /* Allows clicking through */
    z-index: 1; /* Behind nodes */
}

.connection path {
    stroke-width: 2.5px; /* Slightly thicker */
    transition: stroke var(--transition-speed-fast) ease, stroke-width var(--transition-speed-fast) ease;
}
/* Hover effect for connections can be tricky as they are pointer-events: none.
   If interaction is needed, it usually involves invisible shapes or JS. */

.temp-connection { /* For the line being dragged */
    z-index: 1000; /* Above everything */
}
.temp-connection path {
    stroke-dasharray: 4, 4; /* Dashed line */
    stroke-width: 2px;
}


/* Node Properties Panel */
.node-properties {
    width: 320px; /* Slightly wider */
    background-color: var(--background-surface);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
}
.node-properties h3 { /* Overall panel title */
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.node-properties h4 { /* Node specific title in panel */
    font-size: 1rem;
    color: var(--primary-light);
    margin-bottom: 15px;
}

.node-help-links {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.node-help-question {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.node-help-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.node-help-buttons .btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
}

.property-group {
    margin-bottom: 18px;
}

.property-label { /* For labels above inputs */
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.property-input { /* Class for all inputs in properties panel */
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-interactive);
    background-color: var(--background-base);
    color: var(--text-primary);
    font-size: 0.85rem;
}
.property-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color), 0.2);
}

textarea.property-input {
    min-height: 100px;
    font-family: var(--font-monospace); /* Good for code inputs */
}

select.property-input {
    /* appearance, background-image, etc. inherited from global select styles */
}

.property-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.5;
}


.test-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 650px; /* Slightly wider modal */
    background-color: var(--background-dialog);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none; /* Controlled by JS */
    padding: 25px;
    color: var(--text-primary);
	max-height: 90vh;
	flex-direction: column;
}

.test-panel-header {
    padding: 25px 25px 15px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevent header from shrinking */
}

.test-panel-content {
    flex-grow: 1;
    overflow-y: auto; /* Make content area scrollable */
    padding: 0 25px;
}

.test-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 0;
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    background-color: var(--background-dialog);
    flex-shrink: 0; /* Prevent footer from shrinking */
}

#test-panel {
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Optional: Improve the scrollbar appearance */
#test-panel::-webkit-scrollbar {
  width: 8px;
}

#test-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#test-panel::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

#test-panel::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.test-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6); /* Darker overlay */
    z-index: 999;
    display: none; /* Controlled by JS */
}


.test-panel h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.test-group {
    margin-bottom: 15px;
}

.test-group label { /* Labels within the test panel */
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Inputs within test panel already styled by global input styles */

.test-options {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* More spacing */
    margin-bottom: 20px;
}

.test-checkbox {
    display: flex;
    align-items: center;
    gap: 8px; /* More space between checkbox and label */
}
.test-checkbox label { /* Label next to checkbox */
    font-weight: normal;
    color: var(--text-primary);
    margin-bottom: 0; /* Reset margin for inline label */
}

.test-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.test-results {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--background-base);
    border-radius: var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-interactive);
}
.test-results h4 {
    font-size: 0.9rem;
    color: var(--primary-light);
    margin-bottom: 8px;
}
.test-results p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
.test-results pre {
    font-family: var(--font-monospace);
    font-size: 0.8rem;
    background-color: var(--background-surface);
    padding: 10px;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid var(--border-color);
    max-height: 200px; /* Scroll within pre if needed */
    overflow: auto;
}

/* In your styles.css or within <style> tags in index.html */
.flow-item {
    display: flex;
    align-items: center;
    padding: 8px 10px; /* Adjusted padding */
    border-bottom: 1px solid #eee;
    cursor: default; /* Default cursor, drag handle will have 'grab' */
    user-select: none; /* Prevent text selection during drag */
}

.flow-item .drag-handle {
    font-family: 'Arial', sans-serif; /* For a clearer drag icon */
    font-size: 1.2em; /* Make handle more prominent */
    margin-right: 10px; /* More space */
    padding: 2px 6px; /* Slightly more padding around handle */
    cursor: grab;
    color: #999; /* Softer color for handle */
    border-radius: 3px; /* Slight rounding */
    /* background-color: #f0f0f0; /* Optional: subtle background for handle */
}
.flow-item .drag-handle:hover {
    color: #333;
    /* background-color: #e0e0e0; */
}


.flow-item-name {
    flex-grow: 1;
    pointer-events: none; /* So drag events don't get confused if dragging over name */
}
.flow-item-controls {
    pointer-events: auto; /* Ensure controls are clickable */
}
.flow-item-controls .flow-item-delete,
.flow-item-controls .flow-item-status {
    cursor: pointer; /* Make controls clearly clickable */
}


.flow-item.dragging {
    opacity: 0.6;
    background: #e7f3ff; /* Light blue background when dragging */
    border: 1px dashed #90caf9; /* Dashed border for dragging item */
}

.flow-item.drag-over-top {
    border-top: 2px solid #2196F3; /* Blue indicator line */
    box-shadow: 0 -2px 5px -2px #2196F3 inset; /* Inner shadow for effect */
}

.flow-item.drag-over-bottom {
    border-bottom: 2px solid #2196F3; /* Blue indicator line */
    box-shadow: 0 2px 5px -2px #2196F3 inset; /* Inner shadow for effect */
}

/* --- Scrollbar Styling (Optional, but nice for dark themes) --- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--background-base);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb {
    background: var(--border-interactive);
    border-radius: var(--radius-sm);
    border: 2px solid var(--background-base); /* Creates a padding effect */
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
::-webkit-scrollbar-corner {
    background: var(--background-base);
}

/* --- General utility classes --- */
.hidden {
    display: none !important;
}

/* --- Notification Animations --- */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

