/* ============================================
   SENSEI BPM - PROCESS EDITOR STYLES
   Dark theme inspired by modern IDE aesthetics
   ============================================ */

:root {
  /* Dark theme palette */
  --bg-primary: #0d0d12;
  --bg-secondary: #13131a;
  --bg-tertiary: #1a1a24;
  --bg-elevated: #22222e;
  --bg-hover: #2a2a38;
  
  /* Text colors */
  --text-primary: #e8e8ed;
  --text-secondary: #9898a8;
  --text-muted: #5a5a6e;
  
  /* Accent colors */
  --accent-purple: #a855f7;
  --accent-blue: #3b82f6;
  --accent-cyan: #22d3ee;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-orange: #f97316;
  --accent-pink: #ec4899;
  --accent-red: #ef4444;
  
  /* Borders and shadows */
  --border-color: #2a2a38;
  --border-subtle: #1f1f2a;
  --shadow-glow: 0 0 20px rgba(168, 85, 247, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  
  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  /* Typography */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================
   RESET & BASE
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* ============================================
   LAYOUT
   ============================================ */

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  width: 280px;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.35);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Block Categories */
.block-category {
  margin-bottom: 24px;
}

.category-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 8px;
  margin-bottom: 10px;
}

/* Block Items (Draggable) */
.block-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
}

.block-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border-color);
  transform: translateX(4px);
}

.block-item:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.block-item.dragging {
  opacity: 0.5;
}

.block-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.block-info {
  flex: 1;
  min-width: 0;
}

.block-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-desc {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.header {
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.process-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.process-name-input {
  background: transparent;
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 6px 0;
  min-width: 200px;
  outline: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}

.process-name-input:focus {
  border-bottom-color: var(--accent-purple);
}

.process-status {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.process-status.saved {
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.process-status.saving {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Buttons */
.btn {
  height: 36px;
  padding: 0 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-icon {
  width: 36px;
  padding: 0;
  justify-content: center;
  font-size: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  border: none;
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.35);
}

.btn-danger-text {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
}

.btn-danger-text:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
}

.btn-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ============================================
   CANVAS
   ============================================ */

.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Grid background */
.canvas-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(42, 42, 56, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 42, 56, 0.4) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 0;
}

#drawflow {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* Empty state */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.3s;
}

.empty-state.hidden {
  opacity: 0;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-text {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 280px;
}

/* Zoom controls */
.zoom-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  z-index: 10;
}

.zoom-level {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  min-width: 45px;
  text-align: center;
}

/* ============================================
   PROPERTIES PANEL
   ============================================ */

.properties-panel {
  width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-right 0.3s;
}

.properties-panel.hidden {
  margin-right: -320px;
}

.panel-header {
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.panel-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 20px;
  font-size: 13px;
}

/* Property Groups */
.property-group {
  margin-bottom: 20px;
}

.property-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.property-input,
.property-select,
.property-textarea {
  width: 100%;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.property-input:focus,
.property-select:focus,
.property-textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.property-textarea {
  height: 100px;
  padding: 10px 12px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
}

.property-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239898a8' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Status option colors in dropdowns */
.property-select option {
  padding: 8px 12px;
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.property-select option[data-color] {
  /* Color will be set inline via style attribute from JavaScript */
  padding-left: 32px;
  position: relative;
}

.property-select option[data-color]::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background-color: attr(data-color);
}

/* Property Panel Layout */
.property-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.property-block-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.property-block-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.property-fields {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
}

.property-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.btn-save {
  width: 100%;
  height: 42px;
  background: var(--accent-purple);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save:hover {
  background: var(--accent-purple-hover);
  transform: translateY(-1px);
}

.btn-delete {
  width: 100%;
  height: 38px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

/* Compact button row for elements */
.property-actions-row {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.btn-save-sm {
  flex: 1;
  height: 36px;
  background: var(--accent-purple);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-sm:hover {
  background: var(--accent-purple-hover);
}

.btn-delete-sm {
  height: 36px;
  padding: 0 16px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete-sm:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* ============================================
   START ELEMENT PANEL
   ============================================ */

.start-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.start-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  padding: 0 4px;
}

.start-tab {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.start-tab:hover {
  color: var(--text-primary);
}

.start-tab.active {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red);
}

.start-tab-content {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
}

.start-tab-content.hidden {
  display: none;
}

.condition-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.add-condition-wrapper .property-select {
  background-color: var(--bg-tertiary);
}

.conditions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.condition-item {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.condition-item .property-select,
.condition-item .property-input {
  height: 36px;
  font-size: 12px;
}

.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

.btn-add-or {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 0;
  transition: all 0.2s;
}

.btn-add-or:hover {
  color: var(--text-primary);
}

.plus-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
}

.start-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.btn-save-start {
  padding: 8px 24px;
  background: transparent;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-start:hover {
  background: var(--accent-red);
  color: white;
}

.process-id {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.tab-placeholder {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 0;
}

/* ============================================
   CONDITION ELEMENT PANEL
   ============================================ */

.condition-panel,
.start-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.panel-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  padding: 0 4px;
}

.panel-tab {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.panel-tab:hover {
  color: var(--text-primary);
}

.panel-tab.active {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red);
}

.panel-tab-content {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
}

.panel-tab-content.hidden {
  display: none;
}

.add-condition-select {
  width: 100%;
  background-color: var(--bg-tertiary);
  margin-bottom: 12px;
}

.condition-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}

.condition-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.condition-field-name {
  color: var(--accent-pink);
  font-size: 13px;
  font-weight: 500;
}

.condition-operator {
  color: var(--text-primary);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.condition-operator:hover {
  color: var(--accent-cyan);
}

.condition-value-row {
  display: flex;
  gap: 8px;
}

.condition-value-input {
  flex: 1;
}

.btn-variable {
  width: 50px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-variable:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

.btn-remove-condition {
  margin-left: auto;
  opacity: 0.5;
}

.btn-remove-condition:hover {
  opacity: 1;
}

.panel-actions-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.btn-save-outline {
  padding: 8px 24px;
  background: transparent;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-outline:hover {
  background: var(--accent-red);
  color: white;
}

.element-id {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.btn-delete-text {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete-text:hover {
  color: var(--accent-red);
}

.delete-icon {
  font-size: 14px;
}

/* ============================================
   ELEMENT PANEL (Generic)
   ============================================ */

.element-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.panel-header {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Field Select Dropdown */
.field-select {
  width: 100%;
  height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-purple);
  border-radius: var(--radius-md);
  padding: 0 16px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 16px;
}

.field-select:focus {
  outline: none;
  border-color: var(--accent-pink);
}

/* Condition Card */
.condition-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.condition-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.condition-field-label {
  color: var(--accent-pink);
  font-size: 13px;
  font-weight: 500;
}

.condition-operator-dropdown {
  position: relative;
}

.condition-operator-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 8px;
}

.condition-operator-btn:hover {
  color: var(--accent-cyan);
}

.operator-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}

.operator-dropdown-menu.show {
  display: block;
}

.operator-option {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.operator-option:hover {
  background: var(--bg-tertiary);
}

.btn-icon-sm {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  margin-left: auto;
  opacity: 0.6;
  transition: all 0.2s;
}

.btn-icon-sm:hover {
  opacity: 1;
  color: var(--accent-red);
}

.condition-value-wrapper {
  display: flex;
  gap: 8px;
}

.condition-value-field {
  flex: 1;
  height: 40px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 13px;
}

.condition-value-field:focus {
  outline: none;
  border-color: var(--accent-purple);
}

.btn-vars {
  width: 48px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-vars:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

/* Add Condition OR Button */
.btn-add-condition-or {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 10px 0;
  transition: color 0.2s;
}

.btn-add-condition-or:hover {
  color: var(--text-primary);
}

.plus-box {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
}

/* Panel Footer */
.panel-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.btn-save-panel {
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-panel:hover {
  background: var(--accent-red);
  color: white;
}

.panel-id {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.btn-delete-panel {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.btn-delete-panel:hover {
  color: var(--accent-red);
}

.tab-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 0;
}

.condition-builder {
  padding-top: 8px;
}

.conditions-container {
  margin-bottom: 8px;
}

/* Condition Groups & Separators */
.condition-group {
  margin-bottom: 12px;
}

.condition-separator {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 16px 0;
  position: relative;
}

.condition-separator::before,
.condition-separator::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border-color);
}

.condition-separator::before {
  left: 0;
}

.condition-separator::after {
  right: 0;
}

.condition-separator-and {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  padding: 8px 0;
}

.field-select-inline {
  margin-top: 8px;
  background: transparent;
  border-color: var(--border-color);
}

.condition-operator-link {
  color: var(--text-primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  position: relative;
}

.condition-operator-link:hover {
  color: var(--accent-cyan);
}

/* Status Display for Change Status element */
.status-display {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.property-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.property-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* ============================================
   DRAWFLOW CUSTOMIZATION
   ============================================ */

.drawflow .drawflow-node {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  min-width: 180px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.drawflow .drawflow-node:hover {
  box-shadow: var(--shadow-glow), var(--shadow-card);
  transform: translateY(-2px);
}

.drawflow .drawflow-node.selected {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25), var(--shadow-card);
}

.drawflow .drawflow-node .inputs,
.drawflow .drawflow-node .outputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
  width: 14px;
  height: 14px;
  background: var(--bg-elevated);
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
}

.drawflow .drawflow-node .input:hover,
.drawflow .drawflow-node .output:hover {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  transform: scale(1.3);
}

.drawflow .connection .main-path {
  stroke: var(--text-muted);
  stroke-width: 2px;
}

.drawflow .connection .main-path:hover {
  stroke: var(--accent-cyan);
  stroke-width: 3px;
}

.drawflow .drawflow-delete {
  display: none;
}

/* Custom Node Content */
.node-content {
  padding: 0;
}

.node-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.node-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.node-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.node-body {
  padding: 12px 14px;
}

.node-description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.node-config {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}

.node-config-item {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-footer {
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  justify-content: space-around;
}

.node-output-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

/* ============================================
   MODALS
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
}

.modal[style*="display: flex"] {
  display: flex !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.import-textarea {
  width: 100%;
  height: 200px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

.import-textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
}

/* Process List */
.process-list-item {
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.process-list-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border-color);
}

.process-list-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.process-list-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   TOASTS
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
  min-width: 250px;
}

.toast-success {
  border-left: 3px solid var(--accent-green);
}

.toast-error {
  border-left: 3px solid var(--accent-red);
}

.toast-info {
  border-left: 3px solid var(--accent-blue);
}

.toast-message {
  font-size: 13px;
  color: var(--text-primary);
}

@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;
  }
}

.toast.hiding {
  animation: slideOut 0.3s ease forwards;
}

/* ============================================
   ENHANCED PROPERTIES PANEL
   ============================================ */

.property-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.property-block-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.property-block-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.element-id-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.property-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

.property-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.property-section:last-of-type {
  border-bottom: none;
}

.property-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-purple);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.property-row {
  display: flex;
  gap: 10px;
}

.property-group-small {
  flex: 1;
}

.property-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

.property-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.property-checkbox span {
  user-select: none;
}

.property-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

.property-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

/* Result Options List */
.result-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.result-option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.result-option-item:hover {
  border-color: var(--border-color);
}

.result-option-drag {
  color: var(--text-muted);
  cursor: grab;
  font-size: 12px;
  padding: 0 4px;
}

.result-option-drag:active {
  cursor: grabbing;
}

.result-option-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 13px;
}

.result-option-input:focus {
  outline: none;
  border-color: var(--accent-purple);
}

.result-option-success {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

.result-option-success input:checked + span,
.result-option-success:has(input:checked) {
  color: var(--accent-green);
}

.result-option-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  opacity: 0.6;
  transition: all 0.2s;
}

.result-option-delete:hover {
  color: var(--accent-red);
  opacity: 1;
}

/* Button Variants */
.btn-small {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Scrollable Properties Panel */
.panel-content {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}

/* Dark inputs for properties */
.property-input[type="number"] {
  text-align: center;
}

.property-textarea {
  min-height: 80px;
  font-family: var(--font-sans);
  line-height: 1.5;
}

/* Info Box */
.property-info-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-purple);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.property-info-box strong {
  color: var(--text-primary);
}

/* Start Element Special Styling */
.node-start .node-header-start {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
  border-bottom-color: rgba(16, 185, 129, 0.3);
}

.node-end .node-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Many-to-one indicator */
.node-input-indicator {
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--bg-elevated);
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
}

.node-input-indicator.has-connections {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: white;
}

/* Connection count badge */
.connection-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent-purple);
  color: white;
  font-size: 10px;
  font-weight: 600;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   ALIGNMENT GUIDES
   ============================================ */

.alignment-guide {
  position: absolute;
  background: var(--accent-cyan);
  opacity: 0.6;
  pointer-events: none;
  z-index: 5;
}

.alignment-guide.horizontal {
  left: 0;
  right: 0;
  height: 1px;
  box-shadow: 0 0 4px var(--accent-cyan);
}

.alignment-guide.vertical {
  top: 0;
  bottom: 0;
  width: 1px;
  box-shadow: 0 0 4px var(--accent-cyan);
}

/* ============================================
   ENHANCED NODE DRAGGING
   ============================================ */

.drawflow .drawflow-node {
  cursor: move;
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.drawflow .drawflow-node:active {
  cursor: grabbing;
  z-index: 100 !important;
}

.drawflow .drawflow-node.selected {
  z-index: 50;
}

.drawflow .drawflow-node.highlighted {
  box-shadow: 0 0 0 3px var(--accent-purple), var(--shadow-glow), var(--shadow-card);
}

/* Node being dragged */
.drawflow .drawflow-node:active::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px dashed var(--accent-purple);
  border-radius: calc(var(--radius-lg) + 4px);
  pointer-events: none;
  opacity: 0.5;
}

/* Smooth connections */
.drawflow .connection {
  transition: stroke 0.2s ease;
}

.drawflow .connection .main-path {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Input/Output ports better visibility */
.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
  width: 14px;
  height: 14px;
  background: var(--bg-tertiary);
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  cursor: crosshair;
  transition: all 0.15s ease;
  z-index: 10;
}

.drawflow .drawflow-node .input:hover,
.drawflow .drawflow-node .output:hover {
  transform: scale(1.4);
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  box-shadow: 0 0 8px var(--accent-purple);
}

/* Connected port indicator */
.drawflow .drawflow-node .input.connected,
.drawflow .drawflow-node .output.connected {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

/* Port labels */
.drawflow .drawflow-node .outputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
}

.drawflow .drawflow-node .inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: absolute;
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
}

/* Start node - no input port and fixed position */
.drawflow .drawflow-node.start .inputs {
  display: none;
}

.drawflow .drawflow-node.start {
  cursor: default !important;
  pointer-events: auto;
}

.drawflow .drawflow-node.start:active {
  cursor: default !important;
  transform: none !important;
}

.drawflow .drawflow-node.start:active::after {
  display: none !important;
}

.drawflow .drawflow-node.start .node-content {
  cursor: pointer;
}

/* Prevent dragging indicator on start */
.drawflow .drawflow-node.start:hover {
  cursor: default;
}

/* Fixed indicator badge */
.drawflow .drawflow-node.start::before {
  content: '📌';
  position: absolute;
  top: -8px;
  left: -8px;
  font-size: 14px;
  z-index: 10;
}

/* Locked node style */
.drawflow .drawflow-node.locked {
  cursor: default !important;
}

.drawflow .drawflow-node.locked:active {
  cursor: default !important;
  transform: none !important;
}

.drawflow .drawflow-node.locked:active::after {
  display: none !important;
}

/* Start element special border */
.drawflow .drawflow-node.start {
  border: 2px solid var(--accent-green);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

/* End node - no output port */
.drawflow .drawflow-node.end .outputs {
  display: none;
}

/* Grid dots pattern for canvas */
#drawflow {
  background-image: 
    radial-gradient(circle, var(--border-color) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Snap indicator when dragging */
.snap-indicator {
  position: fixed;
  padding: 4px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-purple);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  pointer-events: none;
  z-index: 1000;
}

