* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.toolbar {
    background-color: #333;
    color: white;
    padding: 10px;
    display: flex;
    gap: 10px;
}

.toolbar button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.toolbar button:hover {
    background-color: #45a049;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.canvas-container {
    flex: 1;
    background-color: #ffffff;
    overflow: hidden;
    position: relative;
}

#editor-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: #f8f9fa;
    --no-border: 2px dashed #b0b0b0;
    overflow: visible;
}

/* Debug: base image border, remove if not needed */
#editor-canvas > img, #editor-canvas > svg {
    /* Remove debug border if not needed */
    border: none;
    pointer-events: auto;
    user-drag: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

.layers-panel {
    width: 300px;
    background-color: #f8f8f8;
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid #ddd;
}

.layers-panel h3 {
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 4px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.layer-item:hover {
    background-color: #f0f0f0;
}

.layer-item.selected {
    background-color: #4CAF50;
    color: white;
}

.layer-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    background-color: #ddd;
    border-radius: 3px;
}

.layer-item.selected .layer-icon {
    background-color: rgba(255, 255, 255, 0.3);
}

.layer-name {
    flex: 1;
    font-size: 14px;
}

.layer-controls {
    display: flex;
    gap: 4px;
}

.layer-btn {
    width: 20px;
    height: 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    border-radius: 2px;
    font-size: 12px;
}

.layer-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.properties-panel {
    width: 300px;
    background-color: #eee;
    padding: 15px;
    overflow-y: auto;
    border-left: 1px solid #ddd;
}

.properties-panel h3 {
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.element {
    position: absolute;
    cursor: move;
}

.element.selected {
    outline: 2px solid #4CAF50;
}

.element[data-type="flowLine"].selected {
    outline: none;
}

.flow-line {
    position: absolute;
    pointer-events: none;
}

.flow-point {
    width: 10px;
    height: 10px;
    background-color: #4CAF50;
    border-radius: 50%;
    position: absolute;
    cursor: move;
    z-index: 10;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    margin: 0;
    padding: 0;
    transform: none !important; /* Evitar transformaciones que puedan interferir */
}

.flow-point.control-point {
    background-color: #ff9800;
    width: 8px;
    height: 8px;
    border: 1px solid #666;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
}

.flow-line-container {
    min-width: 100px;
    min-height: 100px;
}

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

.property-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.property-row label {
    flex: 1;
    font-weight: bold;
    font-size: 12px;
    margin: 0;
}

.property-row input,
.property-row select {
    flex: 1;
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.property-row input[type="checkbox"] {
    flex: none;
    width: auto;
}

.property-row input[type="color"] {
    flex: none;
    width: 40px;
    height: 28px;
    padding: 0;
    border: none;
}

.property-group button {
    width: 100%;
    padding: 6px;
    margin-top: 8px;
    font-size: 12px;
}

.flow-point:hover {
    transform: scale(1.2) !important;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

.element[data-type="flowLine"] {
    pointer-events: auto;
}

.element[data-type="flowLine"] svg {
    pointer-events: none;
}

.element[data-type="flowLine"] path {
    pointer-events: stroke;
}

.element[data-type="flowLine"].selected {
    /* No visual container outline */
}

@keyframes dash-forward {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -30px; }
}

@keyframes dash-backward {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 30px; }
}

@keyframes dash-wide-forward {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -50px; }
}

@keyframes dash-wide-backward {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 50px; }
}

/* Remove blue focus outlines from buttons and form controls */
button:focus, .btn:focus, input:focus, select:focus, textarea:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Prevent text selection everywhere except input, textarea, and select */
.app-container, .main-content, .sidebar, .tools-panel, .layers-panel, .canvas-container, .properties-panel, #editor-canvas, button, .btn {
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}
input, textarea, select {
    user-select: text;
    -webkit-user-select: text;
    -ms-user-select: text;
}