.canvas-editor-container {
    width: 100%;
    height: calc(100vh - 80px); /* Adjust to full viewport height minus header */
    background: #1a1a1a;
    border: none; /* Remove border */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Editor Header */
.editor-header {
    background: #2a2a2a;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #444;
    position: sticky;
    top: 0;
    z-index: 100;
}

.editor-header .workflow-name-input {
    background: transparent;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    min-width: 300px;
    transition: all 0.2s ease;
}

.editor-header .workflow-name-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.editor-header .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 4px;
}

.canvas-workspace {
    flex: 1;
    background: #1E1E1E; /* Darker background */
    overflow: auto;
    position: relative;
    scroll-behavior: auto;
}

.canvas-workspace::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.canvas-workspace::-webkit-scrollbar-track {
    background: #2a2a2a;
}

.canvas-workspace::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 5px;
}

.events-canvas {
    width: 4000px; /* Increased width */
    height: 4000px; /* Increased height */
    position: absolute; /* Changed from relative */
    top: 0;
    left: 0;
    transform-origin: center center;
    overflow: visible; /* Changed from auto */
    padding: 20px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px; /* Grid size */
    cursor: grab;
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
}

.events-canvas * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.events-canvas.dragging {
    cursor: grabbing !important;
}

.event-item {
    position: absolute;
    width: 130px;
    min-height: 130px;
    padding: 10px;
    margin-bottom: 6px;
    background: linear-gradient(145deg, #2d2d2d, #252525);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: move;
    user-select: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2), 
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    transition: box-shadow 0.3s ease;
    z-index: 10;
    pointer-events: auto;
    transform: translate3d(0,0,0); /* Add this to fix positioning */
    will-change: transform; /* Add this for better performance */
    color: #fff;
}

.event-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3),
                inset 0 1px 1px rgba(255, 255, 255, 0.15);
    border-color: rgba(13, 110, 253, 0.3);
}

.event-item.dragging {
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1000;
    opacity: 0.9;
}

.event-item.connecting {
    border: 2px solid #007bff;
    box-shadow: 0 0 0 4px rgba(0,123,255,0.2);
}

.event-item.available-target {
    border: 2px dashed #28a745;
    cursor: pointer;
    animation: pulse 1.5s infinite;
}

.event-item.available-target:hover {
    background: #f8f9fa;
    border-color: #218838;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40,167,69,0.4); }
    70% { box-shadow: 0 0 0 6px rgba(40,167,69,0); }
    100% { box-shadow: 0 0 0 0 rgba(40,167,69,0); }
}

.event-header {
    font-weight: bold;
    margin-bottom: 8px;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    padding-right: 30px;
    padding-top: 8px;
    padding-right: 10px;
    text-align: center;
    padding: 8px 5px;
}

.event-header span {
    display: block;
    padding-right: 5px;
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    padding-top: 5px;
}

.event-header span i {
    display: block;
    font-size: 2.2rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #0d6efd, #0099ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
    text-align: center;
}

.event-content {
    font-size: 0.65rem;
    color: #aaa;
    padding-right: 5px;
    max-height: 28px;
    overflow: hidden;
    text-align: center;
    line-height: 1.4;
    padding: 0 5px;
    opacity: 0.8;
}

.add-event-btn {
    padding: 8px 16px;
    font-weight: 500;
}

.add-event-btn:active {
    transform: translateY(1px);
}

.delete-event {
    width: 24px;
    height: 24px;
    padding: 0 !important;
    line-height: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    background-color: #dc354600 !important;
    border-color: #bd213100 !important;
}

.delete-event:hover {
    background-color: #bd2130;
    transform: scale(1.05);
}

/* Remove edit button styles as they're no longer needed */
/* .edit-event { ... } */
/* .edit-event:hover { ... } */

.connection-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6; /* Ensure connections appear under nodes */
    overflow: visible;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.connections {
    stroke-linecap: round;
    pointer-events: none;
}

.connection-path {
    fill: none;
    stroke: #007bff;
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    opacity: 0.8;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.connection-path:hover {
    stroke-width: 4px;
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0,123,255,0.3));
}

.delete-event, .edit-event {
    position: static;
    min-width: 16px !important; /* Reduced from 20px */
    height: 16px !important; /* Reduced from 20px */
    padding: 1px !important; /* Reduced from 2px */
    font-size: 10px !important; /* Reduced from 12px */
}

.event-controls {
    position: absolute;
    right: 0px;
    top: 5px;
    display: flex;
    gap: 3px;
    z-index: 20;
    pointer-events: all;
}

/* Remove any conflicting styles */

/* Remove the placeholder styles as they're no longer needed */
/* .add-event-placeholder { ... } */
/* .add-event-placeholder:hover { ... } */

.add-next-event {
    position: absolute;
    right: -11px;
    top: 50%;
    color: #fff !important;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    font-size: 10px;
    border-radius: 50%;
    padding: 1px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd, #0099ff);
    border: 2px solid rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    pointer-events: auto;
    z-index: 30;
    pointer-events: all !important;
    cursor: pointer !important;
}

.add-next-event:hover {
    transform: translateY(-50%) scale(1.15);
    background: linear-gradient(135deg, #0099ff, #0d6efd);
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.initial-add-event {
    position: absolute;  /* Changed from fixed */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #007bff;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 100;
    cursor: pointer;
    color: #fff;  /* Added to ensure button text is visible */
}

.initial-add-event:hover {
    background: #0056b3;
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.initial-add-event i {
    font-size: 20px;
}

.event-type-slider {
    position: fixed;
    right: -300px; /* Changed from left: -300px */
    top: 0;
    width: 300px;
    height: 100%;
    background: #2a2a2a;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1); /* Changed shadow direction */
    z-index: 1000;
    transition: right 0.3s ease; /* Changed from left to right */
    padding: 20px;
    overflow-y: auto;
    color: #fff;
    border-left: 1px solid #444; /* Changed from border-right */
}

.event-type-slider.active {
    right: 0; /* Changed from left: 0 */
}

.event-category {
    margin-bottom: 20px;
}

.event-category-title {
    font-weight: bold;
    color: #fff;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #0d6efd;
    font-size: 1.1rem;
    padding: 10px 0;
}

.event-type-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-type-item {
    padding: 12px 15px;
    background: #363636;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.event-type-item:hover {
    background: #404040;
    border-color: #0d6efd;
    transform: translateX(-5px); /* Changed from translateX(5px) to move hover animation in opposite direction */
}

.event-type-item i {
    width: 20px;
    text-align: center;
    color: #0d6efd;
}

.canvas-editor-container .slider-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.slider-overlay.active {
    display: block;
}

.slider-title {
    color: #fff;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #444;
}

.event-type-info {
    flex: 1;
}

.event-type-name {
    font-weight: bold;
    margin-bottom: 4px;
}

.event-type-description {
    font-size: 0.85em;
    color: #aaa;
    line-height: 1.4;
}

.action-item {
    background: linear-gradient(145deg, #1e3c72, #1a3365);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3),
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.action-item:hover {
    border-color: rgba(0, 123, 255, 0.4);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4),
                inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.action-item .event-header span i {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Configuration Popup Styles */
.config-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.config-popup.active {
    display: flex;
}

.config-popup-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.config-popup-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-popup-body {
    padding: 1rem;
}

.config-popup-footer {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.close-popup {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.event-item.configured::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 16px; /* Reduced from 20px */
    height: 16px; /* Reduced from 20px */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px; /* Reduced from 12px */
}

.config-form {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.config-preview {
    font-size: 0.85em;
    color: #ccc;
    margin: 0;
    line-height: 1.4;
}

.config-popup-body {
    background: #2a2a2a;
    color: #fff;
}

.config-popup-content {
    background: #2a2a2a;
    border: 1px solid #444;
}

.config-popup-header {
    border-bottom: 1px solid #444;
    color: #fff;
}

.config-popup-footer {
    border-top: 1px solid #444;
}

.form-control {
    background: #363636;
    border: 1px solid #444;
    color: #fff;
}

.form-control:focus {
    background: #404040;
    color: #fff;
    border-color: #0d6efd;
}
