/* ==========================================================================
   BLOCKS.CSS - Área de Script, Blocos de Código, Pílulas, Hexágonos e Slots
   ========================================================================== */

#scriptZone {
    position: relative;
    flex: 1;               
    min-height: 250px;     
    padding: 10px;         
    border-radius: 5px;    
    transition: background-color 0.2s;
    overflow: auto; 
}

.drop-indicator {
    border: 2px dashed #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

/* Categorias de Blocos na Sidebar */
.category {
    margin-bottom: 25px;
}

.category-title {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 11px;
    color: #bdc3c7;
    margin-bottom: 12px;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

/* Bloco Genérico Estático (Menu Lateral) */
.block {
    background: #2c3e50;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 13px;
    border-left: 4px solid transparent;
    transition: transform 0.1s;
    user-select: none;
}

.block:hover {
    transform: translateX(5px);
    background: #3e5871;
}

/* Bordas coloridas por categoria na Sidebar */
.block.action { border-left-color: #3498db; }
.block.control { border-left-color: #e67e22; }
.block.logic { border-left-color: #16a085; }
.block.element { border-left-color: #9b59b6; }
.block[data-event] { border-left-color: #e74c3c; }

/* Blocos Dinâmicos Instanciados (Dropped) */
.dropped-block {
    background: #3498db;
    padding: 12px;
    margin: 10px 0;
    border-radius: 5px;
    position: relative;
    min-height: 45px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.dropped-block.action { background: #3498db; color: white; }
.dropped-block.element { background: #9b59b6; color: white; }
.dropped-block.control { background: #e67e22; color: white; }
.dropped-block.logic { background: #16a085; color: white; }
.dropped-block[data-type="event"] { background: #e74c3c; color: white; }

.dropped-block .delete-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
}

.dropped-block .delete-btn:hover {
    background: #c0392b;
}

/* Customização de Inputs e Selects internos das estruturas */
.input-field, .select-field {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 3px;
    padding: 2px 5px;
    width: 80px;
}

.select-field option {
    background: #2c3e50;
    color: white;
}

.nested-block {
    display: inline-block;
    background: rgba(0,0,0,0.2);
    padding: 8px;
    border-radius: 4px;
    margin: 2px;
    font-size: 12px;
}

/* 1. FORMATO ADV HEXAGONAL: Apenas para Elementos do Canvas (Roxos) */
.block[data-elem-id], 
#dynamicElements .block,
.dropped-block[data-elem-id] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: 120px;
    height: 42px;
    margin: 4px;
    padding: 0 20px;
    background: #8e44ad !important;
    color: white;
    font-size: 13px;
    font-weight: 500;
    clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
    border: none !important;
    box-shadow: none !important;
    vertical-align: middle;
}

.block[data-elem-id]:hover, #dynamicElements .block:hover {
    background: #9b59b6 !important;
    transform: scale(1.05);
}

/* 2. FORMATO ADV PÍLULA: Modificadores para Ações e Lógica */
.block[data-type="action"], 
.block[data-type="logic"],
.dropped-block[data-type="action"],
.dropped-block[data-type="logic"] {
    display: inline-flex;
    align-items: center;
    width: auto !important;
    min-width: 100px;
    height: 34px;
    margin: 4px;
    padding: 0 15px;
    border-radius: 20px; 
    border: none !important;
    color: white;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    vertical-align: middle;
}

.block[data-type="action"], .dropped-block[data-type="action"] { background: #3498db !important; }
.block[data-type="logic"], .dropped-block[data-type="logic"]  { background: #27ae60 !important; }

/* 3. FORMATO ADV BLOCO RETANGULAR ESTRUTURAL: Para Controle e Eventos */
.block[data-type="control"],
.block[data-type="event"] {
    display: block;
    width: 100%;
    min-height: 45px;
    margin: 10px 0;
    padding: 12px;
    border-radius: 8px;
    background: #f39c12 !important;
    border-left: 6px solid rgba(0,0,0,0.2);
    color: white;
}

.block[data-type="action"] .input-field,
.block[data-type="logic"] .input-field {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    color: white;
    padding: 2px 8px;
    width: 80px;
    margin: 0 5px;
}

/* Ajustes dos Contêineres de Encaixe (Slots) */
.slot:not(.block-container) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    min-height: 30px;
    background: rgba(0,0,0,0.1);
    border: 1px dashed rgba(255,255,255,0.3);
    border-radius: 15px;
    padding: 0 5px;
    vertical-align: middle;
}

.slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    min-width: 30px;
    min-height: 20px;
}

.slot:not(.block-container).ui-droppable-hover,
.slot:not(.block-container).drop-active {
    background: rgba(255, 255, 255, 0.3);
}

.slot .dropped-block {
    position: relative; 
    left: 0 !important;
    top: 0 !important;
    transform: translate(0px, 0px) !important;
    margin: 0 !important;
    display: inline-flex !important;
    width: auto !important;
}

/* Modificações estritas de estados de Arrastar (Interact.js) */
.block, .dropped-block {
    cursor: grab;
}

.block:active, .dropped-block:active {
    cursor: grabbing;
}