/* Hierarchy Node Wrapper */
.hierarchy-node-wrapper {
    margin-bottom: 10px;
}

/* Node Card */
.hierarchy-node-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 16px 20px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

    .hierarchy-node-card::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 5px;
        transition: width 0.25s ease;
    }

    .hierarchy-node-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        transform: translateY(-1px);
        border-color: #dee2e6;
    }

        .hierarchy-node-card:hover::before {
            width: 8px;
        }

    /* Level-specific colors */
    .hierarchy-node-card.level-1::before {
        background: linear-gradient(180deg, #0d6efd 0%, #0b5ed7 100%);
    }

    .hierarchy-node-card.level-2::before {
        background: linear-gradient(180deg, #0dcaf0 0%, #0aa2c0 100%);
    }

    .hierarchy-node-card.level-3::before {
        background: linear-gradient(180deg, #198754 0%, #157347 100%);
    }

    .hierarchy-node-card.level-4::before {
        background: linear-gradient(180deg, #ffc107 0%, #cc9a06 100%);
    }

    .hierarchy-node-card.level-5::before {
        background: linear-gradient(180deg, #fd7e14 0%, #ca6510 100%);
    }

    .hierarchy-node-card.level-6::before {
        background: linear-gradient(180deg, #6c757d 0%, #545b62 100%);
    }

/* Main Content Layout */
.node-main-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Left Section */
.node-left-section {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

/* Toggle Button */
.node-toggle {
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn {
    background: none;
    border: none;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s;
    border-radius: 4px;
}

    .toggle-btn:hover {
        background: #f8f9fa;
        color: #0d6efd;
    }

    .toggle-btn i {
        font-size: 14px;
    }

.toggle-spacer {
    width: 24px;
    display: inline-block;
}

/* Level Badge */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

    .level-badge i {
        font-size: 11px;
    }

.level-1-badge {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    color: white;
}

.level-2-badge {
    background: linear-gradient(135deg, #0dcaf0 0%, #0aa2c0 100%);
    color: white;
}

.level-3-badge {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    color: white;
}

.level-4-badge {
    background: linear-gradient(135deg, #ffc107 0%, #cc9a06 100%);
    color: #000;
}

.level-5-badge {
    background: linear-gradient(135deg, #fd7e14 0%, #ca6510 100%);
    color: white;
}

.level-6-badge {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
}

/* Asset Icon */
.asset-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d6efd;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

/* Asset Information */
.asset-info {
    flex: 1;
    min-width: 0;
}

.asset-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.asset-code {
    font-size: 15px;
    font-weight: 700;
    color: #212529;
    font-family: 'Courier New', monospace;
}

.asset-name {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.asset-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 12px;
    color: #6c757d;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

    .meta-item i {
        font-size: 11px;
        color: #adb5bd;
    }

/* Right Section */
.node-right-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Statistics */
.node-statistics {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

    .stat-badge i {
        font-size: 11px;
    }

.stat-value {
    font-size: 14px;
    font-weight: 700;
}

.stat-label {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.9;
}

.stat-direct {
    background: linear-gradient(135deg, #e7f3ff 0%, #d0e7ff 100%);
    color: #0d6efd;
    border: 1px solid #b6d4fe;
}

.stat-total {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    border: 1px solid #dee2e6;
}

/* Actions */
.node-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}

.action-unlink {
    color: #dc3545;
    opacity: 0;
}

    .action-unlink:hover {
        background: #dc3545;
        color: white;
    }

.action-info {
    color: #6c757d;
}

    .action-info:hover {
        background: #f8f9fa;
        color: #0d6efd;
    }

.hierarchy-node-card:hover .action-unlink {
    opacity: 1;
}

/* Children Container */
.children-container {
    margin-left: 44px;
    margin-top: 10px;
    padding-left: 20px;
    border-left: 2px solid #e9ecef;
    position: relative;
}

/* Responsive Design */
@media (max-width: 992px) {
    .node-main-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .node-right-section {
        width: 100%;
        justify-content: space-between;
    }

    .stat-label {
        display: none;
    }
}

@media (max-width: 768px) {
    .hierarchy-node-card {
        padding: 12px 16px;
    }

    .asset-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .asset-code {
        font-size: 14px;
    }

    .asset-name {
        font-size: 13px;
    }

    .children-container {
        margin-left: 20px;
        padding-left: 12px;
    }
}

/* Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.children-container > .hierarchy-node-wrapper {
    animation: slideIn 0.3s ease-out;
}
