/* ==========================================================================
   NEW-BLOCKS.CSS — ИЗОЛИРОВАННЫЕ СТИЛИ ДЛЯ НОВЫХ БЛОКОВ С СУЩНОСТЯМИ ПОРТОВ
   ========================================================================== */

:root {
    --b-bg: rgba(30, 34, 42, 0.85);
    --b-border: rgba(255, 255, 255, 0.08);
    --b-border-active: #4a90e2;
    --b-text: #e2e8f0;
    --b-text-muted: #94a3b8;
    --b-accent: #3b82f6;
    --b-radius: 12px;
    
    /* Статусы */
    --status-new: #ef4444;
    --status-process: #f59e0b;
    --status-done: #10b981;
}

/* Базовый контейнер ноды-блока */
.node.node-block-type {
    position: absolute;
    box-sizing: border-box;
    background: var(--b-bg);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    color: var(--b-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 
                inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: visible; /* Чтобы сущности портов не обрезались краями ноды */
    z-index: 91;
}

/* Состояние выделения ноды */
.node.node-block-type:focus,
.node.node-block-type.selected {
    outline: none;
    border-color: var(--b-border-active);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 
                0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

/* Внутренний контейнер из шаблона t-node-layout */
.node-block-type .block {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* ==========================================
   ХЕДЕР (ШАПКА БЛОКА)
   ========================================== */
.node-block-type .header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--b-border);
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--b-radius) var(--b-radius) 0 0;
    cursor: move;
}

.node-block-type .type-text {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--b-text-muted);
    font-weight: 700;
}

.node-block-type .title-text {
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Селект выбора статуса */
.node-block-type .status-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--b-border);
    color: #fff;
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 11px;
    cursor: pointer;
    outline: none;
}
.node-block-type .status-select:focus {
    border-color: var(--b-accent);
}

/* ==========================================
   БОДИ (ОСНОВНОЙ КОНТЕНТ)
   ========================================== */
.node-block-type .body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 12px;
    overflow-y: auto;
    min-height: 0; /* Обеспечивает корректный внутренний скролл */
}

/* Контейнер динамических полей инпутов */
.node-block-type .fields-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Стили строк ввода (Шаблоны t-text и t-select) */
.node-block-type .node-flex-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.node-block-type .node-flex-row label {
    font-size: 11px;
    color: var(--b-text-muted);
    font-weight: 500;
}

/* Поля ввода, селекты и текстареа */
.node-block-type .node-input,
.node-block-type .node-select,
.node-block-type .textarea {
    box-sizing: border-box;
    width: 100%;
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid var(--b-border);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.node-block-type .node-input:focus,
.node-block-type .node-select:focus,
.node-block-type .textarea:focus {
    border-color: var(--b-accent);
    background: rgba(15, 17, 23, 0.9);
}

/* Группа чекбоксов */
.node-block-type .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}

.node-block-type .checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.node-block-type .checkbox-group input[type="checkbox"] {
    appearance: none;
    width: 15px;
    height: 15px;
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid var(--b-border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    outline: none;
}

.node-block-type .checkbox-group input[type="checkbox"]:checked {
    background: var(--b-accent);
    border-color: var(--b-accent);
}

.node-block-type .checkbox-group input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    left: 3px;
    top: 0px;
}

/* ==========================================
   БЛОК ДОКУМЕНТАЦИИ (DETAILS)
   ========================================== */
.node-block-type .details-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    border-top: 1px dashed var(--b-border);
    padding-top: 10px;
}

.node-block-type .details-wrapper label {
    font-size: 11px;
    color: var(--b-text-muted);
}

.node-block-type .textarea.has-details {
    min-height: 50px;
    resize: vertical;
}

/* Кнопка тумблера деталей */
.node-block-type .footer-actions {
    display: flex;
    justify-content: flex-end;
}

.node-block-type .btn-toggle-details {
    background: none;
    border: none;
    color: var(--b-text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.node-block-type .btn-toggle-details:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}
.node-block-type .btn-toggle-details::before {
    content: "▼ Show Notes";
}
.node-block-type .details-wrapper:not([style*="display: none"]) ~ .footer-actions .btn-toggle-details::before {
    content: "▲ Hide Notes";
}

/* ==========================================
   ФУТЕР (СТАТУСНЫЕ ПОЛЯ)
   ========================================== */
.node-block-type .footer {
    padding: 8px 14px;
    border-top: 1px solid var(--b-border);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 var(--b-radius) var(--b-radius);
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.node-block-type .footer .label {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
}

.node-block-type .footer [data-field="footer-success"] {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-done);
}

.node-block-type .footer [data-field="footer-error"] {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-new);
}

.node-block-type .footer [data-field="footer-default"] {
    background: rgba(245, 158, 11, 0.15);
    color: var(--status-process);
}

.node-block-type .footer [data-field="footer-text"] {
    color: var(--b-text-muted);
    padding-left: 0;
}



/* ==========================================
   РЕСАЙЗЕР (УГОЛОК ИЗМЕНЕНИЯ РАЗМЕРОВ)
   ========================================== */
.node-block-type .resizer {
    position: absolute;
    width: 14px;
    height: 14px;
    right: 4px;
    bottom: 4px;
    cursor: se-resize;
    z-index: 10;
    background-image: linear-gradient(135deg, transparent 30%, var(--b-text-muted) 30%, var(--b-text-muted) 45%, transparent 45%, transparent 60%, var(--b-text-muted) 60%, var(--b-text-muted) 75%, transparent 75%);
    background-size: 6px 6px;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.node-block-type .resizer:hover {
    opacity: 0.9;
}