:root {
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-canvas: #f8fafc;
    --bg-white: #ffffff;
    --primary-color: #4f46e5;
    --primary-light: #eef2ff;
    --border-color: #e5e7eb;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --font-family: 'Inter', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-dark);
    overflow: hidden;
    height: 100vh;
    font-size: 14px;
}

i { 
    margin: 0; 
}

.builder-container { 
    display: flex; 
    height: 100vh; 
}

.content-wrapper { 
    display: flex; 
    flex-grow: 1; 
}

/* Sidebar & Sub-sidebar */
.sidebar, .sub-sidebar { 
    background-color: var(--bg-sidebar); 
    border-right: 1px solid var(--border-color); 
    flex-shrink: 0; 
}

.sidebar { 
    width: 68px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 20px 0; 
}

.logo { 
    font-size: 24px; 
    color: var(--primary-color); 
    margin-bottom: 30px; 
}

.sidebar-nav { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}

.nav-item { 
    color: var(--text-muted); 
    padding: 12px; 
    border-radius: 8px; 
    font-size: 20px; 
    transition: all 0.2s ease; 
    display: inline-flex; 
    text-decoration: none; 
}

.nav-item.active, .nav-item:hover { 
    background-color: var(--primary-color); 
    color: white; 
}

.sidebar-footer { 
    margin-top: auto; 
}

.sub-sidebar { 
    width: 240px; 
}

.sub-sidebar-header { 
    padding: 20px; 
}

.sub-sidebar-nav { 
    padding: 0 10px; 
}

.sub-nav-item { 
    display: block; 
    padding: 12px 10px; 
    border-radius: 6px; 
    text-decoration: none; 
    color: var(--text-dark); 
    font-weight: 500; 
}

.sub-nav-item.active, .sub-nav-item:hover { 
    background-color: var(--primary-light); 
    color: var(--primary-color); 
}

/* Main Workspace */
.main-content { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    position: relative; /* PENTING: Untuk menjadi rujukan posisi bagi elemen .connector-svg */
}

.main-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 16px 24px; 
    background-color: var(--bg-white); 
    border-bottom: 1px solid var(--border-color); 
}

.header-title { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
    font-size: 18px; 
    font-weight: 600; 
}

.header-title a { 
    color: var(--text-dark); 
    text-decoration: none; 
}

.header-actions { 
    display: flex; 
    gap: 10px; 
}

.canvas-toolbar { 
    padding: 12px 24px; 
    background-color: var(--bg-main); 
    border-bottom: 1px solid var(--border-color); 
}

.canvas {
    /* flex-grow dipindahkan ke wrapper */
    width: 100%;
    height: 100%;
    background-color: #fcfcfc;
    position: relative;
    overflow: auto;
    background-image: radial-gradient(circle at 1px 1px, #d1d5db 1px, transparent 0);
    background-size: 24px 24px;
}

.canvas-wrapper {
    flex-grow: 1; /* Ambil baki ruang yang ada */
    position: relative; /* Menjadi anchor untuk SVG */
    display: flex;
}

.connector-svg { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 2000px; 
    height: 2000px; 
    pointer-events: none; 
}

.connector-svg path { 
    stroke: #c7d2fe; 
    stroke-width: 2.5px; 
    fill: none; 
}

/* Flow Blocks */
.flow-block {
    position: absolute;
    width: 240px;
    background-color: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.flow-block:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -4px rgba(0,0,0,0.07);
}

.flow-block.selected { 
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px #4f46e5;
}

.block-icon { 
    font-size: 16px; 
    width: 36px; 
    height: 36px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    border-radius: 6px; 
    color: white; 
    flex-shrink: 0; 
}

.flow-block.start .block-icon { background-color: #ef4444; }
.flow-block.message .block-icon { background-color: #22c55e; }
.flow-block.input .block-icon { background-color: #f59e0b; }
.flow-block.end .block-icon { background-color: #3b82f6; }

.block-title { 
    font-size: 15px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    font-weight: 500; 
    color: #1f2937;
}

/* Titik penyambung pada blok */
.connection-point {
    width: 12px;
    height: 12px;
    background-color: #fff;
    border: 2px solid #c7d2fe;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.2s ease;
    cursor: crosshair;
}

.flow-block:hover .connection-point, .connection-point:hover {
    background-color: #818cf8;
    transform: translateY(-50%) scale(1.2);
    border-color: #4f46e5;
}

/* Gaya untuk garisan sementara semasa menyeret */
#ghost-line {
    stroke: #818cf8;
    stroke-width: 2.5px;
    stroke-dasharray: 6, 4;
    fill: none;
    pointer-events: none;
}

.point-left { left: -7px; }
.point-right { right: -7px; }

/* Right Panel */
.right-panel { 
    width: 380px; 
    flex-shrink: 0; 
    background-color: var(--bg-white); 
    border-left: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
}

.properties-panel { 
    height: 100%; 
    overflow-y: auto; 
}

.panel-placeholder { 
    color: var(--text-muted); 
    text-align: center; 
    padding-top: 40px; 
}

.panel-header { 
    padding: 20px; 
    border-bottom: 1px solid var(--border-color); 
    font-weight: 600; 
    font-size: 16px; 
}

.properties-panel-body {
    padding: 24px;
}

.properties-panel-body h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.properties-panel-body h4:first-child {
    border-top: none;
    padding-top: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 14px;
    background-color: var(--bg-main);
    transition: all 0.2s ease;
}

.form-group input:focus, .form-group textarea:focus {
    background-color: white;
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-light);
    border-color: var(--primary-color);
}

.option-group {
    background-color: #fafafa;
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* Buttons */
.btn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    padding: 8px 14px; 
    border-radius: 8px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    font-size: 14px; 
    border: 1px solid transparent; 
}

.btn-primary { 
    background-color: var(--primary-color); 
    color: white; 
}

.btn-primary:hover { 
    background-color: #4338ca; 
}

.btn-secondary { 
    background-color: var(--bg-white); 
    color: var(--text-dark); 
    border-color: var(--border-color); 
}

.btn-secondary:hover { 
    background-color: #f8fafc; 
}