:root {
    --dx-black: #121212;
    --dx-pink: #FF2B71;
    --dx-beige: #ECEBE8;
    --dx-white: #FFFFFF;
    --dx-gray: #2a2a2a;
    --dx-blue: #4A90E2;
    --dx-purple: #9B59B6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--dx-beige);
    overflow: hidden;
}

.builder-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.builder-header {
    background: var(--dx-black);
    color: var(--dx-white);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.builder-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: var(--dx-pink);
    clip-path: polygon(100% 0, 100% 100%, 0 0);
    opacity: 0.9;
}

.builder-header h1 {
    font-size: 2em;
    font-weight: 300;
    letter-spacing: -1px;
    position: relative;
    z-index: 1;
}

.builder-header h1 span {
    color: var(--dx-pink);
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.btn-primary, .btn-secondary {
    padding: 10px 25px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85em;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--dx-pink);
    color: var(--dx-white);
}

.btn-primary:hover {
    background: #e02563;
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--dx-white);
    border: 2px solid var(--dx-white);
}

.btn-secondary:hover {
    background: var(--dx-white);
    color: var(--dx-black);
}

.builder-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.component-palette {
    width: 280px;
    background: var(--dx-white);
    border-right: 2px solid var(--dx-beige);
    overflow-y: auto;
    padding: 20px;
}

.component-palette h3 {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: var(--dx-black);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.palette-section {
    margin-bottom: 25px;
}

.palette-section h4 {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.palette-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.palette-component {
    background: var(--dx-beige);
    padding: 12px 15px;
    cursor: grab;
    border-left: 3px solid var(--dx-pink);
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.palette-component:hover {
    background: var(--dx-black);
    color: var(--dx-white);
    transform: translateX(5px);
}

.palette-component:active {
    cursor: grabbing;
}

.component-icon {
    font-size: 1.3em;
}

.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--dx-white);
    position: relative;
}

.canvas-toolbar {
    background: var(--dx-beige);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #ddd;
}

.canvas-title {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9em;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.zoom-controls button {
    width: 30px;
    height: 30px;
    border: 2px solid var(--dx-black);
    background: var(--dx-white);
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.zoom-controls button:hover {
    background: var(--dx-black);
    color: var(--dx-white);
}

.workflow-canvas {
    flex: 1;
    position: relative;
    overflow: auto;
    background: 
        linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px),
        linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}

#connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 1;
}

.workflow-component {
    position: absolute;
    background: var(--dx-white);
    border: 2px solid var(--dx-black);
    padding: 20px;
    min-width: 180px;
    cursor: move;
    z-index: 10;
    transition: box-shadow 0.2s;
}

.workflow-component:hover {
    box-shadow: 0 5px 20px rgba(255, 43, 113, 0.3);
}

.workflow-component.selected {
    border-color: var(--dx-pink);
    box-shadow: 0 0 0 3px rgba(255, 43, 113, 0.2);
}

.workflow-component::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: var(--dx-pink);
    clip-path: polygon(100% 0, 100% 100%, 0 0);
    opacity: 0.3;
}

.component-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.component-title {
    font-weight: 600;
    font-size: 0.95em;
}

.component-stage {
    font-size: 0.75em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.connection-point {
    width: 12px;
    height: 12px;
    background: var(--dx-pink);
    border: 2px solid var(--dx-white);
    border-radius: 50%;
    position: absolute;
    cursor: crosshair;
    z-index: 20;
    transition: all 0.2s;
}

.connection-point:hover {
    transform: scale(1.5);
    background: var(--dx-black);
}

.connection-point.output {
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-point.input {
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.properties-panel {
    width: 320px;
    background: var(--dx-white);
    border-left: 2px solid var(--dx-beige);
    overflow-y: auto;
    padding: 20px;
}

.properties-panel h3 {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: var(--dx-black);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.empty-state {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.property-group {
    margin-bottom: 20px;
}

.property-label {
    font-size: 0.85em;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.property-input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--dx-beige);
    background: var(--dx-white);
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
}

.property-input:focus {
    outline: none;
    border-color: var(--dx-pink);
}

.vendor-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-top: 12px;
    border-radius: 4px;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
}

.vendor-logo {
    font-size: 1.3em;
}

.vendor-name {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vendor-select {
    font-family: 'Inter', sans-serif;
}

.vendor-info {
    background: var(--dx-beige);
    padding: 15px;
    border-radius: 4px;
}

.vendor-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vendor-info a {
    text-decoration: none;
    font-weight: 500;
}

.vendor-info a:hover {
    text-decoration: underline;
}

.property-input option {
    padding: 8px;
}

/* Enhanced component styling with vendor */
.workflow-component.has-vendor {
    border-width: 3px;
}

.workflow-component.has-vendor::before {
    opacity: 0.5;
}

.connection-group {
    transition: all 0.2s;
}

.connection-group:hover {
    filter: drop-shadow(0 0 5px rgba(255, 43, 113, 0.5));
}

#connections-layer {
    pointer-events: none;
}

#connections-layer .connection-group {
    pointer-events: auto;
}

#connections-layer path {
    pointer-events: stroke;
    stroke-linecap: round;
}

#connections-layer rect,
#connections-layer text {
    pointer-events: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--dx-white);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: var(--dx-black);
    color: var(--dx-white);
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: var(--dx-pink);
    clip-path: polygon(100% 0, 100% 100%, 0 0);
    opacity: 0.9;
}

.modal-header h2 {
    font-size: 1.5em;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.modal-close {
    background: none;
    border: none;
    color: var(--dx-white);
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
    position: relative;
    z-index: 1;
    transition: transform 0.2s;
}

.modal-close:hover {
    transform: scale(1.2);
    color: var(--dx-pink);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    background: var(--dx-beige);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* Vendor Logo Image */
.vendor-logo-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.vendor-badge .vendor-logo-img {
    width: 20px;
    height: 20px;
}

/* Custom blocks section */
.palette-section.custom-blocks {
    border-top: 3px solid var(--dx-pink);
    padding-top: 15px;
    margin-top: 20px;
}

.palette-section.custom-blocks h4 {
    color: var(--dx-pink);
}

/* Selected connection styling */
.connection-group.selected path {
    stroke: #e02563 !important;
    stroke-width: 5 !important;
    filter: drop-shadow(0 0 8px rgba(255, 43, 113, 0.6));
}

.connection-group.selected rect {
    filter: drop-shadow(0 0 5px rgba(255, 43, 113, 0.5));
}

/* Connection drawing cursor */
body.drawing-connection {
    cursor: crosshair !important;
}

body.drawing-connection * {
    cursor: crosshair !important;
}

/* Connection point enhanced states */
.connection-point.active {
    transform: scale(2) !important;
    background: #00FF00 !important;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.connection-point:hover {
    transform: scale(1.3);
    box-shadow: 0 0 5px rgba(255, 43, 113, 0.5);
}

/* Temporary connection line animation */
@keyframes dash {
    to {
        stroke-dashoffset: -10;
    }
}

path[stroke-dasharray] {
    animation: dash 0.5s linear infinite;
}

/* Workflow Items Section */
.palette-section.workflow-items {
    border-top: 3px solid #FF9800;
    padding-top: 15px;
    margin-top: 20px;
}

.palette-section.workflow-items h4 {
    color: #FF9800;
}

.palette-component.workflow-item {
    border-left-width: 4px;
}

.workflow-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workflow-item-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 5px;
    color: white;
    font-weight: 600;
    font-size: 0.9em;
    position: relative;
}

.workflow-item-badge .remove-item-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.workflow-item-badge .remove-item-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* SVG workflow items on connections */
.connection-group circle[fill] {
    transition: all 0.2s;
}

.connection-group:hover circle[fill] {
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.3));
}

/* Drag over connection highlight */
.connection-group.drag-over path {
    stroke: #00FF00 !important;
    stroke-width: 6 !important;
    filter: drop-shadow(0 0 10px rgba(0, 255, 0, 0.5));
}

/* Drag and drop visual feedback */
.workflow-canvas.drag-over {
    background-color: rgba(255, 43, 113, 0.05);
    border: 2px dashed var(--dx-pink);
}

.palette-component {
    user-select: none;
    -webkit-user-select: none;
}

.palette-component:active {
    opacity: 0.7;
}

/* Dragging cursor */
.palette-component.dragging {
    opacity: 0.5;
}

/* Drop zone indicator */
.workflow-canvas::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.workflow-canvas.drag-over::after {
    opacity: 1;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 43, 113, 0.05) 10px,
        rgba(255, 43, 113, 0.05) 20px
    );
}

/* Canvas hint for empty state */
.canvas-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s;
}

.canvas-hint.hidden {
    opacity: 0;
}

.hint-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.hint-text {
    font-size: 1.2em;
    font-weight: 500;
    max-width: 400px;
}

/* Hide hint when dragging */
.workflow-canvas.drag-over .canvas-hint {
    opacity: 0.3;
}

/* Smooth component appearance */
.workflow-component {
    animation: componentAppear 0.3s ease-out;
}

@keyframes componentAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
